kernel panic on HEAD from Oct. 4th sources

Nicolas Thery nthery at
Sun Oct 21 04:48:13 PDT 2007

2007/10/17, Matthew Dillon <dillon at>:
>     Yes, kinfo_proc can race against an exiting process.  An exiting process
>     will be in a partially deallocated state and p_pgrp could very well be
>     NULL as of the moment kinfo_proc tries to access it.

I'm trying to understand exactly how this race occurs and I've got a few
questions about preemption.  Could you confirm/infirm the following please?

1/ On a UP system, there can be at most one non-sleeping thread running
kernel-side and this thread can be preempted if and only if it explicitly
relinquishes the cpu, for example by calling tsleep().

2/ On a MP system, several threads can run kernel-side concurrently (one per
cpu) as long as the MP lock is not held.

3/ The MP lock is taken automatically when executing syscalls not tagged with
SYF_MPSAFE in sysent[].

4/ sysctl() kernel-side entry point is sys____sysctl() which is not MP safe.

5/ The race condition occurs if the call to vm_waitproc() in kern_wait() blocks
and another thread enters the kernel to handle a sysctl() call.

Thanks in advance,

More information about the Bugs mailing list