summaryrefslogtreecommitdiff
path: root/sys/kern/init_sysctl.c
AgeCommit message (Collapse)Author
2020-09-20KNF (sort #includes and remove duplicate sys/cpu.h)skrll
2020-05-23Move proc_lock into the data segment. It was dynamically allocated becausead
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
2020-03-22Merge vfs_cache.c from the ad-namecache branch. With this the namecachead
index becomes per-directory (initially, a red-black tree). The remaining changes on the branch to namei()/getcwd() will be merged in the future.
2020-01-18Use 4K pages on ARM_MMU_EXTENDED platforms (all armv[67] except RPI) byskrll
creating a new pool l1ttpl for the userland L1 translation table which needs to be 8KB and 8KB aligned. Limit the pool to maxproc and add hooks to allow the sysctl changing of maxproc to adjust the pool. This comes at a 5% performance penalty for build.sh -j8 kernel on a Tegra TK1.
2020-01-02- Eliminate the global "boottime" variable, which was being accessedthorpej
without any synchronization against changes by e.g. clock_settime(). - Replace with new getbinboottime() / getnanoboottime() / getmicroboottime() functions (naming mirrors that of other time access functions in kern_tc.c). It returns the (maybe-converted) value of timebasebin, which also tracks our estimate of when the system was booted (i.e. the legacy "boottime" was redundant). XXX There needs to be a lockless synchronization mechanism for reading timebasebin, but this is a problem in kern_tc.c that pre-existed these "boottime" changes. At least now the problem is centralized in one location.
2019-01-15remove kern.panic_now -- crashme panic node replaces it.mrg
2018-12-05As discussed in tech-kern:christos
- make sysctl kern.expose_address tri-state: 0: no access 1: access to processes with open /dev/kmem 2: access to everyone defaults: 0: KASLR kernels 1: non-KASLR kernels - improve efficiency by calling get_expose_address() per sysctl, not per process. - don't expose addresses for linux procfs - welcome to 8.99.27, changes to fill_*proc ABI
2018-12-03Expose addresses depending on the KASLR setting (from mrg@). Restores thechristos
status quo of exposing kernel addresses if there is no KASLR.
2018-11-24Fix kernel pointer leaks in the kern.lwp sysctl.maxv
2018-10-05Provide a sysctl kern.expose_address to expose kernel addresses inchristos
sysctl structure returns for non-root. Defaults to off. Turning it on will restore sockstat/fstat and friends for regular users.
2018-09-16CTL_DEBUG_MAXID is only used to size a static array that the compilermrg
can do just fine itself. use the compiler and remove the define.
2018-09-03Rename min/max -> uimin/uimax for better honesty.riastradh
These functions are defined on unsigned int. The generic name min/max should not silently truncate to 32 bits on 64-bit systems. This is purely a name change -- no functional change intended. HOWEVER! Some subsystems have #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b)) even though our standard name for that is MIN/MAX. Although these may invite multiple evaluation bugs, these do _not_ cause integer truncation. To avoid `fixing' these cases, I first changed the name in libkern, and then compile-tested every file where min/max occurred in order to confirm that it failed -- and thus confirm that nothing shadowed min/max -- before changing it. I have left a handful of bootloaders that are too annoying to compile-test, and some dead code: cobalt ews4800mips hp300 hppa ia64 luna68k vax acorn32/if_ie.c (not included in any kernels) macppc/if_gm.c (superseded by gem(4)) It should be easy to fix the fallout once identified -- this way of doing things fails safe, and the goal here, after all, is to _avoid_ silent integer truncations, not introduce them. Maybe one day we can reintroduce min/max as type-generic things that never silently truncate. But we should avoid doing that for a while, so that existing code has a chance to be detected by the compiler for conversion to uimin/uimax without changing the semantics until we can properly audit it all. (Who knows, maybe in some cases integer truncation is actually intended!)
2018-08-22- Cleanup for dynamic sysctl:msaitoh
- Remove unused *_NAMES macros for sysctl. - Remove unused *_MAXID for sysctls. - Move CTL_MACHDEP sysctl definitions for m68k into m68k/include/cpu.h and use them on all m68k machines.
2018-02-04Add a proper defflag for GPROF, and include opt_gprof.h, otherwise we'remaxv
not gonna go very far.
2017-06-01remove checks for failure after memory allocation calls that cannot fail:chs
kmem_alloc() with KM_SLEEP kmem_zalloc() with KM_SLEEP percpu_alloc() pserialize_create() psref_class_create() all of these paths include an assertion that the allocation has not failed, so callers should not assert that again.
2016-12-14Remove the "target" argment from vfs_drainvnodes() as it ishannken
always equal to "desiredvnodes" and move its definition from sys/vnode.h to sys/vnode_impl.h. Extend vfs_drainvnodes() to also wait for deferred vrele to flush and replace the call to vrele_flush() with a call to vfs_drainvnodes().
2016-05-31Add a new kern.messages sysctl to allow kernel message verbosity to bepgoyette
altered after boot. Fixes PR kern/46539 using patch submitted by Nat Sloss.
2015-11-09Whether or not the semaphore code is loaded as a module or built-in, itspgoyette
sysctl data belongs with the module code. Move it from kern/init_sysctl.c to kern/uipc_sem.c While here, add a new sysctl variable kern.posix.semcnt (current count of semaphores) to complement the existing kern.posix.semmax (maximum number of semaphores).
2015-08-25Move a bunch of sysctl nodes from init_sysctl (kitchen sink sysctl file)pooka
to init_sysctl_base (only base kernel defs). Main motivation was to fix sysconf(_SC_NPROCESSORS) for Rumprun. As reported by neeraj on irc, it returned -1 before this fix, so we were doing imaginary computing.
2015-07-07Move hw.machine and hw.machine_arch sysctls to base so rump can use themjustin
This allows uname(3) and uname(1) to work on rump kernels.
2015-05-20group msgbuf sysctls with the msgbuf codepooka
(init_sysctl.c -> subr_log.c)
2015-05-13More preparation for modularizing the SYSVxxx options. Here wepgoyette
change the kern.ipc.sysvxxx sysctls into dynamic values, so each sub-component of SYSVxxx can declare its own availability.
2015-04-22move clock sysctls from init_sysctl.c to kern_clock.cpooka
2014-08-03BUILDINFO part 2: expose sysctl kern.buildinfoapb
2014-05-08Add a global vnode cache:hannken
- vcache_get() retrieves a referenced and initialised vnode / fs node pair. - vcache_remove() removes a vnode / fs node pair from the cache. On cache miss vcache_get() calls new vfs operation vfs_loadvnode() to initialise a vnode / fs node pair. This call is guaranteed exclusive, no other thread will try to load this vnode / fs node pair. Convert ufs/ext2fs, ufs/ffs and ufs/mfs to use this interface. Remove now unused ufs/ufs_ihash Discussed on tech-kern. Welcome to 6.99.41
2014-03-24- create cpu_{g,s}etmodel() and hide cpu_model from direct access.christos
2014-02-25Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist beforepooka
the sysctl link sets are processed, and remove redundancy. Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate lines of code.
2014-02-25Add kern.{ostype,osrelease,osrevision,version} kern.domainname,justin
kern.rawpartition sysctl support to rump kernel. Moved the sysctl support that is shared between rump and normal kernels to init_sysctl_base.c as rump cannot use init_sysctl.c in order to avoid code duplication. Agreed with pooka@.
2014-01-17Put cprng sysctls into subr_cprng.c. Also, make sysctl_prng staticpooka
in subr_cprng and get rid of SYSCTL_PRIVATE namespace leak macro. Fixes ping(8) when run against a standalone rump kernel due to appearance of the kern.urandom sysctl node (in case someone was wondering ...)
2013-09-14GC various arrays defined and used in kern_proc.cjoerg
2013-03-18calculate vnode cache size based on the resource it gets allocated frompara
this stops setting kern.maxvnodes to high so it exhausts available space in kmem http://mail-index.netbsd.org/tech-kern/2013/03/08/msg015095.html
2013-03-07Add a kern.configname sysctl object.matt
2013-02-21Move boottime50 and its associated sysctl into the compat module. Aspgoyette
noted on tech-kern. Should fix PR/47579. OK christos@ Will request pull-up to 6.0 in a few days.
2013-02-02Make the inclusion of <sys/cprng.h> a private matter for sysctl. No reasonmatt
to expose the rest of the kernel to it.
2012-10-27split device_t/softc for all remaining drivers.chs
replace "struct device *" with "device_t". use device_xname(), device_unit(), etc.
2012-10-08put all kern socket sysctls in the same placepooka
2012-10-03Add sanity check to sysctl_kern_maxvnodes.mlelstv
2012-06-02Add some pre-processor magic to verify that the type of the data itemdsl
passed to sysctl_createv() actually matches the declared type for the item itself. In the places where the caller specifies a function and a structure address (typically the 'softc') an explicit (void *) cast is now needed. Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c and setting AcpiGbl_EnableAmlDebugObject. (mostly passing the address of a uint64_t when typed as CTLTYPE_INT). I've test built quite a few kernels, but there may be some unfixed MD fallout. Most likely passing &char[] to char *. Also add CTLFLAG_UNSIGNED for unsiged decimals - not set yet.
2012-04-07remove bogus check.christos
2012-03-10P1003_1B_SEMAPHORE is no longer optional.joerg
2012-02-19Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!rmind
Approved by core@.
2011-12-17Separate /dev/random pseudodevice implemenation from kernel entropy pooltls
implementation. Rewrite pseudodevice code to use cprng_strong(9). The new pseudodevice is cloning, so each caller gets bits from a stream generated with its own key. Users of /dev/urandom get their generators keyed on a "best effort" basis -- the kernel will rekey generators whenever the entropy pool hits the high water mark -- while users of /dev/random get their generators rekeyed every time key-length bits are output. The underlying cprng_strong API can use AES-256 or AES-128, but we use AES-128 because of concerns about related-key attacks on AES-256. This improves performance (and reduces entropy pool depletion) significantly for users of /dev/urandom but does cause users of /dev/random to rekey twice as often. Also fixes various bugs (including some missing locking and a reseed-counter overflow in the CTR_DRBG code) found while testing this. For long reads, this generator is approximately 20 times as fast as the old generator (dd with bs=64K yields 53MB/sec on 2Ghz Core2 instead of 2.5MB/sec) and also uses a separate mutex per instance so concurrency is greatly improved. For reads of typical key sizes for modern cryptosystems (16-32 bytes) performance is about the same as the old code: a little better for 32 bytes, a little worse for 16 bytes.
2011-11-20An undocumented behavior of the sysctl kern.arandom node used to allowtls
sucking up to 8192 bytes out of the kernel arc4random() generator at a time. Supposedly some very old application code uses this to rekey other instances of RC4 in userspace (a truly great idea). Reduce the limit to 256 bytes -- and note that it will probably be reduced to sizeof(int) in the future, since this node is so documented.
2011-11-19First step of random number subsystem rework described intls
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes the following: An initial cleanup and minor reorganization of the entropy pool code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are fixed. Some effort is made to accumulate entropy more quickly at boot time. A generic interface, "rndsink", is added, for stream generators to request that they be re-keyed with good quality entropy from the pool as soon as it is available. The arc4random()/arc4randbytes() implementation in libkern is adjusted to use the rndsink interface for rekeying, which helps address the problem of low-quality keys at boot time. An implementation of the FIPS 140-2 statistical tests for random number generator quality is provided (libkern/rngtest.c). This is based on Greg Rose's implementation from Qualcomm. A new random stream generator, nist_ctr_drbg, is provided. It is based on an implementation of the NIST SP800-90 CTR_DRBG by Henric Jungheim. This generator users AES in a modified counter mode to generate a backtracking-resistant random stream. An abstraction layer, "cprng", is provided for in-kernel consumers of randomness. The arc4random/arc4randbytes API is deprecated for in-kernel use. It is replaced by "cprng_strong". The current cprng_fast implementation wraps the existing arc4random implementation. The current cprng_strong implementation wraps the new CTR_DRBG implementation. Both interfaces are rekeyed from the entropy pool automatically at intervals justifiable from best current cryptographic practice. In some quick tests, cprng_fast() is about the same speed as the old arc4randbytes(), and cprng_strong() is about 20% faster than rnd_extract_data(). Performance is expected to improve. The AES code in src/crypto/rijndael is no longer an optional kernel component, as it is required by cprng_strong, which is not an optional kernel component. The entropy pool output is subjected to the rngtest tests at startup time; if it fails, the system will reboot. There is approximately a 3/10000 chance of a false positive from these tests. Entropy pool _input_ from hardware random numbers is subjected to the rngtest tests at attach time, as well as the FIPS continuous-output test, to detect bad or stuck hardware RNGs; if any are detected, they are detached, but the system continues to run. A problem with rndctl(8) is fixed -- datastructures with pointers in arrays are no longer passed to userspace (this was not a security problem, but rather a major issue for compat32). A new kernel will require a new rndctl. The sysctl kern.arandom() and kern.urandom() nodes are hooked up to the new generators, but the /dev/*random pseudodevices are not, yet. Manual pages for the new kernel interfaces are forthcoming.
2011-08-30Add getlabelusesmbr(), as proposed inbouyer
http://mail-index.netbsd.org/tech-userlevel/2011/08/25/msg005404.html This is used by disk tools such as disklabel(8) to dynamically decide is the undelyling platform uses a disklabel-in-mbr-partition or not (instead of using a compile-time list of ports). getlabelusesmbr() reads the sysctl kern.labelusesmbr, takes its value from the machdep #define LABELUSESMBR. For evbmips, make LABELUSESMBR 1 if the platform uses pmon as bootloader, and 0 (the previous value) otherwise.
2011-07-23When KERN_SA is not defined, kern.no_sa_support is a constant (1). Sojym
add CTLFLAG_IMMEDIATE to flags. Make the macro block logically reversed so it looks more natural when reading. Reported by Peter Tworek on tech-kern@.
2011-05-24Add some needed __UNCONSTjoerg
2011-04-02vfs_drainvnodes: drop lwp argument, remove variable name in prototype.rmind
2011-02-05avoid code duplication.christos
2011-01-28migrate compat32 handling with previouspooka
pointed out by Lars Heidieker