Index: sys/kern/kern_proc.c =================================================================== --- sys/kern/kern_proc.c +++ sys/kern/kern_proc.c @@ -128,7 +128,7 @@ u_long pidhashlock; struct pgrphashhead *pgrphashtbl; u_long pgrphash; -struct proclist allproc; +struct proclist allproc = LIST_HEAD_INITIALIZER(allproc); struct sx __exclusive_cache_line allproc_lock; struct sx __exclusive_cache_line proctree_lock; struct mtx __exclusive_cache_line ppeers_lock; @@ -185,7 +185,6 @@ sx_init(&proctree_lock, "proctree"); mtx_init(&ppeers_lock, "p_peers", NULL, MTX_DEF); mtx_init(&procid_lock, "procid", NULL, MTX_DEF); - LIST_INIT(&allproc); pidhashtbl = hashinit(maxproc / 4, M_PROC, &pidhash); pidhashlock = (pidhash + 1) / 64; if (pidhashlock > 0) Index: sys/kern/subr_kdb.c =================================================================== --- sys/kern/subr_kdb.c +++ sys/kern/subr_kdb.c @@ -608,6 +608,10 @@ struct thread *thr; u_int i; + /* This function may be called early. */ + if (LIST_EMPTY(&allproc)) + return (&thread0); + for (i = 0; i <= pidhash; i++) { LIST_FOREACH(p, &pidhashtbl[i], p_hash) { thr = FIRST_THREAD_IN_PROC(p); @@ -647,6 +651,10 @@ struct proc *p; u_int hash; + /* This function may be called early. */ + if (LIST_EMPTY(&allproc)) + return (NULL); + p = thr->td_proc; thr = TAILQ_NEXT(thr, td_plist); if (thr != NULL)