<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lwn.git/kernel/module, branch master</title>
<subtitle>Linux kernel documentation tree maintained by Jonathan Corbet</subtitle>
<id>http://mirrors.hust.edu.cn/git/lwn.git/atom?h=master</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/lwn.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/'/>
<updated>2026-04-04T00:04:48+00:00</updated>
<entry>
<title>module: Simplify warning on positive returns from module_init()</title>
<updated>2026-04-04T00:04:48+00:00</updated>
<author>
<name>Lucas De Marchi</name>
<email>demarchi@kernel.org</email>
</author>
<published>2026-03-30T13:13:52+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=663385f9155f27892a97a5824006f806a32eb8dc'/>
<id>urn:sha1:663385f9155f27892a97a5824006f806a32eb8dc</id>
<content type='text'>
It should now be rare to trigger this warning - it doesn't need to be so
verbose. Make it follow the usual style in the module loading code.

For the same reason, drop the dump_stack().

Suggested-by: Petr Pavlu &lt;petr.pavlu@suse.com&gt;
Signed-off-by: Lucas De Marchi &lt;demarchi@kernel.org&gt;
Reviewed-by: Aaron Tomlin &lt;atomlin@atomlin.com&gt;
Reviewed-by: Petr Pavlu &lt;petr.pavlu@suse.com&gt;
Reviewed-by: Daniel Gomez &lt;da.gomez@samsung.com&gt;
Signed-off-by: Sami Tolvanen &lt;samitolvanen@google.com&gt;
</content>
</entry>
<entry>
<title>module: Override -EEXIST module return</title>
<updated>2026-04-04T00:04:42+00:00</updated>
<author>
<name>Lucas De Marchi</name>
<email>demarchi@kernel.org</email>
</author>
<published>2026-03-30T13:13:51+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=743f8cae549affe8eafb021b8c0e78a9f3bc23fa'/>
<id>urn:sha1:743f8cae549affe8eafb021b8c0e78a9f3bc23fa</id>
<content type='text'>
The -EEXIST errno is reserved by the module loading functionality. When
userspace calls [f]init_module(), it expects a -EEXIST to mean that the
module is already loaded in the kernel. If module_init() returns it,
that is not true anymore.

Override the error when returning to userspace: it doesn't make sense to
change potentially long error propagation call chains just because it's
will end up as the return of module_init().

Closes: https://lore.kernel.org/all/aKLzsAX14ybEjHfJ@orbyte.nwl.cc/
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Aaron Tomlin &lt;atomlin@atomlin.com&gt;
Cc: Petr Pavlu &lt;petr.pavlu@suse.com&gt;
Cc: Daniel Gomez &lt;da.gomez@samsung.com&gt;
Cc: Phil Sutter &lt;phil@nwl.cc&gt;
Cc: Christophe Leroy &lt;christophe.leroy@csgroup.eu&gt;
Signed-off-by: Lucas De Marchi &lt;demarchi@kernel.org&gt;
[Sami: Fixed a typo.]
Signed-off-by: Sami Tolvanen &lt;samitolvanen@google.com&gt;
</content>
</entry>
<entry>
<title>module: deprecate usage of *_gpl sections in module loader</title>
<updated>2026-03-31T23:42:52+00:00</updated>
<author>
<name>Siddharth Nayyar</name>
<email>sidnayyar@google.com</email>
</author>
<published>2026-03-26T21:25:06+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=b4760ff2a5e4351c59d185967735f59c0b0bd7f6'/>
<id>urn:sha1:b4760ff2a5e4351c59d185967735f59c0b0bd7f6</id>
<content type='text'>
The *_gpl section are not being used populated by modpost anymore. Hence
the module loader doesn't need to find and process these sections in
modules.

This patch also simplifies symbol finding logic in module loader since
*_gpl sections don't have to be searched anymore.

Signed-off-by: Siddharth Nayyar &lt;sidnayyar@google.com&gt;
Reviewed-by: Petr Pavlu &lt;petr.pavlu@suse.com&gt;
Signed-off-by: Sami Tolvanen &lt;samitolvanen@google.com&gt;
</content>
</entry>
<entry>
<title>module: use kflagstab instead of *_gpl sections</title>
<updated>2026-03-31T23:42:52+00:00</updated>
<author>
<name>Siddharth Nayyar</name>
<email>sidnayyar@google.com</email>
</author>
<published>2026-03-26T21:25:05+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=55fcb926b6d8b5cfb40873e4840a69961db1bb69'/>
<id>urn:sha1:55fcb926b6d8b5cfb40873e4840a69961db1bb69</id>
<content type='text'>
Read kflagstab section for vmlinux and modules to determine whether
kernel symbols are GPL only.

This patch eliminates the need for fragmenting the ksymtab for infering
the value of GPL-only symbol flag, henceforth stop populating *_gpl
versions of the ksymtab and kcrctab in modpost.

Signed-off-by: Siddharth Nayyar &lt;sidnayyar@google.com&gt;
Reviewed-by: Petr Pavlu &lt;petr.pavlu@suse.com&gt;
Signed-off-by: Sami Tolvanen &lt;samitolvanen@google.com&gt;
</content>
</entry>
<entry>
<title>module: Give MODULE_SIG_STRING a more descriptive name</title>
<updated>2026-03-24T21:42:37+00:00</updated>
<author>
<name>Thomas Weißschuh</name>
<email>thomas.weissschuh@linutronix.de</email>
</author>
<published>2026-03-05T09:31:40+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=2ae4ea2d9aaf25cb74fbc23450b1b8f0a5b7aa89'/>
<id>urn:sha1:2ae4ea2d9aaf25cb74fbc23450b1b8f0a5b7aa89</id>
<content type='text'>
The purpose of the constant it is not entirely clear from its name.

As this constant is going to be exposed in a UAPI header, give it a more
specific name for clarity. As all its users call it 'marker', use that
wording in the constant itself.

Signed-off-by: Thomas Weißschuh &lt;thomas.weissschuh@linutronix.de&gt;
Reviewed-by: Petr Pavlu &lt;petr.pavlu@suse.com&gt;
Reviewed-by: Nicolas Schier &lt;nsc@kernel.org&gt;
Signed-off-by: Sami Tolvanen &lt;samitolvanen@google.com&gt;
</content>
</entry>
<entry>
<title>module: expose imported namespaces via sysfs</title>
<updated>2026-03-19T22:24:55+00:00</updated>
<author>
<name>Nicholas Sielicki</name>
<email>linux@opensource.nslick.com</email>
</author>
<published>2026-03-07T09:00:09+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=3fe1dcbc2d20c5dbc581c0bb458e05365bfffcf7'/>
<id>urn:sha1:3fe1dcbc2d20c5dbc581c0bb458e05365bfffcf7</id>
<content type='text'>
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 &lt;linux@opensource.nslick.com&gt;
[Sami: Updated the commit message to explain motivation.]
Signed-off-by: Sami Tolvanen &lt;samitolvanen@google.com&gt;
</content>
</entry>
<entry>
<title>module: Fix freeing of charp module parameters when CONFIG_SYSFS=n</title>
<updated>2026-03-18T21:43:18+00:00</updated>
<author>
<name>Petr Pavlu</name>
<email>petr.pavlu@suse.com</email>
</author>
<published>2026-03-13T13:48:02+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=deffe1edba626d474fef38007c03646ca5876a0e'/>
<id>urn:sha1:deffe1edba626d474fef38007c03646ca5876a0e</id>
<content type='text'>
When setting a charp module parameter, the param_set_charp() function
allocates memory to store a copy of the input value. Later, when the module
is potentially unloaded, the destroy_params() function is called to free
this allocated memory.

However, destroy_params() is available only when CONFIG_SYSFS=y, otherwise
only a dummy variant is present. In the unlikely case that the kernel is
configured with CONFIG_MODULES=y and CONFIG_SYSFS=n, this results in
a memory leak of charp values when a module is unloaded.

Fix this issue by making destroy_params() always available when
CONFIG_MODULES=y. Rename the function to module_destroy_params() to clarify
that it is intended for use by the module loader.

Fixes: e180a6b7759a ("param: fix charp parameters set via sysfs")
Signed-off-by: Petr Pavlu &lt;petr.pavlu@suse.com&gt;
Signed-off-by: Sami Tolvanen &lt;samitolvanen@google.com&gt;
</content>
</entry>
<entry>
<title>module: Fix kernel panic when a symbol st_shndx is out of bounds</title>
<updated>2026-02-23T19:37:28+00:00</updated>
<author>
<name>Ihor Solodrai</name>
<email>ihor.solodrai@linux.dev</email>
</author>
<published>2025-12-30T18:32:08+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=f9d69d5e7bde2295eb7488a56f094ac8f5383b92'/>
<id>urn:sha1:f9d69d5e7bde2295eb7488a56f094ac8f5383b92</id>
<content type='text'>
The module loader doesn't check for bounds of the ELF section index in
simplify_symbols():

       for (i = 1; i &lt; symsec-&gt;sh_size / sizeof(Elf_Sym); i++) {
		const char *name = info-&gt;strtab + sym[i].st_name;

		switch (sym[i].st_shndx) {
		case SHN_COMMON:

		[...]

		default:
			/* Divert to percpu allocation if a percpu var. */
			if (sym[i].st_shndx == info-&gt;index.pcpu)
				secbase = (unsigned long)mod_percpu(mod);
			else
  /** HERE --&gt; **/		secbase = info-&gt;sechdrs[sym[i].st_shndx].sh_addr;
			sym[i].st_value += secbase;
			break;
		}
	}

A symbol with an out-of-bounds st_shndx value, for example 0xffff
(known as SHN_XINDEX or SHN_HIRESERVE), may cause a kernel panic:

  BUG: unable to handle page fault for address: ...
  RIP: 0010:simplify_symbols+0x2b2/0x480
  ...
  Kernel panic - not syncing: Fatal exception

This can happen when module ELF is legitimately using SHN_XINDEX or
when it is corrupted.

Add a bounds check in simplify_symbols() to validate that st_shndx is
within the valid range before using it.

This issue was discovered due to a bug in llvm-objcopy, see relevant
discussion for details [1].

[1] https://lore.kernel.org/linux-modules/20251224005752.201911-1-ihor.solodrai@linux.dev/

Signed-off-by: Ihor Solodrai &lt;ihor.solodrai@linux.dev&gt;
Reviewed-by: Daniel Gomez &lt;da.gomez@samsung.com&gt;
Reviewed-by: Petr Pavlu &lt;petr.pavlu@suse.com&gt;
Signed-off-by: Sami Tolvanen &lt;samitolvanen@google.com&gt;
</content>
</entry>
<entry>
<title>module: Fix the modversions and signing submenus</title>
<updated>2026-02-23T17:45:03+00:00</updated>
<author>
<name>Petr Pavlu</name>
<email>petr.pavlu@suse.com</email>
</author>
<published>2026-02-05T14:37:08+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=8d597ba6ec18dae2eec143d4e1c9d81441ca0dda'/>
<id>urn:sha1:8d597ba6ec18dae2eec143d4e1c9d81441ca0dda</id>
<content type='text'>
The module Kconfig file contains a set of options related to "Module
versioning support" (depends on MODVERSIONS) and "Module signature
verification" (depends on MODULE_SIG). The Kconfig tool automatically
creates submenus when an entry for a symbol is followed by consecutive
items that all depend on the symbol. However, this functionality doesn't
work for the mentioned module options. The MODVERSIONS options are
interleaved with ASM_MODVERSIONS, which has no 'depends on MODVERSIONS' but
instead uses 'default HAVE_ASM_MODVERSIONS &amp;&amp; MODVERSIONS'. Similarly, the
MODULE_SIG options are interleaved by a comment warning not to forget
signing modules with scripts/sign-file, which uses the condition 'depends
on MODULE_SIG_FORCE &amp;&amp; !MODULE_SIG_ALL'.

The result is that the options are confusingly shown when using
a menuconfig tool, as follows:

 [*]   Module versioning support
         Module versioning implementation (genksyms (from source code))  ---&gt;
 [ ]   Extended Module Versioning Support
 [*]   Basic Module Versioning Support
 [*]   Source checksum for all modules
 [*]   Module signature verification
 [ ]     Require modules to be validly signed
 [ ]     Automatically sign all modules
       Hash algorithm to sign modules (SHA-256)  ---&gt;

Fix the issue by using if/endif to group related options together in
kernel/module/Kconfig, similarly to how the MODULE_DEBUG options are
already grouped. Note that the signing-related options depend on
'MODULE_SIG || IMA_APPRAISE_MODSIG', with the exception of
MODULE_SIG_FORCE, which is valid only for MODULE_SIG and is therefore kept
separately. For consistency, do the same for the MODULE_COMPRESS entries.
The options are then properly placed into submenus, as follows:

 [*]   Module versioning support
         Module versioning implementation (genksyms (from source code))  ---&gt;
 [ ]     Extended Module Versioning Support
 [*]     Basic Module Versioning Support
 [*]   Source checksum for all modules
 [*]   Module signature verification
 [ ]     Require modules to be validly signed
 [ ]     Automatically sign all modules
         Hash algorithm to sign modules (SHA-256)  ---&gt;

Signed-off-by: Petr Pavlu &lt;petr.pavlu@suse.com&gt;
Reviewed-by: Daniel Gomez &lt;da.gomez@samsung.com&gt;
Signed-off-by: Sami Tolvanen &lt;samitolvanen@google.com&gt;
</content>
</entry>
<entry>
<title>module: Remove duplicate freeing of lockdep classes</title>
<updated>2026-02-23T17:44:54+00:00</updated>
<author>
<name>Petr Pavlu</name>
<email>petr.pavlu@suse.com</email>
</author>
<published>2026-01-07T12:22:57+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=a7b4bc094fbaa7dc7b7b91ae33549bbd7eefaac1'/>
<id>urn:sha1:a7b4bc094fbaa7dc7b7b91ae33549bbd7eefaac1</id>
<content type='text'>
In the error path of load_module(), under the free_module label, the
code calls lockdep_free_key_range() to release lock classes associated
with the MOD_DATA, MOD_RODATA and MOD_RO_AFTER_INIT module regions, and
subsequently invokes module_deallocate().

Since commit ac3b43283923 ("module: replace module_layout with
module_memory"), the module_deallocate() function calls free_mod_mem(),
which releases the lock classes as well and considers all module
regions.

Attempting to free these classes twice is unnecessary. Remove the
redundant code in load_module().

Fixes: ac3b43283923 ("module: replace module_layout with module_memory")
Signed-off-by: Petr Pavlu &lt;petr.pavlu@suse.com&gt;
Reviewed-by: Daniel Gomez &lt;da.gomez@samsung.com&gt;
Reviewed-by: Aaron Tomlin &lt;atomlin@atomlin.com&gt;
Acked-by: Song Liu &lt;song@kernel.org&gt;
Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Sami Tolvanen &lt;samitolvanen@google.com&gt;
</content>
</entry>
</feed>
