Re: [PATCH v2 1/2] module: expose imported namespaces via sysfs

From: Matthias Männich

Date: Mon Mar 09 2026 - 07:21:26 EST


On Sat, Mar 7, 2026 at 9:30 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> On Sat, Mar 07, 2026 at 03:00:09AM -0600, Nicholas Sielicki wrote:
> > 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.
> >
> > 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.
>
> What I'm missing here is why users would care about this?

FWIW, we use a symbol namespace in Android (GKI) [1] for symbols that
should not be used by all drivers (e.g. direct file system access).
This change would make it much easier to surface at runtime, which
drivers are using which namespace and thus have access to symbols they
should not.

Cheers,
Matthias

[1] https://android.googlesource.com/kernel/common/+/a38b207d4f4e02041f72a8168bb24d1617099988