Date: Tue, 14 May 2019 00:34:08 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r347556 - stable/12/sys/kern Message-ID: <201905140034.x4E0Y8u3040716@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Tue May 14 00:34:08 2019 New Revision: 347556 URL: https://svnweb.freebsd.org/changeset/base/347556 Log: MFC r347227: Simplify the test against maxproc in fork1(). Modified: stable/12/sys/kern/kern_fork.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_fork.c ============================================================================== --- stable/12/sys/kern/kern_fork.c Mon May 13 23:37:44 2019 (r347555) +++ stable/12/sys/kern/kern_fork.c Tue May 14 00:34:08 2019 (r347556) @@ -885,17 +885,20 @@ fork1(struct thread *td, struct fork_req *fr) * processes; don't let root exceed the limit. */ nprocs_new = atomic_fetchadd_int(&nprocs, 1) + 1; - if ((nprocs_new >= maxproc - 10 && priv_check_cred(td->td_ucred, - PRIV_MAXPROC, 0) != 0) || nprocs_new >= maxproc) { - error = EAGAIN; - sx_xlock(&allproc_lock); - if (ppsratecheck(&lastfail, &curfail, 1)) { - printf("maxproc limit exceeded by uid %u (pid %d); " - "see tuning(7) and login.conf(5)\n", - td->td_ucred->cr_ruid, p1->p_pid); + if (nprocs_new >= maxproc - 10) { + if (priv_check_cred(td->td_ucred, PRIV_MAXPROC, 0) != 0 || + nprocs_new >= maxproc) { + error = EAGAIN; + sx_xlock(&allproc_lock); + if (ppsratecheck(&lastfail, &curfail, 1)) { + printf("maxproc limit exceeded by uid %u " + "(pid %d); see tuning(7) and " + "login.conf(5)\n", + td->td_ucred->cr_ruid, p1->p_pid); + } + sx_xunlock(&allproc_lock); + goto fail2; } - sx_xunlock(&allproc_lock); - goto fail2; } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905140034.x4E0Y8u3040716>