Skip to contentSkip to conversation

World writeable MUX

PATCH Felipe Balbi 2 participants 2 messages Feb 4, 2011

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

Hi Tony,

I saw a few patches floating around regarding world writeable sysfs files and decided to grep around arch/arm/*omap* to try and see if we were safe. Turns out anyone can change MUX entries via the debugfs interface:

static void __init omap_mux_dbg_create_entry(
struct omap_mux_partition *partition, struct dentry *mux_dbg_dir)

{
	struct omap_mux_entry *e;

	list_for_each_entry(e, &partition->muxmodes, node) {
		struct omap_mux *m = &e->mux;

		(void)debugfs_create_file(m->muxnames[0], S_IWUGO, mux_dbg_dir,
					  m, &omap_mux_dbg_signal_fops);
	}
}

is that really expected ? I guess not, attached there's a small patch to fix that one.

Signature · 1 line
balbi
Quoted 1 line

From d3e0b6d3ddd82b1f9ab0299105cb8bf29d142ac4 Mon Sep 17 00:00:00 2001

From: Felipe Balbi <[email protected]>
Date: Fri, 4 Feb 2011 14:42:16 +0200
Subject: [PATCH] arm: omap2: fix a world writeable debugfs file
Organization: Texas Instruments\n

don't allow anyone to fiddle with the mux settings.

---
 arch/arm/mach-omap2/mux.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/mux.c +1 -1
index fae49d1..2727e58 100644
@@ -605,7 +605,7 @@ static void __init omap_mux_dbg_create_entry(
 	list_for_each_entry(e, &partition->muxmodes, node) {
 		struct omap_mux *m = &e->mux;
 
-		(void)debugfs_create_file(m->muxnames[0], S_IWUGO, mux_dbg_dir,
+		(void)debugfs_create_file(m->muxnames[0], S_IWUSR, mux_dbg_dir,
 					  m, &omap_mux_dbg_signal_fops);
 	}
 }
Signature · 1 line
1.7.4.rc2
maintainer
#1 lore raw
Quoted 21 lines · Felipe Balbi

Hi Tony,

I saw a few patches floating around regarding world writeable sysfs files and decided to grep around arch/arm/*omap* to try and see if we were safe. Turns out anyone can change MUX entries via the debugfs interface:

static void __init omap_mux_dbg_create_entry(
struct omap_mux_partition *partition, struct dentry *mux_dbg_dir)

{
	struct omap_mux_entry *e;

	list_for_each_entry(e, &partition->muxmodes, node) {
		struct omap_mux *m = &e->mux;

		(void)debugfs_create_file(m->muxnames[0], S_IWUGO, mux_dbg_dir,
					  m, &omap_mux_dbg_signal_fops);
	}
}
Quoted 2 lines

is that really expected ? I guess not, attached there's a small patch to fix that one.

Heh, no it should not be like that, thanks will queue as a fix.

Tony