Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Provide a better fix for the checks



details:   https://anonhg.NetBSD.org/src/rev/466e5941b2de
branches:  trunk
changeset: 768757:466e5941b2de
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Fri Aug 26 09:29:16 2011 +0000

description:
Provide a better fix for the checks

diffstat:

 sys/kern/kern_exec.c |  22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diffs (60 lines):

diff -r 160c54520fd9 -r 466e5941b2de sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c      Fri Aug 26 09:26:14 2011 +0000
+++ b/sys/kern/kern_exec.c      Fri Aug 26 09:29:16 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exec.c,v 1.322 2011/08/26 09:13:08 reinoud Exp $  */
+/*     $NetBSD: kern_exec.c,v 1.323 2011/08/26 09:29:16 reinoud Exp $  */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.322 2011/08/26 09:13:08 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.323 2011/08/26 09:29:16 reinoud Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_modular.h"
@@ -371,33 +371,31 @@
 
                if (!newerror) {
                        /* Seems ok: check that entry point is not too high */
-                       if (epp->ep_entry > VM_MAXUSER_ADDRESS) {
+                       if (epp->ep_entry > epp->ep_vm_maxaddr) {
 #ifdef DIAGNOSTIC
-                               printf("check_exec: rejecting due to "
-                                       "too high entry address\n");
+                               printf("%s: rejecting due to "
+                                       "too high entry address\n", __func__);
 #endif
                                error = ENOEXEC;
                                break;
                        }
-#ifdef VM_CHECK_MIN_ADDRESS
                        /* Seems ok: check that entry point is not too low */
-                       if (epp->ep_entry < VM_MIN_ADDRESS) {
+                       if (epp->ep_entry < epp->ep_vm_minaddr) {
 #ifdef DIAGNOSTIC
-                               printf("check_exec: rejecting due to "
-                                       "too low entry address\n");
+                               printf("%s: rejecting due to "
+                                       "too low entry address\n", __func__);
 #endif
                                error = ENOEXEC;
                                break;
                        }
-#endif
 
                        /* check limits */
                        if ((epp->ep_tsize > MAXTSIZ) ||
                            (epp->ep_dsize > (u_quad_t)l->l_proc->p_rlimit
                                                    [RLIMIT_DATA].rlim_cur)) {
 #ifdef DIAGNOSTIC
-                               printf("check_exec: rejecting due to "
-                                       "limits\n");
+                               printf("%s: rejecting due to "
+                                       "limits\n", __func__);
 #endif
                                error = ENOMEM;
                                break;



Home | Main Index | Thread Index | Old Index