diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2015-04-07 16:43:37 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-04-09 04:31:24 -0400 |
commit | 31f0119b817f6474a7b4c48fed7588af1b62c543 (patch) | |
tree | 9cabd0a1349b0852b56421d68b62c00d493654fa /arch/x86/kernel/entry_64.S | |
parent | 8b3607b5b8c591d8bf045911cb7c90ecaa6e7b73 (diff) |
x86/asm/entry/64: Use common code for rt_sigreturn() epilogue
Similarly to stub_execve, we can reuse the epilogue in
stub_rt_sigreturn() and stub_x32_rt_sigreturn().
Add a comment explaining why we can't eliminage SAVE_EXTRA_REGS
here.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Drewry <wad@chromium.org>
Link: http://lkml.kernel.org/r/1428439424-7258-1-git-send-email-dvlasenk@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/entry_64.S')
-rw-r--r-- | arch/x86/kernel/entry_64.S | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 3197f41ce320..5252e6021826 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -527,12 +527,21 @@ END(stub_execveat) | |||
527 | */ | 527 | */ |
528 | ENTRY(stub_rt_sigreturn) | 528 | ENTRY(stub_rt_sigreturn) |
529 | CFI_STARTPROC | 529 | CFI_STARTPROC |
530 | addq $8, %rsp | 530 | DEFAULT_FRAME 0, 8 |
531 | DEFAULT_FRAME 0 | 531 | /* |
532 | SAVE_EXTRA_REGS | 532 | * SAVE_EXTRA_REGS result is not normally needed: |
533 | * sigreturn overwrites all pt_regs->GPREGS. | ||
534 | * But sigreturn can fail (!), and there is no easy way to detect that. | ||
535 | * To make sure RESTORE_EXTRA_REGS doesn't restore garbage on error, | ||
536 | * we SAVE_EXTRA_REGS here. | ||
537 | */ | ||
538 | SAVE_EXTRA_REGS 8 | ||
533 | call sys_rt_sigreturn | 539 | call sys_rt_sigreturn |
534 | movq %rax,RAX(%rsp) # fixme, this could be done at the higher layer | 540 | return_from_stub: |
541 | addq $8, %rsp | ||
542 | CFI_ADJUST_CFA_OFFSET -8 | ||
535 | RESTORE_EXTRA_REGS | 543 | RESTORE_EXTRA_REGS |
544 | movq %rax,RAX(%rsp) | ||
536 | jmp int_ret_from_sys_call | 545 | jmp int_ret_from_sys_call |
537 | CFI_ENDPROC | 546 | CFI_ENDPROC |
538 | END(stub_rt_sigreturn) | 547 | END(stub_rt_sigreturn) |
@@ -540,13 +549,10 @@ END(stub_rt_sigreturn) | |||
540 | #ifdef CONFIG_X86_X32_ABI | 549 | #ifdef CONFIG_X86_X32_ABI |
541 | ENTRY(stub_x32_rt_sigreturn) | 550 | ENTRY(stub_x32_rt_sigreturn) |
542 | CFI_STARTPROC | 551 | CFI_STARTPROC |
543 | addq $8, %rsp | 552 | DEFAULT_FRAME 0, 8 |
544 | DEFAULT_FRAME 0 | 553 | SAVE_EXTRA_REGS 8 |
545 | SAVE_EXTRA_REGS | ||
546 | call sys32_x32_rt_sigreturn | 554 | call sys32_x32_rt_sigreturn |
547 | movq %rax,RAX(%rsp) # fixme, this could be done at the higher layer | 555 | jmp return_from_stub |
548 | RESTORE_EXTRA_REGS | ||
549 | jmp int_ret_from_sys_call | ||
550 | CFI_ENDPROC | 556 | CFI_ENDPROC |
551 | END(stub_x32_rt_sigreturn) | 557 | END(stub_x32_rt_sigreturn) |
552 | 558 | ||