Bug 21603

Summary: hald crashed with SIGSEGV in hotplug_event_begin_add_blockdev when adding MD raid devices
Product: hal Reporter: Chris Coulson <chrisccoulson>
Component: haldAssignee: David Zeuthen (not reading bugmail) <zeuthen>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
URL: https://bugs.launchpad.net/ubuntu/+source/hal/+bug/361689
Whiteboard:
i915 platform: i915 features:
Attachments: Patch which fixes the issue (don't assume that the parent has storage.drive_type property)

Description Chris Coulson 2009-05-06 12:12:45 UTC
When assembling certain MD raid devices, hald crashes:

#0  0x0000000000435b05 in hotplug_event_begin_add_blockdev (sysfs_path=0x26c0130 "/sys/devices/virtual/block/md0/md0p1", device_file=<value optimized out>, is_partition=<value optimized out>, parent=0x260bca0, end_token=0x26c0020) at blockdev.c:1501
	sysfs_path_len = <value optimized out>
	is_physical_partition = <value optimized out>
	volume_label = 0x2681390 ""
	buf = "Volume\000\0009\001l\002\000\000\000\0001\n\000\000\000\000\000\000Ù\202\\\005Ê\177\000\000\000Þ\202\005Ê\177\000\000\037^Y\005Ê\177\000\000\000\206`\002\000\000\000\000 \000l\002\000\000\000"
	major_minor = <value optimized out>
	d = (HalDevice *) 0x267de80
	major = 259
	minor = 0
	is_fakevolume = 0
	sysfs_path_real = 0x2693670 "/sys/devices/virtual/block/md0/md0p1"
	floppy_num = <value optimized out>
	is_device_mapper = 0
	is_md_device = 1
	is_cciss_device = 0
	md_number = 0
	__func__ = "hotplug_event_begin_add_blockdev"
#1  0x0000000000425d72 in hotplug_event_begin_sysfs (hotplug_event=0x26c0020) at hotplug.c:220
	parent = (HalDevice *) 0x0
	range = 1
	is_partition = 1
	d = (HalDevice *) 0x0
	subsystem = "0Rë\rÿ\177\000\000S£D\000\000\000\000\0000\001l\002\000\000\000\0008\227Á\004Ê\177\000\000\001\200­û\000\000\000\0000\001l\002\000\000\000\0000\001l\002\000\000\000\0000\001l\002\000\000\000\0000\001l\002\000\000\000\000T\001l\002\000\000\000\000/\003l\002\000\000\000\0000\001l\002\000\000\000\000/\003l\002", '\0' <repeats 44 times>, " \000\000\000\004\000\000\000 \020\000\000\000\000\000\000\000\000è\004Ê\177\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000ªè\004Ê\177\000\0000\020", '\0' <repeats 14 times>, "\b\000\000\000\000\000\000\000pªè\004Ê\177\000\000ÿÿÿÿ\000\000\000\000Tl\\\005Ê\177"...
	subsystem_target = <value optimized out>
	__func__ = "hotplug_event_begin_sysfs"
#2  0x00000000004261c8 in hotplug_event_process_queue () at hotplug.c:295
	hotplug_event = (HotplugEvent *) 0x26c0020
	lp = (GList *) 0x2683da0
	lp2 = (GList *) 0x0
	processing = 1
	__func__ = "hotplug_event_process_queue"
#3  0x0000000000424f82 in hald_udev_data (source=<value optimized out>, condition=<value optimized out>, user_data=<value optimized out>) at osspec.c:259
	fd = <value optimized out>
	smsg = {msg_name = 0x0, msg_namelen = 0, msg_iov = 0x7fff0deb53d0, msg_iovlen = 1, msg_control = 0x7fff0deb63e0, msg_controllen = 32, msg_flags = 0}
	cmsg = <value optimized out>
	iov = {iov_base = 0x7fff0deb53e0, iov_len = 4096}
	cred = <value optimized out>
	cred_msg = "\034\000\000\000\000\000\000\000\001\000\000\000\002\000\000\000Í\034", '\0' <repeats 13 times>
	buf = "add@/devices/virtual/block/md0/md0p1\000UDEV_LOG=3\000ACTION=add\000DEVPATH=/devices/virtual/block/md0/md0p1\000SUBSYSTEM=block\000DEVTYPE=partition\000SEQNUM=1723\000MAJOR=259\000MINOR=0\000DEVLINKS=/dev/block/259:0\000DEVNAME=/d"...
	bufpos = 209
	action = 0x7fff0deb5417 "add"
	__func__ = "hald_udev_data"
#4  0x00007fca055a420a in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#5  0x00007fca055a78e0 in ?? () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#6  0x00007fca055a7dad in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#7  0x0000000000414005 in main (argc=233531616, argv=<value optimized out>) at hald.c:821
	loop = (GMainLoop *) 0x260b2c0
	path = <value optimized out>
	newpath = "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/lib/hal:/usr/lib/hal/scripts\000\000t\t²\004Ê\177\000\000.\000\000\000ÿ\177\000\0008õØ\003\000\000\000\000pgë\rÿ\177\000\000\030ië\rÿ\177\000\000h\v²\004Ê\177\000\000\000\000\000\000\000\000\000\000\220\233é\005Ê\177\000\000¸¤é\005Ê\177\000\000~E@\000\000\000\000\000\020Ò²\004Ê\177\000\000è\024@\000\000\000\000\000\000\000\000\000\001\000\000\000"...
	opt_child_timeout = 250
	p_error = (PolKitError *) 0x0
	__func__ = "main"
	long_options = {{name = 0x43e3e3 "exit-after-probing", has_arg = 0, flag = 0x0, val = 0}, {name = 0x43e466 "daemon", has_arg = 1, flag = 0x0, val = 0}, {name = 0x43e404 "verbose", has_arg = 1, flag = 0x0, val = 0}, {name = 0x43e40c "retain-privileges", has_arg = 0, flag = 0x0, val = 0}, {name = 0x43e3f6 "child-timeout", has_arg = 1, flag = 0x0, val = 0}, {name = 0x43e41e "use-syslog", has_arg = 0, flag = 0x0, val = 0}, {name = 0x43e3c1 "help", has_arg = 0, flag = 0x0, val = 0}, {name = 0x44c958 "version", has_arg = 0, flag = 0x0, val = 0}, {name = 0x0, has_arg = 0, flag = 0x0, val = 0}}

Here is the output of hald --verbose=yes --daemon=no when adding the device:

19:58:32.177 [I] osspec.c:251: SEQNUM=1883, ACTION=change, SUBSYSTEM=block, DEVPATH=/sys/devices/virtual/block/md0, DEVNAME=/dev/md0, IFINDEX=0
19:58:32.177 [I] hotplug.c:435: checking event /sys/devices/virtual/block/md0
19:58:32.177 [I] blockdev.c:903: block_add: sysfs_path=/sys/devices/virtual/block/md0 dev=/dev/md0 is_part=0, parent=0x00000000
19:58:32.177 [I] blockdev.c:915: Handling /dev/md0 as MD device
19:58:32.177 [I] blockdev.c:727: In refresh_md_state() for '/sys/devices/virtual/block/md0'
19:58:32.177 [I] blockdev.c:729:  MD Level is 'raid0'
19:58:32.177 [W] blockdev.c:735: Cannot get sync_action for /sys/devices/virtual/block/md0
19:58:32.177 [W] blockdev.c:1577: Not adding device object
19:58:32.177 [D] hotplug.c:453: events queued = 0, events in progress = 0
19:58:32.177 [D] hotplug.c:458: Hotplug-queue empty now ... no hotplug events in progress
19:58:32.201 [I] osspec.c:251: SEQNUM=1884, ACTION=add, SUBSYSTEM=block, DEVPATH=/sys/devices/virtual/block/md0/md0p1, DEVNAME=/dev/md0p1, IFINDEX=0
19:58:32.201 [I] hotplug.c:435: checking event /sys/devices/virtual/block/md0/md0p1
19:58:32.201 [I] blockdev.c:903: block_add: sysfs_path=/sys/devices/virtual/block/md0/md0p1 dev=/dev/md0p1 is_part=1, parent=0x00000000
19:58:32.201 [I] blockdev.c:915: Handling /dev/md0p1 as MD device
Segmentation fault
Comment 1 Chris Coulson 2009-05-06 12:15:07 UTC
Created attachment 25568 [details] [review]
Patch which fixes the issue (don't assume that the parent has storage.drive_type property)
Comment 2 Martin Pitt 2009-05-15 09:32:21 UTC
Thank you! Committed in b35bf1f

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.