Module Name: src Committed By: christos Date: Fri Sep 2 20:01:21 UTC 2011
Modified Files: src/sys/arch/x86/x86: syscall.c Log Message: If the process is traced, resulting from a PTRACE_FORK inherited setting, stop it right now. XXX[1]: Cannot make this MI, because I cannot wrap child_return because there is MD code that checks fun == child_return. I think it is better to have an mi child_return() and add a cpu_child_return()? XXX[2]: Why do we need to stop so early? Perhaps stopping just after exec is better? To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/x86/syscall.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/arch/x86/x86/syscall.c diff -u src/sys/arch/x86/x86/syscall.c:1.3 src/sys/arch/x86/x86/syscall.c:1.4 --- src/sys/arch/x86/x86/syscall.c:1.3 Fri Nov 20 22:11:02 2009 +++ src/sys/arch/x86/x86/syscall.c Fri Sep 2 16:01:20 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: syscall.c,v 1.3 2009/11/21 03:11:02 rmind Exp $ */ +/* $NetBSD: syscall.c,v 1.4 2011/09/02 20:01:20 christos Exp $ */ /*- * Copyright (c) 1998, 2000, 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.3 2009/11/21 03:11:02 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.4 2011/09/02 20:01:20 christos Exp $"); #include "opt_sa.h" @@ -67,6 +67,18 @@ { struct lwp *l = arg; struct trapframe *tf = l->l_md.md_regs; + struct proc *p = l->l_proc; + + if (p->p_slflag & PSL_TRACED) { + ksiginfo_t ksi; + + mutex_enter(proc_lock); + KSI_INIT_EMPTY(&ksi); + ksi.ksi_signo = SIGTRAP; + ksi.ksi_lid = l->l_lid; + kpsignal(p, &ksi, NULL); + mutex_exit(proc_lock); + } X86_TF_RAX(tf) = 0; X86_TF_RFLAGS(tf) &= ~PSL_C;