Fri Aug 26 09:13:08 2011 UTC ()
Change aprint_verbose() to a normal printf() surrounded by #ifdef DIAGNOSTIC


(reinoud)
diff -r1.321 -r1.322 src/sys/kern/kern_exec.c

cvs diff -r1.321 -r1.322 src/sys/kern/kern_exec.c (expand / switch to unified diff)

--- src/sys/kern/kern_exec.c 2011/08/26 09:07:48 1.321
+++ src/sys/kern/kern_exec.c 2011/08/26 09:13:08 1.322
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: kern_exec.c,v 1.321 2011/08/26 09:07:48 reinoud Exp $ */ 1/* $NetBSD: kern_exec.c,v 1.322 2011/08/26 09:13:08 reinoud Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -49,27 +49,27 @@ @@ -49,27 +49,27 @@
49 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 49 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
50 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 50 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
51 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 51 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
52 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 52 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
53 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 53 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
54 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 54 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
55 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 55 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
56 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 56 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
57 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 57 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
58 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 58 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
59 */ 59 */
60 60
61#include <sys/cdefs.h> 61#include <sys/cdefs.h>
62__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.321 2011/08/26 09:07:48 reinoud Exp $"); 62__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.322 2011/08/26 09:13:08 reinoud Exp $");
63 63
64#include "opt_ktrace.h" 64#include "opt_ktrace.h"
65#include "opt_modular.h" 65#include "opt_modular.h"
66#include "opt_syscall_debug.h" 66#include "opt_syscall_debug.h"
67#include "veriexec.h" 67#include "veriexec.h"
68#include "opt_pax.h" 68#include "opt_pax.h"
69#include "opt_sa.h" 69#include "opt_sa.h"
70 70
71#include <sys/param.h> 71#include <sys/param.h>
72#include <sys/systm.h> 72#include <sys/systm.h>
73#include <sys/filedesc.h> 73#include <sys/filedesc.h>
74#include <sys/kernel.h> 74#include <sys/kernel.h>
75#include <sys/proc.h> 75#include <sys/proc.h>
@@ -362,47 +362,53 @@ check_exec(struct lwp *l, struct exec_pa @@ -362,47 +362,53 @@ check_exec(struct lwp *l, struct exec_pa
362 * set up the vmcmds for creation of the process 362 * set up the vmcmds for creation of the process
363 * address space 363 * address space
364 */ 364 */
365 error = ENOEXEC; 365 error = ENOEXEC;
366 for (i = 0; i < nexecs; i++) { 366 for (i = 0; i < nexecs; i++) {
367 int newerror; 367 int newerror;
368 368
369 epp->ep_esch = execsw[i]; 369 epp->ep_esch = execsw[i];
370 newerror = (*execsw[i]->es_makecmds)(l, epp); 370 newerror = (*execsw[i]->es_makecmds)(l, epp);
371 371
372 if (!newerror) { 372 if (!newerror) {
373 /* Seems ok: check that entry point is not too high */ 373 /* Seems ok: check that entry point is not too high */
374 if (epp->ep_entry > VM_MAXUSER_ADDRESS) { 374 if (epp->ep_entry > VM_MAXUSER_ADDRESS) {
375 aprint_verbose("check_exec: rejecting due to " 375#ifdef DIAGNOSTIC
 376 printf("check_exec: rejecting due to "
376 "too high entry address\n"); 377 "too high entry address\n");
 378#endif
377 error = ENOEXEC; 379 error = ENOEXEC;
378 break; 380 break;
379 } 381 }
380#ifdef VM_CHECK_MIN_ADDRESS 382#ifdef VM_CHECK_MIN_ADDRESS
381 /* Seems ok: check that entry point is not too low */ 383 /* Seems ok: check that entry point is not too low */
382 if (epp->ep_entry < VM_MIN_ADDRESS) { 384 if (epp->ep_entry < VM_MIN_ADDRESS) {
383 aprint_verbose("check_exec: rejecting due to " 385#ifdef DIAGNOSTIC
 386 printf("check_exec: rejecting due to "
384 "too low entry address\n"); 387 "too low entry address\n");
 388#endif
385 error = ENOEXEC; 389 error = ENOEXEC;
386 break; 390 break;
387 } 391 }
388#endif 392#endif
389 393
390 /* check limits */ 394 /* check limits */
391 if ((epp->ep_tsize > MAXTSIZ) || 395 if ((epp->ep_tsize > MAXTSIZ) ||
392 (epp->ep_dsize > (u_quad_t)l->l_proc->p_rlimit 396 (epp->ep_dsize > (u_quad_t)l->l_proc->p_rlimit
393 [RLIMIT_DATA].rlim_cur)) { 397 [RLIMIT_DATA].rlim_cur)) {
394 aprint_verbose("check_exec: rejecting due to " 398#ifdef DIAGNOSTIC
 399 printf("check_exec: rejecting due to "
395 "limits\n"); 400 "limits\n");
 401#endif
396 error = ENOMEM; 402 error = ENOMEM;
397 break; 403 break;
398 } 404 }
399 return 0; 405 return 0;
400 } 406 }
401 407
402 if (epp->ep_emul_root != NULL) { 408 if (epp->ep_emul_root != NULL) {
403 vrele(epp->ep_emul_root); 409 vrele(epp->ep_emul_root);
404 epp->ep_emul_root = NULL; 410 epp->ep_emul_root = NULL;
405 } 411 }
406 if (epp->ep_interp != NULL) { 412 if (epp->ep_interp != NULL) {
407 vrele(epp->ep_interp); 413 vrele(epp->ep_interp);
408 epp->ep_interp = NULL; 414 epp->ep_interp = NULL;