Module Name:    src
Committed By:   kamil
Date:           Thu May  9 20:50:14 UTC 2019

Modified Files:
        src/sys/kern: kern_exec.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.464 -r1.465 src/sys/kern/kern_exec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.464 src/sys/kern/kern_exec.c:1.465
--- src/sys/kern/kern_exec.c:1.464	Fri May  3 22:34:21 2019
+++ src/sys/kern/kern_exec.c	Thu May  9 20:50:14 2019
@@ -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 @@ execve_runproc(struct lwp *l, struct exe
 
 	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);

Reply via email to