NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: PR/52117 CVS commit: src/tests/kernel
The following reply was made to PR kern/52117; it has been noted by GNATS.
From: "Kamil Rytarowski" <n54%gmx.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: PR/52117 CVS commit: src/tests/kernel
Date: Tue, 28 Mar 2017 15:57:57 +0200
> Sent: Tuesday, March 28, 2017 at 3:40 PM
> From: "Martin Husemann" <martin%duskware.de@localhost>
> To: kern-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost, n54%gmx.com@localhost
> Subject: Re: PR/52117 CVS commit: src/tests/kernel
>
> The following reply was made to PR kern/52117; it has been noted by GNATS.
>
> From: Martin Husemann <martin%duskware.de@localhost>
> To: gnats-bugs%NetBSD.org@localhost
> Cc:
> Subject: Re: PR/52117 CVS commit: src/tests/kernel
> Date: Tue, 28 Mar 2017 15:37:35 +0200
>
> On Tue, Mar 28, 2017 at 01:20:01PM +0000, Kamil Rytarowski wrote:
> > Add message similar to:
> > We expect two SIGTRAP events, for child 22199 (TRAP_CHLD,
> > pe_report_event=PTRACE_FORK, state.pe_other_pid=child2) and for child2
> > (TRAP_CHLD, pe_report_event=PTRACE_FORK, state.pe_other_pid=child)
>
> Where is the kernel code hiding that causes this for the forkee?
>
> I see the code for the process calling fork() at the end of
> kern_fork.c, but the "child2" process does not run that code, and I
> don't understand how it works on amd64. nxr does not find other kernel
> referencs for TRAP_CHLD (and this one works, the forker properly gets
> signaled).
>
> Martin
>
>
It's a bug in the kernel. It sits hardcoded in x86 specific code:
void
child_return(void *arg)
{
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;
userret(l);
ktrsysret(SYS_fork, 0, 0);
}
I've verified that this fires SIGTRAP for fork(2).
Home |
Main Index |
Thread Index |
Old Index