diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2011-09-27 13:17:02 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2011-09-27 13:17:02 +0000 |
commit | ce8bd78b2aec7eb6ee3fb1e5bdb04c3a2f5b412d (patch) | |
tree | 711070f981692411dd89024c8710f37e0b59b824 /sys/kern/subr_syscall.c | |
parent | a01fdfcef1f44a622ab88ba88cfe55dc29a62d63 (diff) | |
download | src-ce8bd78b2aec7eb6ee3fb1e5bdb04c3a2f5b412d.tar.gz src-ce8bd78b2aec7eb6ee3fb1e5bdb04c3a2f5b412d.zip |
Do not deliver SIGTRAP on exec as the normal signal, use ptracestop() on
syscall exit path. Otherwise, if SIGTRAP is ignored, that tdsendsignal()
do not want to deliver the signal, and debugger never get a notification
of exec.
Found and tested by: Anton Yuzhaninov <citrin citrin ru>
Discussed with: jhb
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=225791
Diffstat (limited to 'sys/kern/subr_syscall.c')
-rw-r--r-- | sys/kern/subr_syscall.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index cb0d9295ed2b..bba44794cefb 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -204,9 +204,17 @@ syscallret(struct thread *td, int error, struct syscall_args *sa __unused) * is not the case, this code will need to be revisited. */ STOPEVENT(p, S_SCX, sa->code); - PTRACESTOP_SC(p, td, S_PT_SCX); if (traced || (td->td_dbgflags & (TDB_EXEC | TDB_FORK)) != 0) { PROC_LOCK(p); + /* + * If tracing the execed process, trap to the debugger + * so that breakpoints can be set before the program + * executes. If debugger requested tracing of syscall + * returns, do it now too. + */ + if (traced && ((td->td_dbgflags & TDB_EXEC) != 0 || + (p->p_stops & S_PT_SCX) != 0)) + ptracestop(td, SIGTRAP); td->td_dbgflags &= ~(TDB_SCX | TDB_EXEC | TDB_FORK); PROC_UNLOCK(p); } |