|
|||||||||||
|
user/3322: vmstat, iostat, etc. fail on a diskless machine
From: <amh(at)POBOX.COM>
Date: Tue Jun 17 2003 - 21:53:14 EDT
System : OpenBSD 3.3 Architecture: OpenBSD.sparc Machine : SPARCstation LX (sun4m) >Description: I first noticed this problem while using a SPARCstation LX running diskless. I can provide configuration information for this setup if needed, but aside from the problem detailed here, everything seems to work fine, so I'm not sure that would be useful. It seems that vmstat, iostat, systat, and possibly other utilities do not deal gracefully with the case of a machine having no disks. They segfault immediately without any diagnostic information. (and systat b0rks your terminal as a bonus prize) I compiled vmstat with debugging information (cc -g) and performed a stack backtrace. I think the problem arises in dkinit() when the kernel is interrogated via sysctl to obtain the disk names. It seems that there's no error checking for the case when cur.dk_ndrive (hw.diskcount) is 0, and this value is used to size the memory allocations later on in dkinit(). calloc() gives us a protected zero size object for cur.dk_name, and at line 479, boom.
danube$ /usr/obj/usr.bin/vmstat/vmstat
Reading symbols from /usr/lib/libkvm.so.7.0...done. Reading symbols from /usr/lib/libc.so.29.0...done. Reading symbols from /usr/libexec/ld.so...done. #0 0x11db0 in dkinit (select=0) at /usr/src/usr.bin/vmstat/dkstats.c:479 479 cur.dk_name[i] = name;(gdb) bt #0 0x11db0 in dkinit (select=0) at /usr/src/usr.bin/vmstat/dkstats.c:479 #1 0x122c3 in main (argc=1, argv=0xf7fff928)
at /usr/src/usr.bin/vmstat/vmstat.c:259
#2 0x10d27 in ___start ()
>How-To-Repeat:
>Release-Note:
This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:29:58 EDT |
||||||||||
|
|||||||||||