Commit 150cb883 authored by Shawn Webb's avatar Shawn Webb
Browse files

HBSD: Fix randompid boot-time calculation

Years back, FreeBSD changed the logic behind the random PID calculation
in commit 008a0935

. Our logic needs to
fit that.
Signed-off-by: Shawn Webb's avatarShawn Webb <shawn.webb@hardenedbsd.org>
Reported-by: Loic's avatarLoic F <loic.f@hardenedbsd.org>
MFC-to:		13-STABLE
MFC-to:		12-STABLE
parent b12754f2
......@@ -176,7 +176,8 @@ pax_randomize_pids(void *dummy __unused)
modulus = pid_max - 200;
sx_xlock(&allproc_lock);
randompid = arc4random() % modulus + 100;
/* Steal the logic from FreeBSD's sysctl_kern_randompid */
randompid = 100 + (arc4random() % 1024);
sx_xunlock(&allproc_lock);
}
SYSINIT(pax_randomize_pids, SI_SUB_KTHREAD_INIT, SI_ORDER_MIDDLE+1,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment