NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/58935: posix_spawn fails with errno=-1 if process limit is exceeded



>Number:         58935
>Category:       kern
>Synopsis:       posix_spawn fails with errno=-1 if process limit is exceeded
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 26 15:20:00 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current, 10, 9, ...
>Organization:
The netbsd_spawn Proclimitation
>Environment:
>Description:
   2528 	/*
   2529 	 * Although process entries are dynamically created, we still keep
   2530 	 * a global limit on the maximum number we will create.
   2531 	 */
   2532 	if (__predict_false(tnprocs >= maxproc))
   2533 		error = -1;
   2534 	else
   2535 		error = kauth_authorize_process(l1->l_cred,
   2536 		    KAUTH_PROCESS_FORK, p1, KAUTH_ARG(tnprocs), NULL, NULL);

https://nxr.netbsd.org/xref/src/sys/kern/kern_exec.c?r=1.525#2528

I think this should be EPROCLIM -- or rather, SET_ERROR(EPROCLIM) -- instead.
>How-To-Repeat:
posix_spawn a lot, and/or code inspection
>Fix:
1. add an automatic test
2. s/error = -1/error = SET_ERROR(EPROCLIM)/



Home | Main Index | Thread Index | Old Index