From db91da8f05185706f492841d96864ad78893dd62 Mon Sep 17 00:00:00 2001 From: Tiezhu Yang Date: Thu, 20 Aug 2026 20:50:05 +0800 Subject: module/kallsyms: Rename is_mapping_symbol() to is_ignored_kernel_symbol() The helper function is_mapping_symbol() historically checks for both local labels prefixed with ".L" or "L0" and mapping symbols prefixed with "$". Rename it to is_ignored_kernel_symbol() to better reflect this actual behavior and scope, preventing conceptual confusion. While at it, update the related non-module files, no functional changes. Suggested-by: Petr Pavlu Signed-off-by: Tiezhu Yang Reviewed-by: Huacai Chen Reviewed-by: Petr Pavlu Signed-off-by: Petr Pavlu --- include/linux/module_symbol.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/module_symbol.h b/include/linux/module_symbol.h index 574609aced99..698d3db2b37e 100644 --- a/include/linux/module_symbol.h +++ b/include/linux/module_symbol.h @@ -7,8 +7,11 @@ enum ksym_flags { KSYM_FLAG_GPL_ONLY = 1 << 0, }; -/* This ignores the intensely annoying "mapping symbols" found in ELF files. */ -static inline bool is_mapping_symbol(const char *str) +/* + * Ignore local labels (.L*, L0*) and mapping symbols ($*). These symbols are + * not useful for the kernel, for example, they should not appear in kallsyms. + */ +static inline bool is_ignored_kernel_symbol(const char *str) { if (str[0] == '.' && str[1] == 'L') return true; -- cgit v1.2.3 From d6bfb4a05affc8083a45feefe0bbf715968e0d9e Mon Sep 17 00:00:00 2001 From: Petr Pavlu Date: Fri, 11 Sep 2026 14:46:16 +0000 Subject: module: Bring includes in linux/kmod.h up to date Including linux/kmod.h alone results in 1.5 MB of preprocessed output, even though it provides only a few functions and macros. The header currently depends on: * __printf() -> linux/compiler_attributes.h, * ENOSYS -> linux/errno.h, * bool -> linux/types.h. Include only these files, reducing the preprocessed output to 10 kB. Reviewed-by: Aaron Tomlin Signed-off-by: Petr Pavlu --- include/linux/kmod.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 9a07c3215389..b9474a62a568 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h @@ -2,17 +2,9 @@ #ifndef __LINUX_KMOD_H__ #define __LINUX_KMOD_H__ -/* - * include/linux/kmod.h - */ - -#include -#include -#include +#include #include -#include -#include -#include +#include #ifdef CONFIG_MODULES /* modprobe exit status on success, -ve on error. Return value -- cgit v1.2.3 From 687b7edb477e4ae106158c4e10ae938a024a2298 Mon Sep 17 00:00:00 2001 From: Petr Pavlu Date: Fri, 11 Sep 2026 17:04:03 +0200 Subject: syscalls: Include error-injection.h for ALLOW_ERROR_INJECTION() include/linux/compat.h and include/linux/syscalls.h use ALLOW_ERROR_INJECTION(), which is defined in asm-generic/error-injection.h. They currently rely on that header being included indirectly through other files, typically via linux/module.h -> linux/error-injection.h. Add the missing include in preparation for removing the linux/error-injection.h include from linux/module.h. Signed-off-by: Petr Pavlu --- include/linux/compat.h | 1 + include/linux/syscalls.h | 1 + 2 files changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/compat.h b/include/linux/compat.h index 8da0a15c95f4..ad37ca617e65 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -18,6 +18,7 @@ #include /* for aio_context_t */ #include #include +#include #include #include diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 8413b624ad47..552d9710a0d5 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -92,6 +92,7 @@ struct file_attr; #include #include #include +#include #include #ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER -- cgit v1.2.3 From ff7360c5c731356a59171eef732a26a72381a8ba Mon Sep 17 00:00:00 2001 From: Petr Pavlu Date: Fri, 11 Sep 2026 17:04:06 +0200 Subject: module: Remove the error-injection.h include from linux/module.h linux/module.h appears in roughly 15k #include directives across the kernel. This makes it a "hot" header, so it should avoid pulling in unnecessary definitions. The header currently includes linux/error-injection.h to obtain the definition of `struct error_injection_entry`. However, this is unnecessary because the type is only referenced in the file as a pointer, for which an incomplete type is sufficient. Remove the linux/error-injection.h include from linux/module.h and add it to kernel/module/main.c instead, where `sizeof(struct error_injection_entry)` is actually needed. Reviewed-by: Aaron Tomlin Signed-off-by: Petr Pavlu --- include/linux/module.h | 1 - kernel/module/main.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/module.h b/include/linux/module.h index 96cc98568eea..b3a3d5827384 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/kernel/module/main.c b/kernel/module/main.c index d0e1e0bd2ad0..f1392c10907a 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -60,6 +60,7 @@ #include #include #include +#include #include #include "internal.h" -- cgit v1.2.3