diff options
author | Roland McGrath <roland@redhat.com> | 2008-06-23 23:41:12 -0400 |
---|---|---|
committer | Roland McGrath <roland@redhat.com> | 2008-07-23 20:43:36 -0400 |
commit | 15e8f348db372dec21229fda5d52ae6ee7e64666 (patch) | |
tree | 73afc044ef5b4e29a893e98afee2fe794938aeb3 | |
parent | 20b7997e8abdf338dcc27fb4f1333c4973a7f113 (diff) |
x86_64: remove bogus optimization in sysret_signal
This short-circuit path in sysret_signal looks wrong to me.
AFAICT, in practice the branch is never taken--and if it were,
it would go wrong. To wit, try loading a module whose init
function does set_thread_flag(TIF_IRET), and see insmod crash
(presumably with a wrong user stack pointer).
This is because the FIXUP_TOP_OF_STACK work hasn't been done yet
when we jump around the call to ptregscall_common and get to
int_with_check--where it expects the user RSP,SS,CS and EFLAGS to
have been stored by FIXUP_TOP_OF_STACK.
I don't think it's normally possible to get to sysret_signal with no
_TIF_DO_NOTIFY_MASK bits set anyway, so these two instructions are
already superfluous. If it ever did happen, it is harmless to call
do_notify_resume with nothing for it to do.
Signed-off-by: Roland McGrath <roland@redhat.com>
-rw-r--r-- | arch/x86/kernel/entry_64.S | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 8410e26f4183..a169225869cc 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -402,16 +402,12 @@ sysret_careful: | |||
402 | sysret_signal: | 402 | sysret_signal: |
403 | TRACE_IRQS_ON | 403 | TRACE_IRQS_ON |
404 | ENABLE_INTERRUPTS(CLBR_NONE) | 404 | ENABLE_INTERRUPTS(CLBR_NONE) |
405 | testl $_TIF_DO_NOTIFY_MASK,%edx | ||
406 | jz 1f | ||
407 | |||
408 | /* Really a signal */ | ||
409 | /* edx: work flags (arg3) */ | 405 | /* edx: work flags (arg3) */ |
410 | leaq do_notify_resume(%rip),%rax | 406 | leaq do_notify_resume(%rip),%rax |
411 | leaq -ARGOFFSET(%rsp),%rdi # &pt_regs -> arg1 | 407 | leaq -ARGOFFSET(%rsp),%rdi # &pt_regs -> arg1 |
412 | xorl %esi,%esi # oldset -> arg2 | 408 | xorl %esi,%esi # oldset -> arg2 |
413 | call ptregscall_common | 409 | call ptregscall_common |
414 | 1: movl $_TIF_WORK_MASK,%edi | 410 | movl $_TIF_WORK_MASK,%edi |
415 | /* Use IRET because user could have changed frame. This | 411 | /* Use IRET because user could have changed frame. This |
416 | works because ptregscall_common has called FIXUP_TOP_OF_STACK. */ | 412 | works because ptregscall_common has called FIXUP_TOP_OF_STACK. */ |
417 | DISABLE_INTERRUPTS(CLBR_NONE) | 413 | DISABLE_INTERRUPTS(CLBR_NONE) |