summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-06-18 21:08:48 +0000
committerkib <kib@FreeBSD.org>2012-06-18 21:08:48 +0000
commit4eede7506a622bcd2565763d6252acab3158d730 (patch)
treed662aca7b5ccc9392a555105f821478949ef0621 /sys/amd64
parent545343a302c3d00edd5511356e6641d6597f4720 (diff)
downloadFreeBSD-src-4eede7506a622bcd2565763d6252acab3158d730.zip
FreeBSD-src-4eede7506a622bcd2565763d6252acab3158d730.tar.gz
Adjust the fix in r236953, by not generating the signal manually, but
performing the return to usermode using full return path. This consolidates the handling of exceptional situations in less number of places, and is less code as well. Reviewed by: jhb MFC after: 1 week
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/trap.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index 4216fd3..75e15e0 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -977,16 +977,10 @@ amd64_syscall(struct thread *td, int traced)
* If the user-supplied value of %rip is not a canonical
* address, then some CPUs will trigger a ring 0 #GP during
* the sysret instruction. However, the fault handler would
- * execute with the user's %gs and %rsp in ring 0 which would
- * not be safe. Instead, preemptively kill the thread with a
- * SIGBUS.
+ * execute in ring 0 with the user's %gs and %rsp which would
+ * not be safe. Instead, use the full return path which
+ * catches the problem safely.
*/
- if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) {
- ksiginfo_init_trap(&ksi);
- ksi.ksi_signo = SIGBUS;
- ksi.ksi_code = BUS_OBJERR;
- ksi.ksi_trapno = T_PROTFLT;
- ksi.ksi_addr = (void *)td->td_frame->tf_rip;
- trapsignal(td, &ksi);
- }
+ if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS)
+ set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
}
OpenPOWER on IntegriCloud