scsi_id segfault with udev-009
Hi
Getting this with scsi_id and udev-009:
--
Starting program:
/space/var/tmp/portage/udev-009/work/udev-009/extras/scsi_id/scsi_id -p 0x80 -s /block/sdb
Program received signal SIGSEGV, Segmentation fault. 0x080499c5 in sysfs_get_attr (dev=0x80d2d68, attr=0x80b559c "dev") at scsi_id.h:45
45 return
sysfs_get_value_from_attributes(dev->directory->attributes, (gdb) k
Kill the program being debugged? (y or n) y
(gdb) run -p 0x83 -s /block/sdb
Starting program:
/space/var/tmp/portage/udev-009/work/udev-009/extras/scsi_id/scsi_id -p 0x83 -s /block/sdb
Program received signal SIGSEGV, Segmentation fault. 0x080499c5 in sysfs_get_attr (dev=0x80d2d68, attr=0x80b559c "dev") at scsi_id.h:45
45 return
sysfs_get_value_from_attributes(dev->directory->attributes, (gdb) q
--
I cannot see why to be honest.
Thanks,
Signature · 3 lines
Martin Schlemmer Gentoo Linux Developer, Desktop/System Team Developer Cape Town, South Africa
Quoted 9 lines · Martin Schlemmer
Hi
Getting this with
scsi_idand udev-009:--
Starting program:
/space/var/tmp/portage/udev-009/work/udev-009/extras/scsi_id/scsi_id -p0x80-s /block/sdb
Quoted 7 lines
Program received signal SIGSEGV, Segmentation fault.
0x080499c5insysfs_get_attr(dev=0x80d2d68, attr=0x80b559c "dev") at scsi_id.h:45
45 return
sysfs_get_value_from_attributes(dev->directory->attributes, (gdb) k
Kill the program being debugged? (y or n) y
Yeah, I bet this is due to the libsysfs change that is now in udev. If I get a chance, I'll look into it. Unless Pat or Dan beats me to it...
thanks,
greg k-h
Quoted 3 lines · Martin Schlemmer
Hi
Getting this with
scsi_idand udev-009:
Hi,
Scsi_id hasn't been changed to use the latest libsysfs changes. The "directory" in the sysfs_class_device is now considered "private" and only should be accessed using functions. Treating the structures as handles lets us only load information when it's needed, reducing caching or stale information and also helping performance.
Here's the problem.
static inline char *sysfs_get_attr(struct sysfs_class_device *dev,
const char *attr)
{
return sysfs_get_value_from_attributes(dev->directory->attributes,
attr);
}Please try this quick fix:
extras/scsi_id/scsi_id.h +8 -2
@@ -42,8 +42,14 @@static inline char *sysfs_get_attr (struct sysfs_class_device *dev,const char *attr) { -return sysfs_get_value_from_attributes (dev->directory->attributes, - attr); +struct dlist *attributes =NULL ; + + attributes =sysfs_get_classdev_attributes (dev); + +if (attributes ==NULL ) +return NULL ; + +return sysfs_get_value_from_attributes (attributes, attr); } extern int scsi_get_serial (struct sysfs_class_device *scsi_dev,
extras/scsi_id/scsi_id.c +1 -1
@@ -133,7 +133,7 @@return -1 ;snprintf (bus_dev_name,MAX_NAME_LEN ,"%s/%s/%s/%s/%s" , sysfs_mnt_path, -SYSFS_BUS_DIR , bus,SYSFS_DEVICES_NAME , bus_id); +SYSFS_BUS_NAME , bus,SYSFS_DEVICES_NAME , bus_id);if (stat (sysfs_path, &stat_buf))return -1 ;
Quoted 16 lines · Daniel Stekloff
Quoted 3 lines · Martin Schlemmer
Hi
Getting this with
scsi_idand udev-009:Hi,
Scsi_idhasn't been changed to use the latest libsysfs changes. The "directory" in thesysfs_class_deviceis now considered "private" and only should be accessed using functions. Treating the structures as handles lets us only load information when it's needed, reducing caching or stale information and also helping performance.Here's the problem.
Quoted 9 lines
static inline char *sysfs_get_attr(struct
sysfs_class_device*dev,
const char *attr){ return sysfs_get_value_from_attributes(dev->directory->attributes, attr); }Please try this quick fix:
Yep, that fixes it, thanks. Btw, any reason it wont actually display anything ?
Thanks,
Signature · 3 lines
Martin Schlemmer Gentoo Linux Developer, Desktop/System Team Developer Cape Town, South Africa
Quoted 23 lines · Martin Schlemmer
Quoted 22 lines · Daniel Stekloff
Quoted 3 lines · Martin Schlemmer
Hi
Getting this with
scsi_idand udev-009:Hi,
Scsi_idhasn't been changed to use the latest libsysfs changes. The "directory" in thesysfs_class_deviceis now considered "private" and only should be accessed using functions. Treating the structures as handles lets us only load information when it's needed, reducing caching or stale information and also helping performance.Here's the problem.
static inline char *sysfs_get_attr(struct
sysfs_class_device*dev,
const char *attr)
{
returnsysfs_get_value_from_attributes(dev->directory->attributes, attr); }
Quoted 7 lines
Quoted 1 line
Please try this quick fix:
Yep, that fixes it, thanks. Btw, any reason it wont actually display anything ?
Thanks,
Sorry, what won't display anything? Do you mean scsi_id or the fix?
Thanks,
Dan
Quoted 9 lines · Daniel Stekloff
Quoted 5 lines
Yep, that fixes it, thanks. Btw, any reason it wont actually display anything ?
Thanks,
Sorry, what won't display anything? Do you mean
scsi_idor the fix?
Nevermind :D
Signature · 1 line
Martin Schlemmer
Greg KH
AppliedQuoted 2 lines · Daniel Stekloff
Please try this quick fix:
I've applied this, thanks.
greg k-h