Skip to contentSkip to conversation

clocksource: Fix permissions for available_clocksource

PATCH In review Heiko Carstens 3 participants 6 messages May 2, 2008 – May 3, 2008 Timekeeping, clocksource core, NTP, alarmtimer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clocksource: Fix permissions for available_clocksource

From: Heiko Carstens <[email protected]>

File permissions for /sys/devices/system/clocksource/clocksource0/available_clocksource are 600 which allows write access. But this is in fact a read only file. So change permissions to 400.

Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 kernel/time/clocksource.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/clocksource.c +1 -1
Index: linux-2.6/kernel/time/clocksource.c
===================================================================
@@ -474,7 +474,7 @@ sysfs_show_available_clocksources(struct
 static SYSDEV_ATTR(current_clocksource, 0600, sysfs_show_current_clocksources,
 		   sysfs_override_clocksource);
 
-static SYSDEV_ATTR(available_clocksource, 0600,
+static SYSDEV_ATTR(available_clocksource, 0400,
 		   sysfs_show_available_clocksources, NULL);
 
 static struct sysdev_class clocksource_sysclass = {
#1 lore raw
Quoted 6 lines · Heiko Carstens

From: Heiko Carstens <[email protected]>

File permissions for /sys/devices/system/clocksource/clocksource0/available_clocksource are 600 which allows write access. But this is in fact a read only file. So change permissions to 400.

Indeed. The question is whether we should make this 444. There is no harm, when users can read the info. Same applies for the current_clocksource entry, making it 644 should be fine.

Thanks,
tglx

Quoted 21 lines
Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 kernel/time/clocksource.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/kernel/time/clocksource.c
===================================================================

kernel/time/clocksource.c +1 -1
@@ -474,7 +474,7 @@ sysfs_show_available_clocksources(struct
 static SYSDEV_ATTR(current_clocksource, 0600, sysfs_show_current_clocksources,
 		   sysfs_override_clocksource);
 
-static SYSDEV_ATTR(available_clocksource, 0600,
+static SYSDEV_ATTR(available_clocksource, 0400,
 		   sysfs_show_available_clocksources, NULL);
 
 static struct sysdev_class clocksource_sysclass = {
#2 lore raw
Quoted 11 lines · Thomas Gleixner
Quoted 6 lines · Heiko Carstens

From: Heiko Carstens <[email protected]>

File permissions for /sys/devices/system/clocksource/clocksource0/available_clocksource are 600 which allows write access. But this is in fact a read only file. So change permissions to 400.

Indeed. The question is whether we should make this 444. There is no harm, when users can read the info. Same applies for the current_clocksource entry, making it 644 should be fine.

Sure, I can send an on-top patch for this.

Btw. did you recently try writing "jiffies" to current_clocksource? That seems to be a trick to stop the clock...

#3 lore raw
Quoted 9 lines · Heiko Carstens
Quoted 8 lines · Thomas Gleixner
Quoted 6 lines · Heiko Carstens

From: Heiko Carstens <[email protected]>

File permissions for /sys/devices/system/clocksource/clocksource0/available_clocksource are 600 which allows write access. But this is in fact a read only file. So change permissions to 400.

Quoted 5 lines
Quoted 3 lines

Indeed. The question is whether we should make this 444. There is no harm, when users can read the info. Same applies for the current_clocksource entry, making it 644 should be fine.

Sure, I can send an on-top patch for this.

Yes, please.

Quoted 2 lines

Btw. did you recently try writing "jiffies" to current_clocksource? That seems to be a trick to stop the clock...

Hmm, that's after the kernel switched to highres and/or nohz, right ? This came up earlier, but it got dropped from my to todo list. :( Will have a look.

Thanks,

tglx

#4 lore raw
Quoted 10 lines · Thomas Gleixner
Quoted 9 lines · Heiko Carstens
Quoted 8 lines · Thomas Gleixner
Quoted 6 lines · Heiko Carstens

From: Heiko Carstens <[email protected]>

File permissions for /sys/devices/system/clocksource/clocksource0/available_clocksource are 600 which allows write access. But this is in fact a read only file. So change permissions to 400.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Indeed. The question is whether we should make this 444. There is no harm, when users can read the info. Same applies for the current_clocksource entry, making it 644 should be fine.

Sure, I can send an on-top patch for this.

Yes, please.

---
 kernel/time/clocksource.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/time/clocksource.c +2 -2
Index: linux-2.6/kernel/time/clocksource.c
===================================================================
@@ -471,10 +471,10 @@ sysfs_show_available_clocksources(struct
 /*
  * Sysfs setup bits:
  */
-static SYSDEV_ATTR(current_clocksource, 0600, sysfs_show_current_clocksources,
+static SYSDEV_ATTR(current_clocksource, 0644, sysfs_show_current_clocksources,
 		   sysfs_override_clocksource);
 
-static SYSDEV_ATTR(available_clocksource, 0400,
+static SYSDEV_ATTR(available_clocksource, 0444,
 		   sysfs_show_available_clocksources, NULL);
 
 static struct sysdev_class clocksource_sysclass = {
Acked-by on v1 1/1
#5 lore raw
In reply to Heiko Carstens
Quoted 10 lines · Heiko Carstens

From: Heiko Carstens <[email protected]>

File permissions for /sys/devices/system/clocksource/clocksource0/available_clocksource are 600 which allows write access. But this is in fact a read only file. So change permissions to 400.

Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>

Ah, good catch.

Quoted 17 lines
---
 kernel/time/clocksource.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/kernel/time/clocksource.c
===================================================================

kernel/time/clocksource.c +1 -1
@@ -474,7 +474,7 @@ sysfs_show_available_clocksources(struct
 static SYSDEV_ATTR(current_clocksource, 0600, sysfs_show_current_clocksources,
 		   sysfs_override_clocksource);
 
-static SYSDEV_ATTR(available_clocksource, 0600,
+static SYSDEV_ATTR(available_clocksource, 0400,
 		   sysfs_show_available_clocksources, NULL);
 
 static struct sysdev_class clocksource_sysclass = {