Message ID | 20250305192808.2826336-1-kris.van.hees@oracle.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | kbuild: exclude .rodata.(cst|str)* when building ranges | expand |
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> > ---
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.
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.
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;