diff options
author | bsd <bsd@FreeBSD.org> | 2000-02-20 20:51:23 +0000 |
---|---|---|
committer | bsd <bsd@FreeBSD.org> | 2000-02-20 20:51:23 +0000 |
commit | 85f1c223b39c92c49e8b7c6c7ad39d3e42a27574 (patch) | |
tree | 24b3d3119a30ef55034eb6483b006f39f272b986 /sys/kern/subr_trap.c | |
parent | 5e5e3ebba622666325b5191546c69ed7f00a5781 (diff) | |
download | FreeBSD-src-85f1c223b39c92c49e8b7c6c7ad39d3e42a27574.zip FreeBSD-src-85f1c223b39c92c49e8b7c6c7ad39d3e42a27574.tar.gz |
Don't forget to reset the hardware debug registers when a process that
was using them exits.
Don't allow a user process to cause the kernel to take a TRCTRAP on a
user space address.
Reviewed by: jlemon, sef
Approved by: jkh
Diffstat (limited to 'sys/kern/subr_trap.c')
-rw-r--r-- | sys/kern/subr_trap.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 4199346..a8b73cf 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -519,8 +519,26 @@ kernel_trap: frame.tf_eflags &= ~PSL_T; return; } + /* + * Ignore debug register trace traps due to + * accesses in the user's address space, which + * can happen under several conditions such as + * if a user sets a watchpoint on a buffer and + * then passes that buffer to a system call. + * We still want to get TRCTRAPS for addresses + * in kernel space because that is useful when + * debugging the kernel. + */ + if (user_dbreg_trap()) { + /* + * Reset breakpoint bits because the + * processor doesn't + */ + load_dr6(rdr6() & 0xfffffff0); + return; + } /* - * Fall through. + * Fall through (TRCTRAP kernel mode, kernel address) */ case T_BPTFLT: /* |