Skip to contentSkip to conversation

scsi_id segfault with udev-009

DISCUSSION Applied Martin Schlemmer 4 participants 7 messages Dec 17, 2003 – Dec 18, 2003

lore
Share & tools
lore
#0 lore raw

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
#1 lore raw
Quoted 9 lines · Martin Schlemmer

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

Quoted 7 lines

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

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

#2 lore raw
In reply to Martin Schlemmer
Quoted 3 lines · Martin Schlemmer

Hi

Getting this with scsi_id and 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;
#3 lore raw
Quoted 16 lines · Daniel Stekloff
Quoted 3 lines · Martin Schlemmer

Hi

Getting this with scsi_id and 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.

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
#4 lore raw
Quoted 23 lines · Martin Schlemmer
Quoted 22 lines · Daniel Stekloff
Quoted 3 lines · Martin Schlemmer

Hi

Getting this with scsi_id and 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); }

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

#5 lore raw
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_id or the fix?

Nevermind :D

Signature · 1 line
Martin Schlemmer