Re: [PATCH v2 20/53] objtool/klp: Don't correlate .rodata.cst* constant pool objects
From: Song Liu
Date: Fri May 01 2026 - 13:32:47 EST
On Fri, May 1, 2026 at 6:04 PM Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>
> On Fri, May 01, 2026 at 11:37:49AM +0100, Song Liu wrote:
> > > +/*
> > > + * Some .rodata is anonymous and can't be correlated due to there being no
> > > + * symbol names.
> > > + *
> > > + * The .rodata.cst* sections aren't technically anonymous, they're SHF_MERGE
> > > + * constant pool sections containing small fixed-size data (lookup tables,
> > > + * bitmasks) which are only read by value, so pointer equivalence isn't needed.
> > > + * They are typically referenced by UBSAN data sections.
> > > + */
> > > +static bool is_anonymous_rodata(struct symbol *sym)
> > > +{
> > > + return is_rodata_sec(sym->sec) &&
> > > + (!is_object_sym(sym) || strstarts(sym->sec->name, ".rodata.cst"));
> > > +}
> > > +
> > > /*
> > > * These symbols should never be correlated, so their local patched versions
> > > * are used instead of linking to the originals.
> > > @@ -386,7 +401,7 @@ static bool dont_correlate(struct symbol *sym)
> > > is_uncorrelated_static_local(sym) ||
> > > is_local_label(sym) ||
> > > is_string_sec(sym->sec) ||
> > > - (is_rodata_sec(sym->sec) && !is_object_sym(sym)) ||
> > ^^^^
> > This line was added in 19/53. Maybe we can merge 19 and 20?
>
> I think I'd prefer to keep them separate as they are two distinct issues
> related to rodata: pointer equivalence (patch 19) and UBSAN mergeable
> constants (patch 20).
Fair enough. I think we can keep these two patches as-is.
Thanks,
Song
Acked-by: Song Liu <song@xxxxxxxxxx>