To see if I could find the reason for the segfault, I tested cpqarrayd
on one of our 385-machines with valgrind.  As you can see, there are
problems with it.  The malloc() in cciss_interrogate_controller() seem
to be one byte short.  Could this be the source of the segfault?
Also, note that -d do not disable the forking into the background as
claimed by the usage help text.  This is annoying and should be fixed.

hp385# valgrind cpqarrayd -d
==22268== Memcheck, a memory error detector.
==22268== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==22268== Using LibVEX rev 1575, a library for dynamic binary translation.
==22268== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==22268== Using valgrind-3.1.1, a dynamic binary instrumentation framework.
==22268== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==22268== For more details, rerun with: -v
==22268==
Checking for controllers..
DEBUG: Device /dev/ida/c0d0 could not be opened
DEBUG: reason: No such file or directory
DEBUG: Device /dev/ida/c1d0 could not be opened
DEBUG: reason: No such file or directory
DEBUG: Device /dev/ida/c2d0 could not be opened
DEBUG: reason: No such file or directory
DEBUG: Device /dev/ida/c3d0 could not be opened
DEBUG: reason: No such file or directory
DEBUG: Device /dev/ida/c4d0 could not be opened
DEBUG: reason: No such file or directory
DEBUG: Device /dev/ida/c5d0 could not be opened
DEBUG: reason: No such file or directory
DEBUG: Device /dev/ida/c6d0 could not be opened
DEBUG: reason: No such file or directory
DEBUG: Device /dev/ida/c7d0 could not be opened
DEBUG: reason: No such file or directory
==22268== Syscall param ioctl(generic) points to uninitialised byte(s)
==22268==    at 0x304FDBFC19: ioctl (in /lib64/tls/libc-2.3.4.so)
==22268==    by 0x402EDB: cciss_get_logical_luns (cciss_functions.c:106)
==22268==    by 0x40219E: cciss_interrogate_controller (discover.c:282)
==22268==    by 0x401950: discover_controllers (discover.c:98)
==22268==    by 0x401332: main (cpqarrayd.c:164)
==22268==  Address 0x7FF0005F8 is on thread 1's stack
==22268==
==22268== Invalid write of size 1
==22268==    at 0x490656F: strcpy (mac_replace_strmem.c:269)
==22268==    by 0x402287: cciss_interrogate_controller (discover.c:300)
==22268==    by 0x401950: discover_controllers (discover.c:98)
==22268==    by 0x401332: main (cpqarrayd.c:164)
==22268==  Address 0x4A1A137 is 0 bytes after a block of size 15 alloc'd
==22268==    at 0x4904A06: malloc (vg_replace_malloc.c:149)
==22268==    by 0x402260: cciss_interrogate_controller (discover.c:299)
==22268==    by 0x401950: discover_controllers (discover.c:98)
==22268==    by 0x401332: main (cpqarrayd.c:164)
==22268==
==22268== Syscall param ioctl(generic) points to uninitialised byte(s)
==22268==    at 0x304FDBFC19: ioctl (in /lib64/tls/libc-2.3.4.so)
==22268==    by 0x40307D: cciss_get_event (cciss_functions.c:165)
==22268==    by 0x4022D6: cciss_interrogate_controller (discover.c:308)
==22268==    by 0x401950: discover_controllers (discover.c:98)
==22268==    by 0x401332: main (cpqarrayd.c:164)
==22268==  Address 0x7FF0005F9 is on thread 1's stack
DEBUG: Discarding old event 5/0/0
==22268==
==22268== Syscall param ioctl(generic) points to uninitialised byte(s)
==22268==    at 0x304FDBFC19: ioctl (in /lib64/tls/libc-2.3.4.so)
==22268==    by 0x40307D: cciss_get_event (cciss_functions.c:165)
==22268==    by 0x40230C: cciss_interrogate_controller (discover.c:312)
==22268==    by 0x401950: discover_controllers (discover.c:98)
==22268==    by 0x401332: main (cpqarrayd.c:164)
==22268==  Address 0x7FF0005F9 is on thread 1's stack
DEBUG: Discarding old event 5/2/0
DEBUG: Discarding old event 5/0/0
DEBUG: Discarding old event 5/2/0
DEBUG: /dev/cciss/c0d0 is a existing controller
DEBUG: Device /dev/cciss/c1d0 could not be opened
DEBUG: reason: No such file or directory
DEBUG: Device /dev/cciss/c2d0 could not be opened
DEBUG: reason: No such file or directory
DEBUG: Device /dev/cciss/c3d0 could not be opened
DEBUG: reason: No such file or directory
DEBUG: Device /dev/cciss/c4d0 could not be opened
DEBUG: reason: No such file or directory
DEBUG: Device /dev/cciss/c5d0 could not be opened
DEBUG: reason: No such file or directory
DEBUG: Device /dev/cciss/c6d0 could not be opened
DEBUG: reason: No such file or directory
DEBUG: Device /dev/cciss/c7d0 could not be opened
DEBUG: reason: No such file or directory
Done
Monitoring list
==22268==
==22268== Invalid read of size 1
==22268==    at 0x4906503: strlen (mac_replace_strmem.c:243)
==22268==    by 0x304FD42DC8: vfprintf (in /lib64/tls/libc-2.3.4.so)
==22268==    by 0x304FD48617: printf (in /lib64/tls/libc-2.3.4.so)
==22268==    by 0x401771: main (cpqarrayd.c:176)
==22268==  Address 0x4A1A137 is 0 bytes after a block of size 15 alloc'd
==22268==    at 0x4904A06: malloc (vg_replace_malloc.c:149)
==22268==    by 0x402260: cciss_interrogate_controller (discover.c:299)
==22268==    by 0x401950: discover_controllers (discover.c:98)
==22268==    by 0x401332: main (cpqarrayd.c:164)
 [ 0] Controller type 'CCISS Controller' at /dev/cciss/c0d0
==22268== Warning: ignored attempt to set SIGKILL handler in sigaction();
==22268==          the SIGKILL signal is uncatchable
Pid is 22314
==22268==
==22268== ERROR SUMMARY: 8 errors from 5 contexts (suppressed: 4 from 1)
==22268== malloc/free: in use at exit: 2,770 bytes in 9 blocks.
==22268== malloc/free: 68 allocs, 59 frees, 10,077 bytes allocated.
==22268== For counts of detected errors, rerun with: -v
==22268== searching for pointers to 9 not-freed blocks.
==22268== checked 63,160 bytes.
==22268==
==22268== LEAK SUMMARY:
==22268==    definitely lost: 2,738 bytes in 7 blocks.
==22268==      possibly lost: 0 bytes in 0 blocks.
==22268==    still reachable: 32 bytes in 2 blocks.
==22268==         suppressed: 0 bytes in 0 blocks.
==22268== Use --leak-check=full to see details of leaked memory.
hp385# ==22314==
==22314== Syscall param open(filename) points to unaddressable byte(s)
==22314==    at 0x304FDB9C22: __open_nocancel (in /lib64/tls/libc-2.3.4.so)
==22314==    by 0x402A8F: cciss_status_check (status.c:206)
==22314==    by 0x4015EF: main (cpqarrayd.c:249)
==22314==  Address 0x4A1A137 is 0 bytes after a block of size 15 alloc'd
==22314==    at 0x4904A06: malloc (vg_replace_malloc.c:149)
==22314==    by 0x402260: cciss_interrogate_controller (discover.c:299)
==22314==    by 0x401950: discover_controllers (discover.c:98)
==22314==    by 0x401332: main (cpqarrayd.c:164)
==22314==
==22314== Syscall param ioctl(generic) points to uninitialised byte(s)
==22314==    at 0x304FDBFC19: ioctl (in /lib64/tls/libc-2.3.4.so)
==22314==    by 0x40307D: cciss_get_event (cciss_functions.c:165)
==22314==    by 0x402AAC: cciss_status_check (status.c:209)
==22314==    by 0x4015EF: main (cpqarrayd.c:249)
==22314==  Address 0x7FEFFFA59 is on thread 1's stack

hp385# kill 22314
hp385# ==22314==
==22314== ERROR SUMMARY: 14 errors from 7 contexts (suppressed: 4 from 1)
==22314== malloc/free: in use at exit: 10,450 bytes in 15 blocks.
==22314== malloc/free: 91 allocs, 76 frees, 38,010 bytes allocated.
==22314== For counts of detected errors, rerun with: -v
==22314== searching for pointers to 15 not-freed blocks.
==22314== checked 62,784 bytes.
==22314==
==22314== LEAK SUMMARY:
==22314==    definitely lost: 10,418 bytes in 13 blocks.
==22314==      possibly lost: 0 bytes in 0 blocks.
==22314==    still reachable: 32 bytes in 2 blocks.
==22314==         suppressed: 0 bytes in 0 blocks.
==22314== Use --leak-check=full to see details of leaked memory.

Happy hacking,
-- 
Petter Reinholdtsen



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to