Skip to contentSkip to conversation

sysfs mount point permissions in 2.5.64

DISCUSSION Douglas Gilbert 2 participants 3 messages Mar 5, 2003 – Mar 6, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

In lk 2.5.64 on my i386 box the sysfs mount point ( "/sys") changes permission from:
drwxr-xr-x
to
drw-r--r--
during the boot process. I didn't notice this feature in lk 2.5.63 . Chmodding the directory back to its former permissions get overridden by subsequent boot sequences.

This change in permissions inhibits non-root users from using utilities that scan sysfs for information (e.g. lsscsi).

Is this a feature or otherwise?

Doug Gilbert

#1 lore raw
Quoted 9 lines · Douglas Gilbert

In lk 2.5.64 on my i386 box the sysfs mount point ( "/sys") changes permission from:
drwxr-xr-x
to
drw-r--r--
during the boot process. I didn't notice this feature in lk 2.5.63 . Chmodding the directory back to its former permissions get overridden by subsequent boot sequences.

Quoted 4 lines

This change in permissions inhibits non-root users from using utilities that scan sysfs for information (e.g. lsscsi).

Is this a feature or otherwise?

This is certainly not intended, and is entirely my fault. The patch below should fix it.

-pat

===== fs/sysfs/mount.c 1.5 vs edited =====

fs/sysfs/mount.c +1 -1
@@ -33,7 +33,7 @@
 	sb->s_op = &sysfs_ops;
 	sysfs_sb = sb;
 
-	inode = sysfs_new_inode(S_IFDIR | S_IRUGO | S_IWUSR);
+	inode = sysfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO);
 	if (inode) {
 		inode->i_op = &simple_dir_inode_operations;
 		inode->i_fop = &simple_dir_operations;
#2 lore raw

Patrick,

Thanks. That patch fixed the problem I reported.

Doug Gilbert

Quoted 35 lines · Patrick Mochel
Quoted 9 lines · Douglas Gilbert

In lk 2.5.64 on my i386 box the sysfs mount point ( "/sys") changes permission from:
drwxr-xr-x
to
drw-r--r--
during the boot process. I didn't notice this feature in lk 2.5.63 . Chmodding the directory back to its former permissions get overridden by subsequent boot sequences.

Quoted 4 lines

This change in permissions inhibits non-root users from using utilities that scan sysfs for information (e.g. lsscsi).

Is this a feature or otherwise?

This is certainly not intended, and is entirely my fault. The patch below should fix it.

-pat

===== fs/sysfs/mount.c 1.5 vs edited =====

fs/sysfs/mount.c +1 -1
@@ -33,7 +33,7 @@
 	sb->s_op = &sysfs_ops;
 	sysfs_sb = sb;
 
-	inode = sysfs_new_inode(S_IFDIR | S_IRUGO | S_IWUSR);
+	inode = sysfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO);
 	if (inode) {
 		inode->i_op = &simple_dir_inode_operations;
 		inode->i_fop = &simple_dir_operations;