summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroshogbo <oshogbo@FreeBSD.org>2016-06-09 20:23:30 +0000
committeroshogbo <oshogbo@FreeBSD.org>2016-06-09 20:23:30 +0000
commit57dc7171d01c809423dc85a3479546200b3b3cc8 (patch)
tree7e05e18827e83d3b8b60587ca2fdc64031d403e4
parentfbb0754872307460f78291028cf4338e7fe6ebf5 (diff)
downloadFreeBSD-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.c3
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");
OpenPOWER on IntegriCloud