Source-Changes-HG archive

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

[src/trunk]: src rename the va0_disabled option and cpp conditional to "disab...



details:   https://anonhg.NetBSD.org/src/rev/ea365255814a
branches:  trunk
changeset: 752265:ea365255814a
user:      drochner <drochner%NetBSD.org@localhost>
date:      Sun Feb 21 13:17:50 2010 +0000

description:
rename the va0_disabled option and cpp conditional to "disable" as well,
for consistency, and document option and sysctl flag

diffstat:

 share/man/man4/options.4 |   7 ++++++-
 share/man/man7/sysctl.7  |   4 +++-
 sys/uvm/files.uvm        |   4 ++--
 sys/uvm/uvm_map.c        |  30 +++++++++++++++---------------
 4 files changed, 26 insertions(+), 19 deletions(-)

diffs (154 lines):

diff -r 3d80230df1dc -r ea365255814a share/man/man4/options.4
--- a/share/man/man4/options.4  Sun Feb 21 11:16:19 2010 +0000
+++ b/share/man/man4/options.4  Sun Feb 21 13:17:50 2010 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: options.4,v 1.382 2009/12/05 20:11:02 pooka Exp $
+.\"    $NetBSD: options.4,v 1.383 2010/02/21 13:17:51 drochner Exp $
 .\"
 .\" Copyright (c) 1996
 .\"    Perry E. Metzger.  All rights reserved.
@@ -2310,6 +2310,11 @@
 See
 .Xr security 8
 for more details.
+.It Cd options USER_VA0_DISABLE_DEFAULT=value
+Sets the initial value of the flag which controls whether user programs
+can map virtual address 0.
+The flag can be changed at runtime by
+.Xr sysctl 3 .
 .El
 .Ss amiga-specific Options
 .Bl -ohang
diff -r 3d80230df1dc -r ea365255814a share/man/man7/sysctl.7
--- a/share/man/man7/sysctl.7   Sun Feb 21 11:16:19 2010 +0000
+++ b/share/man/man7/sysctl.7   Sun Feb 21 13:17:50 2010 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: sysctl.7,v 1.30 2010/01/09 17:28:06 snj Exp $
+.\"    $NetBSD: sysctl.7,v 1.31 2010/02/21 13:17:51 drochner Exp $
 .\"
 .\" Copyright (c) 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -1953,6 +1953,8 @@
 Return system wide virtual memory statistics.
 The returned data consists of a
 .Va struct vmtotal .
+.It vm.user_va0_disable
+A flag which controls whether user processes can map virtual address 0.
 .It Li vm.uspace ( VM_USPACE )
 The number of bytes allocated for each kernel stack.
 .It Li vm.uvmexp ( VM_UVMEXP )
diff -r 3d80230df1dc -r ea365255814a sys/uvm/files.uvm
--- a/sys/uvm/files.uvm Sun Feb 21 11:16:19 2010 +0000
+++ b/sys/uvm/files.uvm Sun Feb 21 13:17:50 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.uvm,v 1.17 2010/02/18 14:57:01 drochner Exp $
+#      $NetBSD: files.uvm,v 1.18 2010/02/21 13:17:50 drochner Exp $
 
 #
 # UVM options
@@ -10,7 +10,7 @@
 defflag opt_ubc.h              UBC_STATS
 defparam opt_pagermap.h                PAGER_MAP_SIZE
 defflag                                PDPOLICY_CLOCKPRO
-defparam                       USER_VA0_DISABLED_DEFAULT
+defparam                       USER_VA0_DISABLE_DEFAULT
 
 file   uvm/uvm_amap.c
 file   uvm/uvm_anon.c
diff -r 3d80230df1dc -r ea365255814a sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Sun Feb 21 11:16:19 2010 +0000
+++ b/sys/uvm/uvm_map.c Sun Feb 21 13:17:50 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_map.c,v 1.289 2010/02/20 13:21:58 drochner Exp $   */
+/*     $NetBSD: uvm_map.c,v 1.290 2010/02/21 13:17:50 drochner Exp $   */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.289 2010/02/20 13:21:58 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.290 2010/02/21 13:17:50 drochner Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvmhist.h"
@@ -92,7 +92,7 @@
 #ifndef __USER_VA0_IS_SAFE
 #include <sys/sysctl.h>
 #include <sys/kauth.h>
-#include "opt_user_va0_disabled_default.h"
+#include "opt_user_va0_disable_default.h"
 #endif
 
 #ifdef SYSVSHM
@@ -174,14 +174,14 @@
 #endif
 
 #ifndef __USER_VA0_IS_SAFE
-#ifndef __USER_VA0_DISABLED_DEFAULT
-#define __USER_VA0_DISABLED_DEFAULT 1
+#ifndef __USER_VA0_DISABLE_DEFAULT
+#define __USER_VA0_DISABLE_DEFAULT 1
 #endif
-#ifdef USER_VA0_DISABLED_DEFAULT /* kernel config option overrides */
-#undef __USER_VA0_DISABLED_DEFAULT
-#define __USER_VA0_DISABLED_DEFAULT USER_VA0_DISABLED_DEFAULT
+#ifdef USER_VA0_DISABLE_DEFAULT /* kernel config option overrides */
+#undef __USER_VA0_DISABLE_DEFAULT
+#define __USER_VA0_DISABLE_DEFAULT USER_VA0_DISABLE_DEFAULT
 #endif
-static int user_va0_disabled = __USER_VA0_DISABLED_DEFAULT;
+static int user_va0_disable = __USER_VA0_DISABLE_DEFAULT;
 #endif
 
 /*
@@ -1192,7 +1192,7 @@
 
 #ifndef __USER_VA0_IS_SAFE
        if ((flags & UVM_FLAG_FIXED) && *startp == 0 &&
-           !VM_MAP_IS_KERNEL(map) && user_va0_disabled)
+           !VM_MAP_IS_KERNEL(map) && user_va0_disable)
                return EACCES;
 #endif
 
@@ -5240,26 +5240,26 @@
 
 #ifndef __USER_VA0_IS_SAFE
 static int
-sysctl_user_va0_disabled(SYSCTLFN_ARGS)
+sysctl_user_va0_disable(SYSCTLFN_ARGS)
 {
        struct sysctlnode node;
        int t, error;
 
        node = *rnode;
        node.sysctl_data = &t;
-       t = user_va0_disabled;
+       t = user_va0_disable;
        error = sysctl_lookup(SYSCTLFN_CALL(&node));
        if (error || newp == NULL)
                return (error);
 
        /* lower only at securelevel < 1 */
-       if (!t && user_va0_disabled &&
+       if (!t && user_va0_disable &&
            kauth_authorize_system(l->l_cred,
                                   KAUTH_SYSTEM_CHSYSFLAGS /* XXX */, 0,
                                   NULL, NULL, NULL))
                return EPERM;
 
-       user_va0_disabled = !!t;
+       user_va0_disable = !!t;
        return 0;
 }
 
@@ -5270,7 +5270,7 @@
                        CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
                        CTLTYPE_INT, "user_va0_disable",
                        SYSCTL_DESCR("Disable VA 0"),
-                       sysctl_user_va0_disabled, 0, &user_va0_disabled, 0,
+                       sysctl_user_va0_disable, 0, &user_va0_disable, 0,
                        CTL_VM, CTL_CREATE, CTL_EOL);
 }
 #endif



Home | Main Index | Thread Index | Old Index