From nobody Tue Sep 29 05:35:42 2026 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 69F5E37188B; Wed, 12 Aug 2026 03:28:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786505296; cv=none; b=Kq/COR5sDHyRwPpJPQpkSw00C8T/Q/7dAG1DT4A8ilHe7njWFUl6TY5NT2aMVCK60phYpUxcXJ5AHQ9zg1479+4ed9RXNAbYCYc3F2az0nz7L0W7Z15Ov4yMwAw+bymcWTHWzKk+zXvjBiwqxE5hBj/jEyCGlV5uJkYJW8Z5D2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786505296; c=relaxed/simple; bh=8n4JAjZF+t8lMEAK3YulchVhkKwuyqy7dA1J4+dqKj8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EWWnO3WmUQV5VbdON/cZm2f2Bu8dax2HipcjQqHZ1urD2CdVIHU8L5oLCkdY0G7HASdwjo0mL3OlLZt+LLEwINzt4rGebtgWFJ1tt4339DSKaq6EgG2cJitYD8xZS+q4wOo/9GPuJXOqNtGaPAN5gZgpH3oO1OKKNBSaKjSv2zg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [123.138.236.242]) by gateway (Coremail) with SMTP id _____8DxztJK6HtqPGwAAA--.1277S3; Wed, 12 Aug 2026 11:28:10 +0800 (CST) Received: from linux.localdomain (unknown [123.138.236.242]) by front1 (Coremail) with SMTP id qMiowJCxPs9J6HtqfoUBAA--.10453S3; Wed, 12 Aug 2026 11:28:11 +0800 (CST) From: Tiezhu Yang To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin Cc: linux-modules@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/3] module/kallsyms: Rename is_mapping_symbol() to is_local_mapping_symbol() Date: Wed, 12 Aug 2026 11:28:05 +0800 Message-ID: <20260812032807.15034-2-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20260812032807.15034-1-yangtiezhu@loongson.cn> References: <20260812032807.15034-1-yangtiezhu@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: qMiowJCxPs9J6HtqfoUBAA--.10453S3 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoWxXFW7Kw4DurW8uw18Cw18tFc_yoW5GrW8pr 98Cw48CFWjyr1q9ayxCan2vry5Ww4vgw40kr98Cr97CFnIq3Z2q392kF15u34UXr4UJF48 WrsxZryfC3W7ArbCm3ZEXasCq-sJn29KB7ZKAUJUUUUx529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUBYb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r126r13M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ Gr0_Gr1UM2kKe7AKxVWUAVWUtwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYI kI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUtVWr XwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI4 8JMxkF7I0En4kS14v26r126r1DMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j 6r4UMxCIbckI1I0E14v26r126r1DMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwV AFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv2 0xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4 v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AK xVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU8Gii3UUUUU== Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Huacai Chen --- 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 =3D 1 << 0, }; =20 -/* This ignores the intensely annoying "mapping symbols" found in ELF file= s. */ -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) { if (str[0] =3D=3D '.' && str[1] =3D=3D '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) =3D=3D '\0' || - is_mapping_symbol(kallsyms_symbol_name(kallsyms, i))) + is_local_mapping_symbol(kallsyms_symbol_name(kallsyms, i))) continue; =20 if (thisval <=3D 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=3D${fields[2]} local cur_sym_name=3D${fields[7]:-} =20 - # is_mapping_symbol(cur_sym_name) + # is_local_mapping_symbol(cur_sym_name) if [[ ${cur_sym_name} =3D~ ^(\.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) =20 if (!name || !strlen(name)) return false; - return !is_mapping_symbol(name); + return !is_local_mapping_symbol(name); } =20 /* symsearch.c */ --=20 2.42.0 From nobody Tue Sep 29 05:35:42 2026 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A64038735D; Wed, 12 Aug 2026 03:28:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786505299; cv=none; b=nwEbtZXVF4QCwTXU0r/S6Zl6QYsdzrAMpjjOjZoJ3jW54Os2mDbtnQmzV0pcPp6vBI1w3gvi06RdsZe6JPHjfl3e2umf8Rti4HydK1TK+Wxv1xGNI/su7TvTyHjfKunPpEsGpswjvO/akG4ItQ+XIRVHDRdO2OGijj+ri3E2RDk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786505299; c=relaxed/simple; bh=fOwf4iaXbLgJyxWcHSfYOqpF7fYK180Cfwpuzr/Uojw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t8GSfcuvl1jqv0+4Hj2wETJRABE0uiBh8HaM1kNiRWcMdUIGwUx6CWbDBav0zNKLz7UFA9Yrlb4NhLUqnajBgZ+2uZFHu2MTnPkKxT9Rhcwm8KfMBAy/tLR6mFXP+B8lyKjIiHCkYFCf92j2iZvUzwIcZqHFoR7xIBXqWDwfoTk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [123.138.236.242]) by gateway (Coremail) with SMTP id _____8DxD9NN6HtqRGwAAA--.1376S3; Wed, 12 Aug 2026 11:28:13 +0800 (CST) Received: from linux.localdomain (unknown [123.138.236.242]) by front1 (Coremail) with SMTP id qMiowJCxPs9J6HtqfoUBAA--.10453S4; Wed, 12 Aug 2026 11:28:11 +0800 (CST) From: Tiezhu Yang To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin Cc: linux-modules@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/3] module/kallsyms: Refactor current symbol filtering into is_kept_symbol() Date: Wed, 12 Aug 2026 11:28:06 +0800 Message-ID: <20260812032807.15034-3-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20260812032807.15034-1-yangtiezhu@loongson.cn> References: <20260812032807.15034-1-yangtiezhu@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: qMiowJCxPs9J6HtqfoUBAA--.10453S4 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoWxXFykZF4UZrWDAr4fJw4kXwc_yoW5Kr1Upr 45C395JrW8Jr4Uuw4xArWY9ay3G34kW3yYg3W3GFWfArn8XFyrX3Wftw1F9FZ3Zr9rWa4r tF929Fy3J3W8AFbCm3ZEXasCq-sJn29KB7ZKAUJUUUUx529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUBYb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ Gr0_Gr1UM2kKe7AKxVWUAVWUtwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYI kI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUtVWr XwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI4 8JMxkF7I0En4kS14v26r126r1DMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j 6r4UMxCIbckI1I0E14v26r126r1DMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwV AFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv2 0xvE14v26r4j6ryUMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4 v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AK xVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU8_gA5UUUUU== Content-Type: text/plain; charset="utf-8" Currently, the loops in layout_symtab() and add_kallsyms() duplicate the exact same checks (i =3D=3D 0 || is_livepatch_module() || is_core_symbol()) to determine whether a symbol should be preserved in the module's core symbol table. Rename is_core_symbol() to is_kept_symbol() and move the entire checking logic inside it, including the special handlers for the first symbol and livepatch modules. No functional change. Suggested-by: Petr Pavlu Signed-off-by: Tiezhu Yang Reviewed-by: Huacai Chen Reviewed-by: Petr Pavlu --- kernel/module/kallsyms.c | 54 ++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/kernel/module/kallsyms.c b/kernel/module/kallsyms.c index a595f8cd29b2..ff8d904afe56 100644 --- a/kernel/module/kallsyms.c +++ b/kernel/module/kallsyms.c @@ -75,23 +75,26 @@ static char elf_type(const Elf_Sym *sym, const struct l= oad_info *info) return '?'; } =20 -static bool is_core_symbol(const Elf_Sym *src, const Elf_Shdr *sechdrs, - unsigned int shnum, unsigned int pcpundx) +static bool is_kept_symbol(struct module *mod, const struct load_info *inf= o, + unsigned int symnum, const Elf_Sym *src) { const Elf_Shdr *sec; enum mod_mem_type type; =20 + if (symnum =3D=3D 0 || is_livepatch_module(mod)) + return true; + if (src->st_shndx =3D=3D SHN_UNDEF || - src->st_shndx >=3D shnum || + src->st_shndx >=3D info->hdr->e_shnum || !src->st_name) return false; =20 #ifdef CONFIG_KALLSYMS_ALL - if (src->st_shndx =3D=3D pcpundx) + if (src->st_shndx =3D=3D info->index.pcpu) return true; #endif =20 - sec =3D sechdrs + src->st_shndx; + sec =3D info->sechdrs + src->st_shndx; type =3D sec->sh_entsize >> SH_ENTSIZE_TYPE_SHIFT; if (!(sec->sh_flags & SHF_ALLOC) #ifndef CONFIG_KALLSYMS_ALL @@ -130,12 +133,11 @@ void layout_symtab(struct module *mod, struct load_in= fo *info) =20 /* Compute total space required for the core symbols' strtab. */ for (ndst =3D i =3D 0; i < nsrc; i++) { - if (i =3D=3D 0 || is_livepatch_module(mod) || - is_core_symbol(src + i, info->sechdrs, info->hdr->e_shnum, - info->index.pcpu)) { - strtab_size +=3D strlen(&info->strtab[src[i].st_name]) + 1; - ndst++; - } + if (!is_kept_symbol(mod, info, i, src + i)) + continue; + + strtab_size +=3D strlen(&info->strtab[src[i].st_name]) + 1; + ndst++; } =20 /* Append room for core symbols at end of core part. */ @@ -197,23 +199,21 @@ void add_kallsyms(struct module *mod, const struct lo= ad_info *info) strtab_size =3D info->core_typeoffs - info->stroffs; src =3D kallsyms->symtab; for (ndst =3D i =3D 0; i < kallsyms->num_symtab; i++) { + ssize_t ret; + kallsyms->typetab[i] =3D elf_type(src + i, info); - if (i =3D=3D 0 || is_livepatch_module(mod) || - is_core_symbol(src + i, info->sechdrs, info->hdr->e_shnum, - info->index.pcpu)) { - ssize_t ret; - - mod->core_kallsyms.typetab[ndst] =3D - kallsyms->typetab[i]; - dst[ndst] =3D src[i]; - dst[ndst++].st_name =3D s - mod->core_kallsyms.strtab; - ret =3D strscpy(s, &kallsyms->strtab[src[i].st_name], - strtab_size); - if (ret < 0) - break; - s +=3D ret + 1; - strtab_size -=3D ret + 1; - } + + if (!is_kept_symbol(mod, info, i, src + i)) + continue; + + mod->core_kallsyms.typetab[ndst] =3D kallsyms->typetab[i]; + dst[ndst] =3D src[i]; + dst[ndst++].st_name =3D s - mod->core_kallsyms.strtab; + ret =3D strscpy(s, &kallsyms->strtab[src[i].st_name], strtab_size); + if (ret < 0) + break; + s +=3D ret + 1; + strtab_size -=3D ret + 1; } =20 /* Set up to point into init section. */ --=20 2.42.0 From nobody Tue Sep 29 05:35:42 2026 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0936A387569; Wed, 12 Aug 2026 03:28:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786505301; cv=none; b=kDozK0DLODcWcuLTRGGpxsnL0eZnLo8E/BMZuC4b/WYRCVJ/dImpY+9Hd9hn+geN7g71He9vH+rQ9gWe7pGDgN7oisu2ajLRztDOdBwVFTDJB74HB6uTt/QJrFRqPfmB9n8u74truaY2mY0SEZmQvDKyzWNeg1hiItY1W2Jz3lw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786505301; c=relaxed/simple; bh=BSAt31KS5ThObbnb9aQj86DJ+YuEIQHjUeIkmYfjQIE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ixiHF5d340BjHoDTzvqt4xx6GRDnnuTkj8587m2NewPVaMCE4KRGeM7p4IYEA3YCIwIJN+EdVlPQ/AO1yH+AstGVbS6mpK2jBLzoE3VhhXMKZ1wkK6Adh0MPIJWMX23tsebxKZPf3fbB6HMVraX8PApxlOqKY9KHHZrhvwf2i/E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [123.138.236.242]) by gateway (Coremail) with SMTP id _____8CxKvBP6HtqSmwAAA--.1350S3; Wed, 12 Aug 2026 11:28:15 +0800 (CST) Received: from linux.localdomain (unknown [123.138.236.242]) by front1 (Coremail) with SMTP id qMiowJCxPs9J6HtqfoUBAA--.10453S5; Wed, 12 Aug 2026 11:28:12 +0800 (CST) From: Tiezhu Yang To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin Cc: linux-modules@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/3] module/kallsyms: Filter out local and mapping symbols during module load Date: Wed, 12 Aug 2026 11:28:07 +0800 Message-ID: <20260812032807.15034-4-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20260812032807.15034-1-yangtiezhu@loongson.cn> References: <20260812032807.15034-1-yangtiezhu@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: qMiowJCxPs9J6HtqfoUBAA--.10453S5 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoW7WF4xWw48uFWrWFW8ZF47GFX_yoW8XF18pF 45Cw45GrW8Jr4v9a1DJ3yI9ry5Ga4DWr4akan0k34fAFn8X3W0vr43Kw1Y93y2vr4rGry0 qan2vayaya4DAagCm3ZEXasCq-sJn29KB7ZKAUJUUUUx529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUBYb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ Gr0_Gr1UM2kKe7AKxVWUAVWUtwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYI kI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUtVWr XwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI4 8JMxkF7I0En4kS14v26r126r1DMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j 6r4UMxCIbckI1I0E14v26r126r1DMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwV AFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv2 0xvE14v26ryj6F1UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4 v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AK xVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU8_gA5UUUUU== Content-Type: text/plain; charset="utf-8" The compiler toolchains generate local and mapping symbols on certain architectures like LoongArch for optimizations and relocations. While the symbols are already filtered out during runtime lookups via find_kallsyms_symbol(), they still leak into /proc/kallsyms for loaded modules because layout_symtab() and add_kallsyms() do not filter them during load time. Consequently, tracing tools like bpftrace (which do not perform internal filtering, unlike perf) resolve identical addresses into confusing local labels instead of actual clear C function names. Fix this by integrating the is_local_mapping_symbol() check directly into the newly introduced is_kept_symbol() helper. This ensures these unneeded symbols are stripped during module load time, keeping /proc/kallsyms clean and resulting in accurate call stacks. Signed-off-by: Tiezhu Yang Reviewed-by: Huacai Chen Reviewed-by: Petr Pavlu --- kernel/module/kallsyms.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/module/kallsyms.c b/kernel/module/kallsyms.c index ff8d904afe56..cc2a68956e43 100644 --- a/kernel/module/kallsyms.c +++ b/kernel/module/kallsyms.c @@ -89,6 +89,9 @@ static bool is_kept_symbol(struct module *mod, const stru= ct load_info *info, !src->st_name) return false; =20 + if (is_local_mapping_symbol(&info->strtab[src->st_name])) + return false; + #ifdef CONFIG_KALLSYMS_ALL if (src->st_shndx =3D=3D info->index.pcpu) return true; --=20 2.42.0