Module Name: src Committed By: christos Date: Tue Oct 6 13:38:00 UTC 2020
Modified Files: src/sys/kern: kern_exec.c Log Message: Make MAXTSIZ optional. To generate a diff of this commit: cvs rdiff -u -r1.501 -r1.502 src/sys/kern/kern_exec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/kern_exec.c diff -u src/sys/kern/kern_exec.c:1.501 src/sys/kern/kern_exec.c:1.502 --- src/sys/kern/kern_exec.c:1.501 Sat May 23 19:42:43 2020 +++ src/sys/kern/kern_exec.c Tue Oct 6 09:38:00 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_exec.c,v 1.501 2020/05/23 23:42:43 ad Exp $ */ +/* $NetBSD: kern_exec.c,v 1.502 2020/10/06 13:38:00 christos Exp $ */ /*- * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.501 2020/05/23 23:42:43 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.502 2020/10/06 13:38:00 christos Exp $"); #include "opt_exec.h" #include "opt_execfmt.h" @@ -498,18 +498,25 @@ check_exec(struct lwp *l, struct exec_pa } /* check limits */ - if ((epp->ep_tsize > MAXTSIZ) || - (epp->ep_dsize > (u_quad_t)l->l_proc->p_rlimit - [RLIMIT_DATA].rlim_cur)) { +#ifdef MAXTSIZ + if (epp->ep_tsize > MAXTSIZ) { #ifdef DIAGNOSTIC - printf("%s: rejecting due to " - "limits (t=%llu > %llu || d=%llu > %llu)\n", - __func__, - (unsigned long long)epp->ep_tsize, - (unsigned long long)MAXTSIZ, - (unsigned long long)epp->ep_dsize, - (unsigned long long) - l->l_proc->p_rlimit[RLIMIT_DATA].rlim_cur); +#define LMSG "%s: rejecting due to %s limit (%ju > %ju)\n" + printf(LMSG, __func__, "text", + (uintmax_t)epp->ep_tsize, + (uintmax_t)MAXTSIZ); +#endif + error = ENOMEM; + break; + } +#endif + vsize_t dlimit = + (vsize_t)l->l_proc->p_rlimit[RLIMIT_DATA].rlim_cur; + if (epp->ep_dsize > dlimit) { +#ifdef DIAGNOSTIC + printf(LMSG, __func__, "data", + (uintmax_t)epp->ep_dsize, + (uintmax_t)dlimit); #endif error = ENOMEM; break;