svn commit: r341723 - head/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Sat Dec 8 10:22:14 UTC 2018
Author: mjg
Date: Sat Dec 8 10:22:12 2018
New Revision: 341723
URL: https://svnweb.freebsd.org/changeset/base/341723
Log:
Fix a corner case in ID bitmap management.
If all IDs from trypid to pid_max were used as pids, the code would enter
a loop which would be infinite if none of the IDs could become free (e.g.
they all belong to processes which did not transitioned to zombie).
Fixes: r341684 ("Manage process-related IDs with bitmaps")
Sponsored by: The FreeBSD Foundation
Modified:
head/sys/kern/kern_fork.c
Modified: head/sys/kern/kern_fork.c
==============================================================================
--- head/sys/kern/kern_fork.c Sat Dec 8 06:34:12 2018 (r341722)
+++ head/sys/kern/kern_fork.c Sat Dec 8 10:22:12 2018 (r341723)
@@ -273,8 +273,10 @@ retry:
}
bit_ffc_at(&proc_id_pidmap, trypid, pid_max, &result);
- if (result == -1)
+ if (result == -1) {
+ trypid = 100;
goto retry;
+ }
if (bit_test(&proc_id_grpidmap, result) ||
bit_test(&proc_id_sessidmap, result) ||
bit_test(&proc_id_reapmap, result)) {
More information about the svn-src-all
mailing list