Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Report TRAP_EXEC (for exec()) to a debugger in the ...



details:   https://anonhg.NetBSD.org/src/rev/529dfd1464f2
branches:  trunk
changeset: 451204:529dfd1464f2
user:      kamil <kamil%NetBSD.org@localhost>
date:      Thu May 09 20:50:14 2019 +0000

description:
Report TRAP_EXEC (for exec()) to a debugger in the PT_SYSCALL mode

Orignally exec() reporting was disabled in the NetBSD version as there
was no support for fine-grained reporting. Meanwhile PT_SYSCALL was broken
for years and there is no software that depends on this behavior.

There is need to catch exec() events in syscall tracers using ptrace(2).
Instead of adding workarounds of guessing that exec() happened, report the
event directly from the kernel.

All ATF ptrace(2) tests pass.

diffstat:

 sys/kern/kern_exec.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 764be74b7e07 -r 529dfd1464f2 sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c      Thu May 09 18:53:14 2019 +0000
+++ b/sys/kern/kern_exec.c      Thu May 09 20:50:14 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exec.c,v 1.464 2019/05/03 22:34:21 kamil Exp $    */
+/*     $NetBSD: kern_exec.c,v 1.465 2019/05/09 20:50:14 kamil Exp $    */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.464 2019/05/03 22:34:21 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.465 2019/05/09 20:50:14 kamil Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -1269,7 +1269,7 @@
 
        mutex_enter(proc_lock);
 
-       if ((p->p_slflag & (PSL_TRACED|PSL_SYSCALL)) == PSL_TRACED) {
+       if (p->p_slflag & PSL_TRACED) {
                mutex_enter(p->p_lock);
                eventswitch(TRAP_EXEC);
                mutex_enter(proc_lock);



Home | Main Index | Thread Index | Old Index