freebsd-nq/sys
Andriy Gapon 693593b6f0 sysctl-s in a module should be accessible only when the module is initialized
A sysctl can have a custom handler that may access data that is initialized
via SYSINIT(9) or via a module event handler (also invoked via SYSINIT).
Thus, it is not safe to allow access to the module's sysctl-s until
the initialization is performed.  Likewise, we should not allow access
to teh sysctl-s after the module is uninitialized.
The latter is easy to achieve by properly ordering linker_file_unregister_sysctls
and linker_file_sysuninit.
The former is not as easy for two reasons:
- the initialization may depend on tunables which get set when sysctl-s are
  registered, so we need to set the tunables before running sysinit-s
- the initialization may try to dynamically add more sysctl-s under statically
  defined sysctl nodes
So, this change splits the sysctl setup into two phases.  In the first phase
the sysctl-s are registered as before but they are disabled and hidden from
consumers.  In the second phase, done after sysinit-s, normal access to the
sysctl-s is enabled.

The change should affect only dynamic module loading and unloading after
the system boot-up.  Nothing changes for sysctl-s compiled into the kernel
and sysctl-s in preloaded modules.

Discussed with:	hselasky, ian, jhb
Reviewed by:	julian, kib
MFC after:	2 weeks
Sponsored by:	Panzura
Differential Revision: https://reviews.freebsd.org/D12545
2017-10-05 12:32:14 +00:00
..
amd64 Improve amd64_get_ldt(). 2017-10-05 12:29:34 +00:00
arm Allwinner H3 CCU: Fix build on ARM64 2017-10-02 19:17:09 +00:00
arm64 Add a memory barrier to ensure the atomic write is visible to the other 2017-10-02 14:22:35 +00:00
boot Allow Raspberry Pi platform and drivers to be configured with upstream DTBs. 2017-10-02 00:49:33 +00:00
bsm Commit the 64-bit inode project. 2017-05-23 09:29:05 +00:00
cam Fix iSCSI target panics on concurrent session teardown and display 2017-10-04 11:35:04 +00:00
cddl remove heuristic error detection from ddi_strto*() 2017-10-05 12:25:18 +00:00
compat Add get_random_{int,long} to the LinuxKPI. 2017-10-04 17:29:08 +00:00
conf To prepare for adding EFI runtime services support on arm64 move the 2017-10-01 19:52:47 +00:00
contrib Revert r324109. This commit broke a number of systems. 2017-09-30 20:28:50 +00:00
crypto aesni(4): CRYPTO_AES_NIST_GCM_16 mandates MAC 2017-10-04 21:15:45 +00:00
ddb Rename mkdumpheader() and group EKCD functions in kern_shutdown.c. 2017-08-18 04:04:09 +00:00
dev cxgbe(4): Provide knobs to set the holdoff parameters of TOE rx queues 2017-10-05 07:18:16 +00:00
fs Add a few definitions for the Flex File Layout. 2017-10-04 22:55:30 +00:00
gdb
geom Display rotation rate and TRIM/UNMAP support in diskinfo(8) 2017-10-04 15:09:49 +00:00
gnu Update DTS files from Linux 4.12 2017-07-09 13:53:32 +00:00
i386 A different fix for the issue from r323722. 2017-09-28 09:01:28 +00:00
isa Use better hard-coded defaults for the cursor shape, and remove nearby 2017-08-19 19:33:16 +00:00
kern sysctl-s in a module should be accessible only when the module is initialized 2017-10-05 12:32:14 +00:00
kgssapi
libkern Continuing efforts to provide hardening of FFS, this change adds a 2017-09-22 12:45:15 +00:00
mips bhnd: Add support for supplying bus I/O callbacks when initializing an EROM 2017-09-27 19:48:34 +00:00
modules To prepare for adding EFI runtime services support on arm64 move the 2017-10-01 19:52:47 +00:00
net Add PNP metadata to more drivers 2017-09-26 23:23:58 +00:00
net80211 net80211: fix a typo (premable -> preamble). 2017-08-27 22:13:03 +00:00
netgraph Correction after r323873: #include <sys/lock.h> in addition to <sys/rmlock.h> 2017-09-28 11:26:37 +00:00
netinet Forgotten bits in r324179: Include sys/syslog.h if INVARIANTS is not defined 2017-10-02 09:45:17 +00:00
netinet6 Hide struct socket and struct unpcb from the userland. 2017-10-02 23:29:56 +00:00
netipsec opencrypto: Loosen restriction on HMAC key sizes 2017-09-26 16:18:10 +00:00
netpfil Fix a bug which avoided that rules for matching port numbers for SCTP 2017-10-02 18:25:30 +00:00
netsmb netsmb: Fix buggy/racy smb_strdupin() 2017-09-29 15:53:26 +00:00
nfs Improve FHA locality control for NFS read/write requests. 2017-07-31 15:23:19 +00:00
nfsclient
nfsserver
nlm Commit the 64-bit inode project. 2017-05-23 09:29:05 +00:00
ofed Remove unsafe access to the LinuxKPI file structure from ibcore. 2017-09-09 06:34:20 +00:00
opencrypto opencrypto: Use C99 initializers for auth_hash instances 2017-09-26 17:52:52 +00:00
powerpc PPC: increase MAX_PICS to 32 2017-10-02 06:05:19 +00:00
riscv Sync with amd64/arm/arm64/i386/mips pmap change r288256: 2017-09-20 04:19:49 +00:00
rpc Listening sockets improvements. 2017-06-08 21:30:34 +00:00
security Sprinkle __read_frequently on few obvious places. 2017-09-06 20:33:33 +00:00
sparc64 Fix indentation for r323068 2017-09-19 20:40:05 +00:00
sys sysctl-s in a module should be accessible only when the module is initialized 2017-10-05 12:32:14 +00:00
teken Fix syscons escape sequence for setting the local cursor type. This sequence 2017-08-18 15:40:40 +00:00
tests style(9): sort headers 2017-05-09 05:08:47 +00:00
tools make.conf: Add the possibility to use another DTC 2017-06-17 23:34:53 +00:00
ufs Don't defer wakeup()s for completed journal workitems. 2017-09-26 23:24:15 +00:00
vm When an I/O error occurs on page out, there is no need to dirty the page, 2017-10-01 17:04:26 +00:00
x86 x86: Decode AMD "Extended Feature Extensions ID EBX" bits 2017-09-20 18:30:37 +00:00
xdr * limit size of buffers to RPC_MAXDATASIZE 2017-06-01 06:12:25 +00:00
xen
Makefile Remove glimpse make target added in r181432 2017-05-22 15:53:30 +00:00