diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 7a15e79b0402..e8ba4fecf55c 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1303,8 +1304,8 @@ falloc(td, resultfp, resultfd) fp = uma_zalloc(file_zone, M_WAITOK | M_ZERO); sx_xlock(&filelist_lock); - if ((nfiles >= maxuserfiles && td->td_ucred->cr_ruid != 0) - || nfiles >= maxfiles) { + if ((nfiles >= maxuserfiles && (td->td_ucred->cr_ruid != 0 || + jailed(td->td_ucred))) || nfiles >= maxfiles) { if (ppsratecheck(&lastfail, &curfail, 1)) { printf("kern.maxfiles limit exceeded by uid %i, please see tuning(7).\n", td->td_ucred->cr_ruid);