aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-12 20:00:53 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-12 20:00:53 -0500
commit277642dcca765a1955d4c753a5a315ff7f2eb09d (patch)
tree6443f09ef88b26e8742bf1abfb2ee4c71fb91a39
parent9d5604101e40c1d9d020384de11f0d68398c8844 (diff)
modules: make sysfs attribute files readable by owner only
This code goes back to the historical bitkeeper tree commit 3f7b0672086 ("Module section offsets in /sys/module"), where Jonathan Corbet wanted to show people how to debug loadable modules. See https://lwn.net/Articles/88052/ from June 2004. To expose the required load address information, Jonathan added the sections subdirectory for every module in /sys/modules, and made them S_IRUGO - readable by everybody. It was a more innocent time, plus those S_IRxxx macro names are a lot more confusing than the octal numbers are, so maybe it wasn't even intentional. But here we are, thirteen years later, and I'll just change it to S_IRUSR instead. Let's see if anybody even notices. Cc: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/module.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/module.c b/kernel/module.c
index de66ec825992..fdb3a6aca363 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1516,7 +1516,7 @@ static void add_sect_attrs(struct module *mod, const struct load_info *info)
1516 sattr->mattr.show = module_sect_show; 1516 sattr->mattr.show = module_sect_show;
1517 sattr->mattr.store = NULL; 1517 sattr->mattr.store = NULL;
1518 sattr->mattr.attr.name = sattr->name; 1518 sattr->mattr.attr.name = sattr->name;
1519 sattr->mattr.attr.mode = S_IRUGO; 1519 sattr->mattr.attr.mode = S_IRUSR;
1520 *(gattr++) = &(sattr++)->mattr.attr; 1520 *(gattr++) = &(sattr++)->mattr.attr;
1521 } 1521 }
1522 *gattr = NULL; 1522 *gattr = NULL;