diff options
author | oshogbo <oshogbo@FreeBSD.org> | 2016-06-09 20:23:30 +0000 |
---|---|---|
committer | oshogbo <oshogbo@FreeBSD.org> | 2016-06-09 20:23:30 +0000 |
commit | 57dc7171d01c809423dc85a3479546200b3b3cc8 (patch) | |
tree | 7e05e18827e83d3b8b60587ca2fdc64031d403e4 | |
parent | fbb0754872307460f78291028cf4338e7fe6ebf5 (diff) | |
download | FreeBSD-src-57dc7171d01c809423dc85a3479546200b3b3cc8.zip FreeBSD-src-57dc7171d01c809423dc85a3479546200b3b3cc8.tar.gz |
Define tunable instead of using CTLFLAG_RWTUN flag with kern.corefile.
The allproc_lock lock used in the sysctl_kern_corefile function is initialized
in the procinit function which is called after setting sysctl values at boot.
That means if we set kern.corefile at boot we will be trying to use
lock with is uninitialized and machine will crash.
If we define kern.corefile as tunable instead of using CTFLAG_RWTUN we will
not call the sysctl_kern_corefile function and we will not use an uninitialized
lock. When machine will boot then we will start using function depending on
the lock.
Reviewed by: pjd
-rw-r--r-- | sys/kern/kern_sig.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 75a1259..f8bb87e 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -3123,6 +3123,7 @@ static int compress_user_cores = 0; #define corefilename_lock allproc_lock static char corefilename[MAXPATHLEN] = {"%N.core"}; +TUNABLE_STR("kern.corefile", corefilename, sizeof(corefilename)); static int sysctl_kern_corefile(SYSCTL_HANDLER_ARGS) @@ -3136,7 +3137,7 @@ sysctl_kern_corefile(SYSCTL_HANDLER_ARGS) return (error); } -SYSCTL_PROC(_kern, OID_AUTO, corefile, CTLTYPE_STRING | CTLFLAG_RWTUN | +SYSCTL_PROC(_kern, OID_AUTO, corefile, CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, sysctl_kern_corefile, "A", "Process corefile name format string"); |