Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1342950

Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32

From Andy Lutomirski <luto@amacapital.net>
Newsgroups linux.kernel
Subject Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32
Date 2016-02-25 09:20 +0100
Message-ID <r5Zjs-XU-9@gated-at.bofh.it> (permalink)
References <r5sxb-2Gj-1@gated-at.bofh.it> <r5X80-7HS-49@gated-at.bofh.it> <r5XB1-8aU-31@gated-at.bofh.it> <r5Z9M-U0-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Feb 25, 2016 at 12:07 AM, Andy Lutomirski <luto@amacapital.net> wrote:
> [resend -- thank you Gmail for sucking]
>
> On Wed, Feb 24, 2016 at 10:00 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>> On 02/24/16 21:53, tip-bot for Andy Lutomirski wrote:
>>> Commit-ID:  04d1d281dcfe683a53cddfab8371fc8bb302b069
>>> Gitweb:     http://git.kernel.org/tip/04d1d281dcfe683a53cddfab8371fc8bb302b069
>>> Author:     Andy Lutomirski <luto@kernel.org>
>>> AuthorDate: Tue, 23 Feb 2016 13:19:29 -0800
>>> Committer:  Ingo Molnar <mingo@kernel.org>
>>> CommitDate: Wed, 24 Feb 2016 08:43:04 +0100
>>>
>>> x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32
>>>
>>> Both before and after 5f310f739b4c ("x86/entry/32: Re-implement
>>> SYSENTER using the new C path"), we relied on a uaccess very early
>>> in the SYSENTER path to clear AC.  After that change, though, we can
>>> potentially make it all the way into C code with AC set, which
>>> enlarges the attack surface for SMAP bypass by doing SYSENTER with
>>> AC set.
>>>
>>> Strengthen the SMAP protection by addding the missing ASM_CLAC right
>>> at the beginning.
>>>
>>
>> Hmmm... this potentially adds a *lot* of unnecessary cycles to this
>> path.  Could we reinstate the early uaccess?
>>
>
> I think that's more trouble than it's worth, and it'll undo a bunch of
> the context tracking cleanups that deferring it made possible,
> especially since this only matters in a configuration (32-bit SMAP)
> that no one uses. [1]
>
> *However*, I just realized that I have no idea why the 32-bit sysenter
> path is safe against NT being set.  I fixed it on compat, and now I'm
> confused as to the status on 32-bit.  If we need to fix up NT, I think
> we can fold AC into that.
>

It is, indeed, broken.  My test case doesn't notice because
opportunistic sysexit papers over the issue.  Grump.

> Also, I'll try to benchmark this soon.
>
> [1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=de9e478b9d49f3a0214310d921450cf5bb4a21e6
> (it didn't even boot through most of 4.5-rc)



-- 
Andy Lutomirski
AMA Capital Management, LLC

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 Andy Lutomirski <luto@kernel.org> - 2016-02-23 22:20 +0100
  Re: [PATCH] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 Brian Gerst <brgerst@gmail.com> - 2016-02-24 16:50 +0100
    Re: [PATCH] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 Andy Lutomirski <luto@amacapital.net> - 2016-02-24 18:00 +0100
  [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-02-25 07:00 +0100
    Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to  entry_SYSENTER_32 "H. Peter Anvin" <hpa@zytor.com> - 2016-02-25 07:30 +0100
      Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 Andy Lutomirski <luto@amacapital.net> - 2016-02-25 09:10 +0100
        Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 Andy Lutomirski <luto@amacapital.net> - 2016-02-25 09:20 +0100
        Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to  entry_SYSENTER_32 Ingo Molnar <mingo@kernel.org> - 2016-02-25 09:20 +0100
          Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to  entry_SYSENTER_32 Mike Galbraith <umgwanakikbuti@gmail.com> - 2016-02-25 09:30 +0100
            Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to  entry_SYSENTER_32 Ingo Molnar <mingo@kernel.org> - 2016-02-25 09:50 +0100
              Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to  entry_SYSENTER_32 Mike Galbraith <umgwanakikbuti@gmail.com> - 2016-02-25 10:10 +0100
      Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 Brian Gerst <brgerst@gmail.com> - 2016-02-25 14:50 +0100
        Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 Brian Gerst <brgerst@gmail.com> - 2016-02-25 16:50 +0100
          Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 Andy Lutomirski <luto@amacapital.net> - 2016-02-25 19:30 +0100
            Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 Linus Torvalds <torvalds@linux-foundation.org> - 2016-02-25 19:40 +0100
              Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 Andy Lutomirski <luto@amacapital.net> - 2016-02-25 19:50 +0100
              Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 Brian Gerst <brgerst@gmail.com> - 2016-02-25 20:40 +0100
                Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 Andy Lutomirski <luto@amacapital.net> - 2016-02-25 20:50 +0100
                Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 Brian Gerst <brgerst@gmail.com> - 2016-02-25 20:50 +0100
                Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 Andy Lutomirski <luto@amacapital.net> - 2016-02-25 21:00 +0100
                Re: [tip:x86/urgent] x86/entry/32: Add an ASM_CLAC to entry_SYSENTER_32 Linus Torvalds <torvalds@linux-foundation.org> - 2016-02-25 22:00 +0100

csiph-web