From: Petr Pavlu <petr.pavlu@suse.com>
To: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Luis Chamberlain <mcgrof@kernel.org>,
Daniel Gomez <da.gomez@kernel.org>,
Sami Tolvanen <samitolvanen@google.com>,
Aaron Tomlin <atomlin@atomlin.com>,
linux-modules@vger.kernel.org, loongarch@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/3] module/kallsyms: Rename is_mapping_symbol() to is_local_mapping_symbol()
Date: Tue, 18 Aug 2026 13:56:36 +0200 [thread overview]
Message-ID: <96b0e23b-165d-4026-bdfe-f8cd8ceb36ba@suse.com> (raw)
In-Reply-To: <20260812032807.15034-2-yangtiezhu@loongson.cn>
On 8/12/26 5:28 AM, Tiezhu Yang wrote:
> 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_local_mapping_symbol() to better reflect this actual
> behavior and scope, preventing conceptual confusion.
>
> No functional change.
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
> include/linux/module_symbol.h | 4 ++--
> kernel/module/kallsyms.c | 2 +-
> scripts/faddr2line | 2 +-
> scripts/mod/modpost.h | 2 +-
> 4 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/module_symbol.h b/include/linux/module_symbol.h
> index 574609aced99..ca76ed5cb489 100644
> --- a/include/linux/module_symbol.h
> +++ b/include/linux/module_symbol.h
> @@ -7,8 +7,8 @@ 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)
> +/* This ignores the intensely annoying "local or mapping symbols" found in ELF files. */
> +static inline bool is_local_mapping_symbol(const char *str)
I think the updated comment and the function name are confusing. They
read as if they are about local symbols in general (STB_LOCAL), but they
should refer only to local label symbols (.L<xyz>, ...). The function
would need to be called is_local_label_or_mapping_symbol() but that is
too long.
If you do want to rename this function, one option is to be consistent
with perf, which implements the same filter and calls it
is_ignored_kernel_symbol().
The comment could also be clearer, for example:
/*
* Ignore local labels (.L*, L0*) and mapping symbols ($*). These symbols are
* not useful for the kernel, for example, they should not appear in kallsyms.
*/
> {
> if (str[0] == '.' && str[1] == 'L')
> return true;
> diff --git a/kernel/module/kallsyms.c b/kernel/module/kallsyms.c
> index f23126d804b2..a595f8cd29b2 100644
> --- a/kernel/module/kallsyms.c
> +++ b/kernel/module/kallsyms.c
> @@ -294,7 +294,7 @@ static const char *find_kallsyms_symbol(struct module *mod,
> * and inserted at a whim.
> */
> if (*kallsyms_symbol_name(kallsyms, i) == '\0' ||
> - is_mapping_symbol(kallsyms_symbol_name(kallsyms, i)))
> + is_local_mapping_symbol(kallsyms_symbol_name(kallsyms, i)))
> continue;
>
> if (thisval <= addr && thisval > bestval) {
> diff --git a/scripts/faddr2line b/scripts/faddr2line
> index 622875396bcf..bda4ea20e39e 100755
> --- a/scripts/faddr2line
> +++ b/scripts/faddr2line
> @@ -243,7 +243,7 @@ __faddr2line() {
> local cur_sym_elf_size=${fields[2]}
> local cur_sym_name=${fields[7]:-}
>
> - # is_mapping_symbol(cur_sym_name)
> + # is_local_mapping_symbol(cur_sym_name)
> if [[ ${cur_sym_name} =~ ^(\.L|L0|\$) ]]; then
> continue
> fi
> diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
> index 2aecb8f25c87..4173fff2788a 100644
> --- a/scripts/mod/modpost.h
> +++ b/scripts/mod/modpost.h
> @@ -198,7 +198,7 @@ static inline bool is_valid_name(struct elf_info *elf, Elf_Sym *sym)
>
> if (!name || !strlen(name))
> return false;
> - return !is_mapping_symbol(name);
> + return !is_local_mapping_symbol(name);
> }
>
> /* symsearch.c */
Another comment-only reference to is_mapping_symbol() that should be
updated is in tools/perf/util/symbol.h.
--
Thanks,
Petr
next prev parent reply other threads:[~2026-08-18 11:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 3:28 [PATCH v3 0/3] Filter out local and mapping symbols during module load Tiezhu Yang
2026-08-12 3:28 ` [PATCH v3 1/3] module/kallsyms: Rename is_mapping_symbol() to is_local_mapping_symbol() Tiezhu Yang
2026-08-18 11:56 ` Petr Pavlu [this message]
2026-08-18 13:04 ` Tiezhu Yang
2026-08-20 9:53 ` Petr Pavlu
2026-08-12 3:28 ` [PATCH v3 2/3] module/kallsyms: Refactor current symbol filtering into is_kept_symbol() Tiezhu Yang
2026-08-18 11:58 ` Petr Pavlu
2026-08-18 13:05 ` Tiezhu Yang
2026-08-12 3:28 ` [PATCH v3 3/3] module/kallsyms: Filter out local and mapping symbols during module load Tiezhu Yang
2026-08-18 11:59 ` Petr Pavlu
2026-08-18 13:06 ` Tiezhu Yang
2026-08-12 15:17 ` [PATCH v3 0/3] " Huacai Chen
2026-08-17 14:11 ` Huacai Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=96b0e23b-165d-4026-bdfe-f8cd8ceb36ba@suse.com \
--to=petr.pavlu@suse.com \
--cc=atomlin@atomlin.com \
--cc=da.gomez@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=mcgrof@kernel.org \
--cc=samitolvanen@google.com \
--cc=yangtiezhu@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox