On Thu, Oct 02, 2014 at 07:20:35PM +0100, Steve McIntyre wrote: >Package: procps >Version: 1:3.3.3-3 >Severity: important >Tags: upstream > >Hi, > >Trying to investigate the FTBFS at [1], I'm finding another bug first >:-(. The vmstat test suite tries to run "vmstat -p /dev/sda1", and >vmstat crashes: > >Program received signal SIGSEGV, Segmentation fault. >getdiskstat (disks=disks@entry=0x7ffffff500, >partitions=partitions@entry=0x7ffffff508) at sysinfo.c:942 >942 (*disks)[cDisk-1].partitions++; >(gdb) bt >#0 getdiskstat (disks=disks@entry=0x7ffffff500, >partitions=partitions@entry=0x7ffffff508) > at sysinfo.c:942 >#1 0x000000000040240c in diskpartition_format (partition_name=0x7ffffff908 >"sda1") at vmstat.c:405 >#2 main (argc=3, argv=<optimized out>) at vmstat.c:860 >(gdb) p *disks >$5 = (struct disk_stat *) 0x0 > >I've stepped through this in gdb and the code is buggy. AFAICS it's >expecting different input from /proc/diskstats and is crashing with >unexpected ordering there. On the build system, /proc/diskstats looks >like: > ># cat /proc/diskstats > 9 0 md0 0 0 0 0 0 0 0 0 0 0 0 > 8 0 sda 18297056 78938093 840697762 74514270 127752173 655690401 > 6479643026 2740776074 0 312739270 2816334634 > 8 1 sda1 1646598 209181 56626222 10343690 10299020 6458686 188052464 > 119665440 0 24274120 130083010 > 8 2 sda2 32994 200 53309 47550 0 0 0 0 0 47430 47480 > 8 3 sda3 6977899 37424337 355218328 17871070 2063040 55004745 > 458138000 2154955860 0 24541560 2173719580 > 8 4 sda4 9632954 41304340 428746735 46168210 115390113 594226970 > 5833452562 466154774 0 273914290 512422344 > 252 0 dm-0 315576 0 11411426 2406000 2704982 0 55857728 101308060 0 > 4488840 103714130 > 252 1 dm-1 233369 0 10877178 1700330 40757559 0 434129480 1221706298 0 > 8882130 1223411078 > 252 3 dm-3 23803 0 190424 64480 2 0 16 0 0 63860 64480 > 252 7 dm-7 10454 0 585488 44320 120350 0 2803000 18570130 0 117980 > 18614460 > 252 8 dm-8 11308 0 508480 43240 113046 0 2388264 19015070 0 106060 > 19058320 > 252 2 dm-2 27264 0 218106 187230 247568 0 1980544 38397790 0 110300 > 38585030 > 252 4 dm-4 21353 0 170818 137700 0 0 0 0 0 10700 137700 > 252 5 dm-5 5911 0 47288 49500 264769 0 2118152 29740840 0 97440 29790370 > >In the loop in getdiskstat(), I'm seeing that *disks is being >dereferenced in the partition-handling code before it has been >xrealloc'ed in the disk-handling code. As to *why* this code is being >triggered this way, I don't know, but it's clearly buggy behaviour to >crash here!
I can now see what's broken here - my chroot doesn't have /sys mounted, so the is_disk() check never works. This code should be more robust - if it depends on valid output from /sys to not crash, then it should make sure /sys is mounted... -- Steve McIntyre, Cambridge, UK. st...@einval.com "C++ ate my sanity" -- Jon Rabone -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org