Author: oshogbo
Date: Thu Jun  9 20:23:30 2016
New Revision: 301757
URL: https://svnweb.freebsd.org/changeset/base/301757

Log:
  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

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c    Thu Jun  9 20:05:19 2016        (r301756)
+++ head/sys/kern/kern_sig.c    Thu Jun  9 20:23:30 2016        (r301757)
@@ -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");
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to