From: sashiko-bot@kernel.org
To: "Ard Biesheuvel" <ardb+git@google.com>, linux-mm@kvack.org
Cc: "Ard Biesheuvel" <ardb@kernel.org>,
"Suren Baghdasaryan" <surenb@google.com>,
"Kent Overstreet" <kent.overstreet@linux.dev>,
"Hao Ge" <hao.ge@linux.dev>
Subject: Re: [PATCH] alloc_tag: Use __ prefixed ELF section names
Date: Thu, 19 Nov 2026 13:27:35 +0000 [thread overview]
Message-ID: <sashiko-outbox-223175@kernel.org> (raw)
In-Reply-To: <20261118132719.632451-2-ardb+git@google.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] alloc_tag: SECTION_START() and SECTION_STOP() fail to expand
macro argument
- [Low] alloc_tag: missing Fixes: trailer for unprefixed alloc_tags
section name
--
commit 933587991e6a16ab600445b22347397f80335de9
Author: Ard Biesheuvel <ardb@kernel.org>
> alloc_tag: Use __ prefixed ELF section names
>
> The compiler will emit static relocations related to a section .foo into
> a separate section called .rela.foo, i.e., it just appends the section
> name to the string ".rela"
>
> When section names start with . or __, this results in relocation
> section names that are correctly matched by the various pattern rules in
> the various linker scripts across the tree.
>
> Without any such leading delimiter, it may lead to spurious warnings
> such as
>
> >> ld: warning: orphan section `.relaalloc_tags' from `init/main.o' being placed in section `.rela.dyn'
> ld: warning: dot moved backwards before `.rela.dyn'
> ld: .tmp_vmlinux1: section `.rela.dyn' can't be allocated in segment 1
>
> Fix this by renaming the section to __alloc_tags. While at it, tweak the
> headers so that the definition of the name appears only a single time.
>
> Cc: Suren Baghdasaryan <surenb@google.com>
> Cc: Kent Overstreet <kent.overstreet@linux.dev>
> Cc: Hao Ge <hao.ge@linux.dev>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
[Severity: Low]
This fixes the unprefixed alloc_tags section name. Should it include:
Fixes: 22d407b164ff ("lib: add allocation tagging support for memory allocation profiling")
> diff --git a/mm/alloc_tag.c b/mm/alloc_tag.c
> index e9b70268eacb0..00a68ab0c409a 100644
> --- a/mm/alloc_tag.c
> +++ b/mm/alloc_tag.c
> @@ -26,8 +26,8 @@
>
> #define ALLOCINFO_FILE_NAME "allocinfo"
> #define MODULE_ALLOC_TAG_VMAP_SIZE (100000UL * sizeof(struct alloc_tag))
> -#define SECTION_START(NAME) (CODETAG_SECTION_START_PREFIX NAME)
> -#define SECTION_STOP(NAME) (CODETAG_SECTION_STOP_PREFIX NAME)
> +#define SECTION_START(NAME) (CODETAG_SECTION_START_PREFIX #NAME)
> +#define SECTION_STOP(NAME) (CODETAG_SECTION_STOP_PREFIX #NAME)
[Severity: High]
Does #NAME in SECTION_START() and SECTION_STOP() stringify the macro name
"ALLOC_TAG_SECTION_NAME" instead of expanding it to "__alloc_tags"?
In alloc_tag_sec_init(), kallsyms_lookup_name() will look up
"__start_ALLOC_TAG_SECTION_NAME" and "__stop_ALLOC_TAG_SECTION_NAME"
instead of "__start___alloc_tags" and "__stop___alloc_tags", returning 0
for both. When compressed page allocation profiling is enabled
(sysctl.vm.mem_profiling=1,compressed), kernel_tags.count remains 0,
causing idx_to_ref() and ref_to_idx() to misclassify built-in kernel tags
as module tags and dereference an invalid module_tags.first_tag pointer on
page allocation or free.
Using __stringify(NAME) instead of #NAME would expand the argument first.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261118132719.632451-2-ardb+git@google.com?part=1
prev parent reply other threads:[~2026-11-19 13:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 13:27 [PATCH] alloc_tag: Use __ prefixed ELF section names Ard Biesheuvel
2026-11-19 13:27 ` sashiko-bot [this message]
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=sashiko-outbox-223175@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=ardb+git@google.com \
--cc=ardb@kernel.org \
--cc=hao.ge@linux.dev \
--cc=kent.overstreet@linux.dev \
--cc=linux-mm@kvack.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=surenb@google.com \
/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