Skip to contentSkip to conversation

MIPS: Make CP0 config registers readable via sysfs.

PATCH In review Steven J. Hill 3 participants 6 messages Dec 13, 2012 – Jan 4, 2013 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 MIPS: Make CP0 config registers readable via sysfs.

From: "Steven J. Hill" <[email protected]>

Allow reading of CP0 config registers via sysfs for each core in the system. The registers will show up in sysfs at the path:

/sys/devices/system/cpu/cpuX/configX

Hotplugging of CPUs is also supported.

---
 arch/mips/kernel/Makefile |    1 +
 arch/mips/kernel/sysfs.c  |  118 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 119 insertions(+)
 create mode 100644 arch/mips/kernel/sysfs.c
arch/mips/kernel/Makefile +1 -0
index cc5eec6..0c3eb97 100644
@@ -97,6 +97,7 @@ obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o
 obj-$(CONFIG_HW_PERF_EVENTS)	+= perf_event_mipsxx.o
 
 obj-$(CONFIG_JUMP_LABEL)	+= jump_label.o
+obj-y				+= sysfs.o
 
 ifeq ($(CONFIG_CPU_MIPS32), y)
 #
arch/mips/kernel/sysfs.c new file +118 -0

118 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 4 lines · Steven J. Hill

Allow reading of CP0 config registers via sysfs for each core in the system. The registers will show up in sysfs at the path:

/sys/devices/system/cpu/cpuX/configX

You're exporting privileged context outside the kernel -- have all the
security implications been considered? At the very least I don't think these files should be word-readable.

Maciej

#2 lore raw
Quoted 9 lines · Maciej W. Rozycki
Quoted 4 lines · Steven J. Hill

Allow reading of CP0 config registers via sysfs for each core in the system. The registers will show up in sysfs at the path:

/sys/devices/system/cpu/cpuX/configX

You're exporting privileged context outside the kernel -- have all the
security implications been considered?

Can you give an example of what would be risky?

Quoted 3 lines

At the very least I don't think
these files should be word-readable.

According to Steven's earlier comments, all he really cares about are the ASEs implemented.

We have a patch (that I will send soon) that exports the Cache configurations via the same method that x86 Cache information is reported, so that part of the config register information would be reported separately.

The rest of the CP0_ConfigX bits really report things that are only useful to privileged mode software, so perhaps they shouldn't be reported.

David Daney

#3 lore raw
Quoted 3 lines

You're exporting privileged context outside the kernel -- have all the security implications been considered?

Maciej,

I have gone through the config registers bit-by-bit and I do not see where there are any security implications. There are maybe 7 bits total in config registers 0 through 5 that are R/W and this patch, of course, is providing RO access. A motivated person could download the PRA documents from our website even without this patch to discover what was implemented in the system. I could certainly see security implications if we were exporting the STATUS, CAUSE, and other critical registers. Unless you can provide a counterexample, this patch does not compromise the system in anyway.

-Steve

#4 lore raw
Quoted 7 lines · Steven
Quoted 3 lines

You're exporting privileged context outside the kernel -- have all the security implications been considered?

Maciej,

I have gone through the config registers bit-by-bit and I do not see where there are any security implications.

[...]

Quoted 3 lines

Unless you can provide a counterexample, this patch does not compromise the system in anyway.

The patch stands alone. Any security problems it might have are completely unrelated to any hypothetical Counter Examples.

David Daney

#5 lore raw
Quoted 3 lines

The patch stands alone. Any security problems it might have are completely unrelated to any hypothetical Counter Examples.

Indeed. So, can I get an ACK or what next? Thanks.

-Steve