Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 May 1997 13:52:40 -0500 (CDT)
From:      randy@zyzzyva.com
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/3583: 'sysctl kern' dumps core when displaying clockrate
Message-ID:  <199705121852.NAA11137@sierra.zyzzyva.com>
Resent-Message-ID: <199705121900.MAA28162@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         3583
>Category:       kern
>Synopsis:       'syctl kern' dumps core when displaying clockrate
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 12 12:00:01 PDT 1997
>Last-Modified:
>Originator:     Randy Terbush
>Organization:
>Release:        FreeBSD 2.2-STABLE i386
>Environment:

	64MB RAM
	Pentium 133P5

	The following possibly relevent kernel parameter tweaks:

	maxusers        256
	options         NMBCLUSTERS=4096
	options         DFLDSIZ=33554432
	options         DFLSSIZ=1048576
	options         CHILD_MAX=1536
	options         OPEN_MAX=1536


>Description:

	sysctl kern works fine within the first few minutes after a reboot.
	Soon, it begins dumping core when attempting to print/retreive 
	kern.clockrate. I've reported this in the past, but I cannot find it 
	in the gnats DB. It is possible that it was mistakenly closed when I 
	thought it had been fixed since it works right after rebooting.

>How-To-Repeat:



>Fix:
	
	I'm not sure if this is the correct fix, or if perhaps the clockrate is
	being stored without \0 termination and is causing the memory requirement
	in show_var() to be unecessarily large.



Index: sysctl.c
===================================================================
RCS file: /usr/local/src/FreeBSD/FreeBSD-CVS/src/usr.sbin/sysctl/sysctl.c,v
retrieving revision 1.10
diff -c -r1.10 sysctl.c
*** sysctl.c	1996/04/10 00:53:22	1.10
--- sysctl.c	1997/05/11 16:47:39
***************
*** 341,349 ****
  
  	/* find an estimate of how much we need for this var */
  	j = 0;
! 	i = sysctl(oid, nlen, 0, &j, 0, 0);
! 	j += j; /* we want to be sure :-) */
! 
  	val = alloca(j);
  	len = j;
  	i = sysctl(oid, nlen, val, &len, 0, 0);
--- 341,347 ----
  
  	/* find an estimate of how much we need for this var */
  	j = 0;
! 	i = sysctl(oid, nlen, NULL, &j, 0, 0);
  	val = alloca(j);
  	len = j;
  	i = sysctl(oid, nlen, val, &len, 0, 0);

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705121852.NAA11137>