Module Name: src Committed By: drochner Date: Sun Feb 21 13:17:51 UTC 2010
Modified Files: src/share/man/man4: options.4 src/share/man/man7: sysctl.7 src/sys/uvm: files.uvm uvm_map.c Log Message: rename the va0_disabled option and cpp conditional to "disable" as well, for consistency, and document option and sysctl flag To generate a diff of this commit: cvs rdiff -u -r1.382 -r1.383 src/share/man/man4/options.4 cvs rdiff -u -r1.30 -r1.31 src/share/man/man7/sysctl.7 cvs rdiff -u -r1.17 -r1.18 src/sys/uvm/files.uvm cvs rdiff -u -r1.289 -r1.290 src/sys/uvm/uvm_map.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/share/man/man4/options.4 diff -u src/share/man/man4/options.4:1.382 src/share/man/man4/options.4:1.383 --- src/share/man/man4/options.4:1.382 Sat Dec 5 20:11:02 2009 +++ src/share/man/man4/options.4 Sun Feb 21 13:17:51 2010 @@ -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 Index: src/share/man/man7/sysctl.7 diff -u src/share/man/man7/sysctl.7:1.30 src/share/man/man7/sysctl.7:1.31 --- src/share/man/man7/sysctl.7:1.30 Sat Jan 9 17:28:06 2010 +++ src/share/man/man7/sysctl.7 Sun Feb 21 13:17:51 2010 @@ -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 ) Index: src/sys/uvm/files.uvm diff -u src/sys/uvm/files.uvm:1.17 src/sys/uvm/files.uvm:1.18 --- src/sys/uvm/files.uvm:1.17 Thu Feb 18 14:57:01 2010 +++ src/sys/uvm/files.uvm Sun Feb 21 13:17:50 2010 @@ -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 Index: src/sys/uvm/uvm_map.c diff -u src/sys/uvm/uvm_map.c:1.289 src/sys/uvm/uvm_map.c:1.290 --- src/sys/uvm/uvm_map.c:1.289 Sat Feb 20 13:21:58 2010 +++ src/sys/uvm/uvm_map.c Sun Feb 21 13:17:50 2010 @@ -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