Commit a879cbbb authored by Linus Torvalds's avatar Linus Torvalds

x86: make traps on 'iret' be debuggable in user space

This makes a trap on the 'iret' that returns us to user space
cause a nice clean SIGSEGV, instead of just a hard (and silent)
exit.

That way a debugger can actually try to see what happened, and
we also properly notify everybody who might be interested about
us being gone.

This loses the error code, but tells the debugger what happened
with ILL_BADSTK in the siginfo.
parent c06fec50
...@@ -260,11 +260,9 @@ restore_nocheck: ...@@ -260,11 +260,9 @@ restore_nocheck:
.section .fixup,"ax" .section .fixup,"ax"
iret_exc: iret_exc:
sti sti
movl $__USER_DS, %edx pushl $0 # no error code
movl %edx, %ds pushl $do_iret_error
movl %edx, %es jmp error_code
movl $11,%eax
call do_exit
.previous .previous
.section __ex_table,"a" .section __ex_table,"a"
.align 4 .align 4
......
...@@ -451,6 +451,7 @@ DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) ...@@ -451,6 +451,7 @@ DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS)
DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) DO_ERROR(11, SIGBUS, "segment not present", segment_not_present)
DO_ERROR(12, SIGBUS, "stack segment", stack_segment) DO_ERROR(12, SIGBUS, "stack segment", stack_segment)
DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0)
DO_ERROR_INFO(32, SIGSEGV, "iret exception", iret_error, ILL_BADSTK, 0)
fastcall void do_general_protection(struct pt_regs * regs, long error_code) fastcall void do_general_protection(struct pt_regs * regs, long error_code)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment