Skip to contentSkip to conversation

CPU online file permission

PATCH In review Ulrich Drepper 3 participants 3 messages Jul 30, 2007 – Jul 31, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CPU online file permission

Is there a reason why the "online" file in the subdirectories for the CPUs in /sys/devices/system isn't world-readable? I cannot imagine it to be security relevant especially now that a getcpu() syscall can be used to determine what CPUa thread runs on.

The file is useful to correctly implement the sysconf() function to return the number of online CPUs. In the presence of hotplug we currently cannot provide this information. The patch below should to it.

base/cpu.c-new renamed from base/cpu.c +1 -1
@@ -53,7 +53,7 @@
 		ret = count;
 	return ret;
 }
-static SYSDEV_ATTR(online, 0600, show_online, store_online);
+static SYSDEV_ATTR(online, 0644, show_online, store_online);
 
 static void __devinit register_cpu_control(struct cpu *cpu)
 {
#1 lore raw
Quoted 2 lines · On Sun, 29 Jul 2007 20:56:46 -0400 Ulrich Drepper <[email protected]> wrote:

Is there a reason why the "online" file in the subdirectories for the CPUs in /sys/devices/system isn't world-readable?

No sane one which I can think of. It seems that it originally sprang forth from Rusty's keyboard in that form.

Quoted 14 lines

I cannot imagine it to be
security relevant especially now that a getcpu() syscall can be used to determine what CPUa thread runs on.

The file is useful to correctly implement the sysconf() function to return the number of online CPUs. In the presence of hotplug we currently cannot provide this information. The patch below should to it.

base/cpu.c-new line 59

Quoted 8 lines
base/cpu.c-new renamed from base/cpu.c +1 -1
@@ -53,7 +53,7 @@
 		ret = count;
 	return ret;
 }
-static SYSDEV_ATTR(online, 0600, show_online, store_online);
+static SYSDEV_ATTR(online, 0644, show_online, store_online);
 
 static void __devinit register_cpu_control(struct cpu *cpu)
 {

I'll pass this by the -stable guys too - I assume we'd like it fixed in 2.6.22 (or earlier) as well..

#2 lore raw
Quoted 8 lines · Andrew Morton
Quoted 2 lines · On Sun, 29 Jul 2007 20:56:46 -0400 Ulrich Drepper <[email protected]> wrote:

Is there a reason why the "online" file in the subdirectories for the CPUs in /sys/devices/system isn't world-readable?

No sane one which I can think of. It seems that it originally sprang forth from Rusty's keyboard in that form.

Hmm, that seems possible but unlikely. My original version used proc, after all.

But either way, fix is good.

Rusty.