Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1354807
| From | Andy Lutomirski <luto@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 04/12] x86/entry/32: Restore FLAGS on SYSEXIT |
| Date | 2016-03-10 04:10 +0100 |
| Message-ID | <raZ98-HP-21@gated-at.bofh.it> (permalink) |
| References | <raZ97-HP-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
We weren't restoring FLAGS at all on SYSEXIT. Apparently no one cared. With this patch applied, native kernels should always honor task_pt_regs()->flags, which opens the door for some sys_iopl cleanups. I'll do those as a separate series, though, since getting it right will involve tweaking some paravirt ops. (The short version is that, before this patch, sys_iopl, invoked via SYSENTER, wasn't guaranteed to ever transfer the updated regs->flags, so sys_iopl had to change the hardware flags register as well.) Reported-by: Brian Gerst <brgerst@gmail.com> Signed-off-by: Andy Lutomirski <luto@kernel.org> --- arch/x86/entry/entry_32.S | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S index 86665f93ff5d..d1437fdbf597 100644 --- a/arch/x86/entry/entry_32.S +++ b/arch/x86/entry/entry_32.S @@ -343,6 +343,15 @@ sysenter_past_esp: popl %eax /* pt_regs->ax */ /* + * Restore all flags except IF (we restore IF separately because + * STI gives a one-instruction window in which we won't be interrupted, + * whereas POPF does not. + */ + addl $PT_EFLAGS-PT_DS, %esp /* point esp at pt_regs->flags */ + btr $X86_EFLAGS_IF_BIT, (%esp) + popfl + + /* * Return back to the vDSO, which will pop ecx and edx. * Don't bother with DS and ES (they already contain __USER_DS). */ -- 2.5.0
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH v2 04/12] x86/entry/32: Restore FLAGS on SYSEXIT Andy Lutomirski <luto@kernel.org> - 2016-03-10 04:10 +0100 [tip:x86/asm] x86/entry/32: Restore FLAGS on SYSEXIT tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-03-10 12:10 +0100
csiph-web