summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1999-02-12 19:40:12 +0000
committerderaadt <deraadt@openbsd.org>1999-02-12 19:40:12 +0000
commit66af7e91c7d0676ee10e58f5a7566c9ccc5dce89 (patch)
treec091e39713bfe34dfd63c363c1481de692337a9c
parentNote that vacation can now use the Return-Path (diff)
downloadwireguard-openbsd-66af7e91c7d0676ee10e58f5a7566c9ccc5dce89.tar.xz
wireguard-openbsd-66af7e91c7d0676ee10e58f5a7566c9ccc5dce89.zip
do not accept T_TRCTRAP DDB inside the osyscall stub; weingart
-rw-r--r--sys/arch/i386/i386/locore.s3
-rw-r--r--sys/arch/i386/i386/trap.c29
2 files changed, 23 insertions, 9 deletions
diff --git a/sys/arch/i386/i386/locore.s b/sys/arch/i386/i386/locore.s
index 655b061b84c..56a1077bda6 100644
--- a/sys/arch/i386/i386/locore.s
+++ b/sys/arch/i386/i386/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.45 1998/09/06 20:09:58 millert Exp $ */
+/* $OpenBSD: locore.s,v 1.46 1999/02/12 19:40:12 deraadt Exp $ */
/* $NetBSD: locore.s,v 1.145 1996/05/03 19:41:19 christos Exp $ */
/*-
@@ -2067,6 +2067,7 @@ IDTVEC(osyscall)
popfl
pushl $7 # size of instruction for restart
jmp syscall1
+IDTVEC(osyscall_end)
/*
* Trap gate entry for syscall
diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c
index 860fd63c6f0..0f8d59784e8 100644
--- a/sys/arch/i386/i386/trap.c
+++ b/sys/arch/i386/i386/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.28 1999/02/10 08:07:20 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.29 1999/02/12 19:40:12 deraadt Exp $ */
/* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */
#undef DEBUG
@@ -220,6 +220,26 @@ trap(frame)
switch (type) {
+ /* trace trap */
+ case T_TRCTRAP: {
+#ifdef DDB
+ /* Make sure nobody is single stepping into kernel land.
+ * The syscall has to turn off the trace bit itself. The
+ * easiest way, is to simply not call the debugger, until
+ * we are through the problematic "osyscall" stub. This
+ * is a hack, but it does seem to work.
+ */
+ extern int Xosyscall, Xosyscall_end;
+
+ if (frame.tf_eip >= (int)&Xosyscall &&
+ frame.tf_eip <= (int)&Xosyscall_end)
+ return;
+#else
+ return; /* Just return if no DDB */
+#endif
+ }
+ /* FALLTHROUGH */
+
default:
we_re_toast:
#ifdef DDB
@@ -457,13 +477,6 @@ trap(frame)
break;
}
-#ifndef DDB
- /* XXX need to deal with this when DDB is present, too */
- case T_TRCTRAP: /* kernel trace trap; someone single stepping lcall's */
- /* syscall has to turn off the trace bit itself */
- return;
-#endif
-
case T_BPTFLT|T_USER: /* bpt instruction fault */
sv.sival_int = rcr2();
trapsignal(p, SIGTRAP, type &~ T_USER, TRAP_BRKPT, sv);