Skip to contentSkip to conversation

sysfs: change permissions for /sys from 0755 to 0555

PATCH In review Vitaly Kuznetsov 3 participants 5 messages Dec 14, 2011 – Jan 17, 2012 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sysfs: change permissions for /sys from 0755 to 0555

There is a misleading difference between /proc and /sys permissions, /proc is 0555 and /sys is 0755. But as it is impossible to create or unlink something in /sys it would be nice to have same permissions.

---
 fs/sysfs/mount.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/sysfs/mount.c +1 -1
index 4974995..9d56fdd 100644
@@ -36,7 +36,7 @@ struct sysfs_dirent sysfs_root = {
        .s_name         = "",
        .s_count        = ATOMIC_INIT(1),
        .s_flags        = SYSFS_DIR,
-       .s_mode         = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO,
+       .s_mode         = S_IFDIR | S_IRUGO | S_IXUGO,
        .s_ino          = 1,
 };
 
Signature · 1 line
1.7.7.4
#1 lore raw
Quoted 4 lines · Vitaly Kuznetsov

There is a misleading difference between /proc and /sys permissions, /proc is 0555 and /sys is 0755. But
as it is impossible to create or unlink something in /sys it would be nice to have same permissions.

Where does this difference matter? This doesn't look like something that could matter in practice. If this does matter in practice this change deserves a comment and a fuller explanation.

The change itself seems reasonable and probably worth making as general cleanup.

Eric

Quoted 17 lines
---
 fs/sysfs/mount.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/sysfs/mount.c +1 -1
index 4974995..9d56fdd 100644
@@ -36,7 +36,7 @@ struct sysfs_dirent sysfs_root = {
        .s_name         = "",
        .s_count        = ATOMIC_INIT(1),
        .s_flags        = SYSFS_DIR,
-       .s_mode         = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO,
+       .s_mode         = S_IFDIR | S_IRUGO | S_IXUGO,
        .s_ino          = 1,
 };
#2 lore raw
Quoted 10 lines · On Sun, 18 Dec 2011 18:32:18 -0800, [email protected] wrote:
Quoted 4 lines · Vitaly Kuznetsov

There is a misleading difference between /proc and /sys permissions, /proc is 0555 and /sys is 0755. But
as it is impossible to create or unlink something in /sys it would be nice to have same permissions.

Where does this difference matter? This doesn't look like something that could matter in practice. If this does matter in practice this change deserves a comment and a fuller explanation.

This matters only for programs which 'read' permissions instead of 'testing' them, but it's a challenge to imagine such program.

Quoted 4 lines

The change itself seems reasonable and probably worth making as general cleanup.

Let's consider it cleanup-only. The main idea is: /proc and /sys permissions must be the same as they are really the same.

#3 lore raw
In reply to Vitaly Kuznetsov
Quoted 15 lines · Vitaly Kuznetsov

There is a misleading difference between /proc and /sys permissions, /proc is 0555 and /sys is 0755. But
as it is impossible to create or unlink something in /sys it would be nice to have same permissions.

---
 fs/sysfs/mount.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/sysfs/mount.c +0 -0
index 4974995..9d56fdd 100644

fs/sysfs/mount.c struct sysfs_dirent sysfs_root = { · line 40

Quoted 6 lines
fs/sysfs/mount.c +1 -1
@@ -36,7 +36,7 @@ struct sysfs_dirent sysfs_root = {
        .s_name         = "",
        .s_count        = ATOMIC_INIT(1),
        .s_flags        = SYSFS_DIR,
-       .s_mode         = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO,
+       .s_mode         = S_IFDIR | S_IRUGO | S_IXUGO,
        .s_ino          = 1,

The tabs are all converted to spaces here, making this impossible to apply :(

#4 lore raw

PATCH 1/1 sysfs: change permissions for /sys from 0755 to 0555

There is a misleading difference between /proc and /sys permissions, /proc is 0555 and /sys is 0755. But as it is impossible to create or unlink something in /sys it would be nice to have same permissions.

---
 fs/sysfs/mount.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/sysfs/mount.c +1 -1
index 4974995..9d56fdd 100644
@@ -36,7 +36,7 @@ struct sysfs_dirent sysfs_root = {
 	.s_name		= "",
 	.s_count	= ATOMIC_INIT(1),
 	.s_flags	= SYSFS_DIR,
-	.s_mode		= S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO,
+	.s_mode		= S_IFDIR | S_IRUGO | S_IXUGO,
 	.s_ino		= 1,
 };
 
Signature · 1 line
1.7.3.2