Module Name: src Committed By: kamil Date: Fri Jan 6 22:42:58 UTC 2017
Modified Files: src/sys/kern: kern_exec.c src/sys/sys: siginfo.h Log Message: Introduce new SIGTRAP code: TRAP_EXEC On exec() events under a debugger generate the SIGTRAP signal with TRAP_EXEC property. This allows tracer to distinguish exec() events easily. Sponsored by <The NetBSD Foundation> To generate a diff of this commit: cvs rdiff -u -r1.438 -r1.439 src/sys/kern/kern_exec.c cvs rdiff -u -r1.26 -r1.27 src/sys/sys/siginfo.h 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.438 src/sys/kern/kern_exec.c:1.439 --- src/sys/kern/kern_exec.c:1.438 Thu Nov 3 22:08:30 2016 +++ src/sys/kern/kern_exec.c Fri Jan 6 22:42:58 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_exec.c,v 1.438 2016/11/03 22:08:30 kamil Exp $ */ +/* $NetBSD: kern_exec.c,v 1.439 2017/01/06 22:42:58 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.438 2016/11/03 22:08:30 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.439 2017/01/06 22:42:58 kamil Exp $"); #include "opt_exec.h" #include "opt_execfmt.h" @@ -1318,6 +1318,7 @@ execve_runproc(struct lwp *l, struct exe KSI_INIT_EMPTY(&ksi); ksi.ksi_signo = SIGTRAP; + ksi.ksi_code = TRAP_EXEC; ksi.ksi_lid = l->l_lid; kpsignal(p, &ksi, NULL); } Index: src/sys/sys/siginfo.h diff -u src/sys/sys/siginfo.h:1.26 src/sys/sys/siginfo.h:1.27 --- src/sys/sys/siginfo.h:1.26 Tue Dec 27 02:20:46 2016 +++ src/sys/sys/siginfo.h Fri Jan 6 22:42:58 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: siginfo.h,v 1.26 2016/12/27 02:20:46 kamil Exp $ */ +/* $NetBSD: siginfo.h,v 1.27 2017/01/06 22:42:58 kamil Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -210,6 +210,7 @@ typedef union siginfo { /* SIGTRAP */ #define TRAP_BRKPT 1 /* Process breakpoint */ #define TRAP_TRACE 2 /* Process trace trap */ +#define TRAP_EXEC 3 /* Process exec trap */ /* SIGCHLD */ #define CLD_EXITED 1 /* Child has exited */