summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNicholas Sielicki <linux@opensource.nslick.com>2026-03-07 03:00:09 -0600
committerSami Tolvanen <samitolvanen@google.com>2026-03-19 22:24:55 +0000
commit3fe1dcbc2d20c5dbc581c0bb458e05365bfffcf7 (patch)
tree5f09c585488802034a43b353bdc8dc94afbeaff2 /include
parent44a063c00fb13cf1f2e8a53a2ab10b232a44954b (diff)
module: expose imported namespaces via sysfs
Add /sys/module/*/import_ns to expose imported namespaces for currently loaded modules. The file contains one namespace per line and only exists for modules that import at least one namespace. Previously, the only way for userspace to inspect the symbol namespaces a module imports is to locate the .ko on disk and invoke modinfo(8) to decompress/parse the metadata. The kernel validated namespaces at load time, but it was otherwise discarded. Exposing this data via sysfs provides a runtime mechanism to verify which namespaces are being used by modules. For example, this allows userspace to audit driver API access in Android GKI, which uses symbol namespaces to restrict vendor drivers from using specific kernel interfaces (e.g., direct filesystem access). Signed-off-by: Nicholas Sielicki <linux@opensource.nslick.com> [Sami: Updated the commit message to explain motivation.] Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/module.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index 14f391b186c6..60ed1c3e0ed9 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -413,6 +413,7 @@ struct module {
struct module_attribute *modinfo_attrs;
const char *version;
const char *srcversion;
+ const char *imported_namespaces;
struct kobject *holders_dir;
/* Exported symbols */