Commit 88b29f3f authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull module updates from Sami Tolvanen:
 "Kernel symbol flags:

   - Replace the separate *_gpl symbol sections (__ksymtab_gpl and
     __kcrctab_gpl) with a unified symbol table and a new __kflagstab
     section.

     This section stores symbol flags, such as the GPL-only flag, as an
     8-bit bitset for each exported symbol. This is a cleanup that
     simplifies symbol lookup in the module loader by avoiding table
     fragmentation and will allow a cleaner way to add more flags later
     if needed.

  Module signature UAPI:

   - Move struct module_signature to the UAPI headers to allow reuse by
     tools outside the kernel proper, such as kmod and
     scripts/sign-file.

     This also renames a few constants for clarity and drops unused
     signature types as preparation for hash-based module integrity
     checking work that's in progress.

  Sysfs:

   - Add a /sys/module/<module>/import_ns sysfs attribute to show the
     symbol namespaces imported by loaded modules.

     This makes it easier to verify driver API access at runtime on
     systems that care about such things (e.g. Android).

  Cleanups and fixes:

   - Force sh_addr to 0 for all sections in module.lds. This prevents
     non-zero section addresses when linking modules with 'ld.bfd -r',
     which confused elfutils.

   - Fix a memory leak of charp module parameters on module unload when
     the kernel is configured with CONFIG_SYSFS=n.

   - Override the -EEXIST error code returned by module_init() to
     userspace. This prevents confusion with the errno reserved by the
     module loader to indicate that a module is already loaded.

   - Simplify the warning message and drop the stack dump on positive
     returns from module_init().

   - Drop unnecessary extern keywords from function declarations and
     synchronize parse_args() arguments with their implementation"

* tag 'modules-7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/modules/linux: (23 commits)
  module: Simplify warning on positive returns from module_init()
  module: Override -EEXIST module return
  documentation: remove references to *_gpl sections
  module: remove *_gpl sections from vmlinux and modules
  module: deprecate usage of *_gpl sections in module loader
  module: use kflagstab instead of *_gpl sections
  module: populate kflagstab in modpost
  module: add kflagstab section to vmlinux and modules
  module: define ksym_flags enumeration to represent kernel symbol flags
  selftests/bpf: verify_pkcs7_sig: Use 'struct module_signature' from the UAPI headers
  sign-file: use 'struct module_signature' from the UAPI headers
  tools uapi headers: add linux/module_signature.h
  module: Move 'struct module_signature' to UAPI
  module: Give MODULE_SIG_STRING a more descriptive name
  module: Give 'enum pkey_id_type' a more specific name
  module: Drop unused signature types
  extract-cert: drop unused definition of PKEY_ID_PKCS7
  docs: symbol-namespaces: mention sysfs attribute
  module: expose imported namespaces via sysfs
  module: Remove extern keyword from param prototypes
  ...
parents ee60c510 663385f9
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -48,6 +48,15 @@ Contact: Kay Sievers <kay.sievers@vrfy.org>
Description:	Show the initialization state(live, coming, going) of
		the module.

What:		/sys/module/*/import_ns
Date:		January 2026
KernelVersion:	7.1
Contact:	linux-modules@vger.kernel.org
Description:	List of symbol namespaces imported by this module via
		MODULE_IMPORT_NS(). Each namespace appears on a separate line.
		This file only exists for modules that import at least one
		namespace.

What:		/sys/module/*/taint
Date:		Jan 2012
KernelVersion:	3.3
+5 −0
Original line number Diff line number Diff line
@@ -114,6 +114,11 @@ inspected with modinfo::
	import_ns:      USB_STORAGE
	[...]

For modules that are currently loaded, imported namespaces are also available
via sysfs::

	$ cat /sys/module/ums_karma/import_ns
	USB_STORAGE

It is advisable to add the MODULE_IMPORT_NS() statement close to other module
metadata definitions like MODULE_AUTHOR() or MODULE_LICENSE().
+6 −5
Original line number Diff line number Diff line
@@ -426,11 +426,12 @@ Symbols From the Kernel (vmlinux + modules)
Version Information Formats
---------------------------

	Exported symbols have information stored in __ksymtab or __ksymtab_gpl
	sections. Symbol names and namespaces are stored in __ksymtab_strings,
	using a format similar to the string table used for ELF. If
	CONFIG_MODVERSIONS is enabled, the CRCs corresponding to exported
	symbols will be added to the __kcrctab or __kcrctab_gpl.
	Exported symbols have information stored in the __ksymtab and
	__kflagstab sections. Symbol names and namespaces are stored in
	__ksymtab_strings section, using a format similar to the string
	table used for ELF. If CONFIG_MODVERSIONS is enabled, the CRCs
	corresponding to exported symbols will be added to the
	__kcrctab section.

	If CONFIG_BASIC_MODVERSIONS is enabled (default with
	CONFIG_MODVERSIONS), imported symbols will have their symbol name and
+3 −3
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ const struct kexec_file_ops * const kexec_file_loaders[] = {
#ifdef CONFIG_KEXEC_SIG
int s390_verify_sig(const char *kernel, unsigned long kernel_len)
{
	const unsigned long marker_len = sizeof(MODULE_SIG_STRING) - 1;
	const unsigned long marker_len = sizeof(MODULE_SIGNATURE_MARKER) - 1;
	struct module_signature *ms;
	unsigned long sig_len;
	int ret;
@@ -40,7 +40,7 @@ int s390_verify_sig(const char *kernel, unsigned long kernel_len)
	if (marker_len > kernel_len)
		return -EKEYREJECTED;

	if (memcmp(kernel + kernel_len - marker_len, MODULE_SIG_STRING,
	if (memcmp(kernel + kernel_len - marker_len, MODULE_SIGNATURE_MARKER,
		   marker_len))
		return -EKEYREJECTED;
	kernel_len -= marker_len;
@@ -53,7 +53,7 @@ int s390_verify_sig(const char *kernel, unsigned long kernel_len)
		return -EKEYREJECTED;
	kernel_len -= sig_len;

	if (ms->id_type != PKEY_ID_PKCS7)
	if (ms->id_type != MODULE_SIGNATURE_TYPE_PKCS7)
		return -EKEYREJECTED;

	if (ms->algo != 0 ||
+0 −2
Original line number Diff line number Diff line
@@ -33,8 +33,6 @@
#endif
#include "ssl-common.h"

#define PKEY_ID_PKCS7 2

static __attribute__((noreturn))
void format(void)
{
Loading