* [PATCH] kbuild: exclude .rodata.(cst|str)* when building ranges
@ 2025-03-05 19:27 Kris Van Hees
2025-03-07 16:14 ` Steven Rostedt
2025-03-11 9:17 ` Masahiro Yamada
0 siblings, 2 replies; 4+ messages in thread
From: Kris Van Hees @ 2025-03-05 19:27 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Kris Van Hees, linux-kernel, linux-kbuild, linux-modules,
linux-trace-kernel, Nick Alcock, Alan Maguire, Steven Rostedt,
Sam James, Luis Chamberlain, Masami Hiramatsu, Nick Desaulniers,
Jiri Olsa, Elena Zannoni, Daniel Gomez, Jack Vogel
The .rodata.(cst|str)* sections are often resized during the final
linking and since these sections do not cover actual symbols there is
no need to include them in the modules.builtin.ranges data.
When these sections were included in processing and resizing occurred,
modules were reported with ranges that extended beyond their true end,
causing subsequent symbols (in address order) to be associated with
the wrong module.
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
---
scripts/generate_builtin_ranges.awk | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/scripts/generate_builtin_ranges.awk b/scripts/generate_builtin_ranges.awk
index b9ec761b3bef..d4bd5c2b998c 100755
--- a/scripts/generate_builtin_ranges.awk
+++ b/scripts/generate_builtin_ranges.awk
@@ -282,6 +282,11 @@ ARGIND == 2 && !anchor && NF == 2 && $1 ~ /^0x/ && $2 !~ /^0x/ {
# section.
#
ARGIND == 2 && sect && NF == 4 && /^ [^ \*]/ && !($1 in sect_addend) {
+ # There are a few sections with constant data (without symbols) that
+ # can get resized during linking, so it is best to ignore them.
+ if ($1 ~ /^\.rodata\.(cst|str)[0-9]/)
+ next;
+
if (!($1 in sect_base)) {
sect_base[$1] = base;
--
2.45.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] kbuild: exclude .rodata.(cst|str)* when building ranges
2025-03-05 19:27 [PATCH] kbuild: exclude .rodata.(cst|str)* when building ranges Kris Van Hees
@ 2025-03-07 16:14 ` Steven Rostedt
2025-03-11 9:17 ` Masahiro Yamada
1 sibling, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2025-03-07 16:14 UTC (permalink / raw)
To: Kris Van Hees
Cc: Masahiro Yamada, linux-kernel, linux-kbuild, linux-modules,
linux-trace-kernel, Nick Alcock, Alan Maguire, Sam James,
Luis Chamberlain, Masami Hiramatsu, Nick Desaulniers, Jiri Olsa,
Elena Zannoni, Daniel Gomez, Jack Vogel
On Wed, 5 Mar 2025 14:27:58 -0500
Kris Van Hees <kris.van.hees@oracle.com> wrote:
> The .rodata.(cst|str)* sections are often resized during the final
> linking and since these sections do not cover actual symbols there is
> no need to include them in the modules.builtin.ranges data.
>
> When these sections were included in processing and resizing occurred,
> modules were reported with ranges that extended beyond their true end,
> causing subsequent symbols (in address order) to be associated with
> the wrong module.
If that's the case, shouldn't this be considered a fix, and include a fixes
tag as well as Cc stable?
-- Steve
>
> Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
> Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
> ---
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kbuild: exclude .rodata.(cst|str)* when building ranges
2025-03-05 19:27 [PATCH] kbuild: exclude .rodata.(cst|str)* when building ranges Kris Van Hees
2025-03-07 16:14 ` Steven Rostedt
@ 2025-03-11 9:17 ` Masahiro Yamada
2025-03-11 17:27 ` Masahiro Yamada
1 sibling, 1 reply; 4+ messages in thread
From: Masahiro Yamada @ 2025-03-11 9:17 UTC (permalink / raw)
To: Kris Van Hees
Cc: linux-kernel, linux-kbuild, linux-modules, linux-trace-kernel,
Nick Alcock, Alan Maguire, Steven Rostedt, Sam James,
Luis Chamberlain, Masami Hiramatsu, Nick Desaulniers, Jiri Olsa,
Elena Zannoni, Daniel Gomez, Jack Vogel
On Thu, Mar 6, 2025 at 4:28 AM Kris Van Hees <kris.van.hees@oracle.com> wrote:
>
> The .rodata.(cst|str)* sections are often resized during the final
> linking and since these sections do not cover actual symbols there is
> no need to include them in the modules.builtin.ranges data.
>
> When these sections were included in processing and resizing occurred,
> modules were reported with ranges that extended beyond their true end,
> causing subsequent symbols (in address order) to be associated with
> the wrong module.
>
> Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
> Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
> ---
Applied with the following tag:
Fixes: 5f5e7344322f ("kbuild: generate offset range data for builtin modules")
Please let me know if this is wrong.
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kbuild: exclude .rodata.(cst|str)* when building ranges
2025-03-11 9:17 ` Masahiro Yamada
@ 2025-03-11 17:27 ` Masahiro Yamada
0 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2025-03-11 17:27 UTC (permalink / raw)
To: Kris Van Hees
Cc: linux-kernel, linux-kbuild, linux-modules, linux-trace-kernel,
Nick Alcock, Alan Maguire, Steven Rostedt, Sam James,
Luis Chamberlain, Masami Hiramatsu, Nick Desaulniers, Jiri Olsa,
Elena Zannoni, Daniel Gomez, Jack Vogel
On Tue, Mar 11, 2025 at 6:17 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Thu, Mar 6, 2025 at 4:28 AM Kris Van Hees <kris.van.hees@oracle.com> wrote:
> >
> > The .rodata.(cst|str)* sections are often resized during the final
> > linking and since these sections do not cover actual symbols there is
> > no need to include them in the modules.builtin.ranges data.
> >
> > When these sections were included in processing and resizing occurred,
> > modules were reported with ranges that extended beyond their true end,
> > causing subsequent symbols (in address order) to be associated with
> > the wrong module.
> >
> > Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
> > Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
> > ---
>
> Applied with the following tag:
>
> Fixes: 5f5e7344322f ("kbuild: generate offset range data for builtin modules")
>
> Please let me know if this is wrong.
Ah, v2 was submitted already.
I will take that one.
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-03-11 17:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-05 19:27 [PATCH] kbuild: exclude .rodata.(cst|str)* when building ranges Kris Van Hees
2025-03-07 16:14 ` Steven Rostedt
2025-03-11 9:17 ` Masahiro Yamada
2025-03-11 17:27 ` Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox