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


Groups > linux.kernel > #1343438

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 20:50 +0100
Message-ID <r6a5c-cB-5@gated-at.bofh.it> (permalink)
References (4 earlier) <r64sP-4uZ-1@gated-at.bofh.it> <r66kW-5Wh-19@gated-at.bofh.it> <r68PL-7PS-7@gated-at.bofh.it> <r68Zs-7W1-23@gated-at.bofh.it> <r69Vw-9g-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Feb 25, 2016 at 11:31 AM, Brian Gerst <brgerst@gmail.com> wrote:
> On Thu, Feb 25, 2016 at 1:30 PM, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
>> On Thu, Feb 25, 2016 at 10:20 AM, Andy Lutomirski <luto@amacapital.net> wrote:
>>>
>>> Ideally we'd fix this up and restore flags on sysexit.  At least
>>> failing to restore arithmetic flags isn't an info leak because the
>>> exit code clobbers them with entirely predictable data.  I doubt
>>> anyone cares all that much if we clobber AC.
>>
>> As long as the "clobber AC" is purely about clearing it, it's probably fine.
>>
>> Although there may be programs that set AC in order to actually get
>> notified about alignment issues (perhaps for portability reasons,
>> perhaps for small performance reasons). Clearing it will make those
>> programs still work, but they lose the checking.
>>
>>> I wrote a test for NT and the test fails for a different reason: our
>>> TF handling appears broken as well.  (Our sysenter TF handling is
>>> *crap*, but it seems to work on 64-bit kernels at least.)
>>
>> TF should be entirely immaterial for system calls. Why would we care?
>> We need it for correct handling of real traps, but not for the system
>> call case afaik. Returning with TF clear is the right thing, since
>> we're not returning *to* the system call instruction, but the
>> instruction after.
>>
>>> My personal preference would be to add the missing popf.
>>
>> I don't mind adding the popf, but it won't help for iopl. Only iret
>> restores iopl, if I recall correctly (but maybe I don't, and I'm too
>> lazy to take the 30 seconds to look it up).
>>
>>                Linus
>
> According to the SDM, popf will change IOPL only at CPL0, which is why
> Xen (which runs at CPL1 on 32-bit) has a paravirt hook for it.

But maybe we can ditch that paravirt hook and just modify regs->flags
in sys_iopl.  Xen never uses sysexit at all:

    /* XEN PV guests always use IRET path */
    ALTERNATIVE "testl %eax, %eax; jz .Lsyscall_32_done", \
            "jmp .Lsyscall_32_done", X86_FEATURE_XENPV

and if we add the missing popf, we should be good to go.

--Andy

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