From owner-freebsd-hackers Tue Mar 2 7:27:39 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from excalibur.oceanis.net (ns.dotcom.fr [195.154.74.11]) by hub.freebsd.org (Postfix) with ESMTP id 88C2615447 for ; Tue, 2 Mar 1999 07:26:55 -0800 (PST) (envelope-from pixel@excalibur.oceanis.net) Received: (from pixel@localhost) by excalibur.oceanis.net (8.9.1/8.9.1) id PAA21720 for hackers@FreeBSD.ORG; Tue, 2 Mar 1999 15:26:33 GMT From: Emmanuel DELOGET Message-Id: <199903021526.PAA21720@excalibur.oceanis.net> Subject: bug in sysctl_sysctl_name To: hackers@FreeBSD.ORG (FreeBSD Hackers Mail List) Date: Tue, 2 Mar 1999 16:26:33 +0100 (MET) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, hackers [sorry to disturb you] ! Experiencing with sysctls on different FreeBSD (mostly 2.2.8 and 3.1), it appears that I found an interesting bug in the sysctl code. This is the program that shows this bug : The normal invocation for this test program is prg num1 num2 .... numN. It displays the value of the { num1, ... , numN } OID. Ex : ./sysctl_test 1 1 will print the string : FreeBSD Using this proggy with args 0 1 1 1 will gives kern.ostype But... (there's allways a 'but') a) ./sysctl_test 0 1 5 1 --> panic on 3.1-RELEASE (trap 12, supervisor read, page not present) b) ./sysctl_test 0 1 5 0 --> reboot (without even panicing) on my 2.2.8 The fact is that is't not very good to force a reboot when a syscall just failed :) looking at the code in 2.2.8 for the called function sysctl_sysctl_name, I can't figure what's happening. /**** file sysctl_test.c ****************** cut here */ #include #include #include #include void main(int ac,char **av) { int oidnum[128]; int nlen,result; char buffer[32768]; int buflen = 16384; /* so I'm sure... */ char c; if (ac < 2) { printf("usage : %s %s\n", av[0], "oidnum1 oidnum2 ... oidnumN"); exit(-1); } for (nlen=1;nlen