linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Suren Baghdasaryan <surenb@google.com>
To: Casey Chen <cachen@purestorage.com>
Cc: linux-mm@kvack.org, kent.overstreet@linux.dev, yzhong@purestorage.com
Subject: Re: [PATCH 1/1] alloc_tag: remove empty module tag section from linker script
Date: Thu, 5 Jun 2025 13:07:03 -0700	[thread overview]
Message-ID: <CAJuCfpEehOR2yRjNxZ+hixLwhrRuFeVfBVNyexHy0+ETbgJpWQ@mail.gmail.com> (raw)
In-Reply-To: <20250605190128.2287011-2-cachen@purestorage.com>

On Thu, Jun 5, 2025 at 12:01 PM Casey Chen <cachen@purestorage.com> wrote:
>
> The empty MOD_CODETAG_SECTIONS() macro added an incomplete .data
> section in module linker script, which caused symbol lookup tools
> like gdb to misinterpret symbol addresses e.g., __ib_process_cq
> incorrectly mapping to unrelated functions like below.
>
>   (gdb) disas __ib_process_cq
>   Dump of assembler code for function trace_event_fields_cq_schedule:
>
> Removing the empty section restores proper symbol resolution and
> layout, ensuring .data placement behaves as expected.

Hmm. I'm not sure why an empty .data section would cause such an
issue. Is that expected behavior?

To clarify, codetags are designed to support different types of tags,
not only allocation tags which we currently use. It so happens that
allocation tags can be still used after module unload, therefore they
are placed into MOD_SEPARATE_CODETAG_SECTIONS(). If some other tags
are added in the future and their lifecycle is the same as modules
(IOW after module unload they can be unloaded too), then they would be
added into MOD_CODETAG_SECTIONS() but until then this section is
empty.

>
> Fixes: 22d407b164ff ("lib: add allocation tagging support for memory allocation profiling")
> Signed-off-by: Casey Chen <cachen@purestorage.com>
> Reviewed-by: Yuanyuan Zhong <yzhong@purestorage.com>
> ---
>  scripts/module.lds.S | 5 -----
>  1 file changed, 5 deletions(-)
>
> diff --git a/scripts/module.lds.S b/scripts/module.lds.S
> index 711c6e029936..c071ca4beedd 100644
> --- a/scripts/module.lds.S
> +++ b/scripts/module.lds.S
> @@ -50,17 +50,12 @@ SECTIONS {
>         .data : {
>                 *(.data .data.[0-9a-zA-Z_]*)
>                 *(.data..L*)
> -               MOD_CODETAG_SECTIONS()
>         }
>
>         .rodata : {
>                 *(.rodata .rodata.[0-9a-zA-Z_]*)
>                 *(.rodata..L*)
>         }
> -#else
> -       .data : {
> -               MOD_CODETAG_SECTIONS()
> -       }
>  #endif
>         MOD_SEPARATE_CODETAG_SECTIONS()
>  }
> --
> 2.34.1
>


  reply	other threads:[~2025-06-05 20:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05 19:01 [PATCH 0/1] alloc_tag: remove empty module tag section from Casey Chen
2025-06-05 19:01 ` [PATCH 1/1] alloc_tag: remove empty module tag section from linker script Casey Chen
2025-06-05 20:07   ` Suren Baghdasaryan [this message]
2025-06-09 21:15     ` Casey Chen
2025-06-09 22:55       ` Suren Baghdasaryan

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=CAJuCfpEehOR2yRjNxZ+hixLwhrRuFeVfBVNyexHy0+ETbgJpWQ@mail.gmail.com \
    --to=surenb@google.com \
    --cc=cachen@purestorage.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-mm@kvack.org \
    --cc=yzhong@purestorage.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