Re: [PATCH 0/2] Use dot prefixes for section names
From: Ard Biesheuvel
Date: Mon Oct 14 2024 - 13:44:11 EST
On Mon, 14 Oct 2024 at 19:29, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Mon, 14 Oct 2024 at 05:57, Ard Biesheuvel <ardb+git@xxxxxxxxxx> wrote:
> >
> > Pre-existing code uses a dot prefix or double underscore to prefix ELF
> > section names. strip_relocs on x86 relies on this, and other out of tree
> > tools that mangle vmlinux (kexec or live patching) may rely on this as
> > well.
> >
> > So let's not deviate from this and use a dot prefix for runtime-const
> > and alloc_tags sections.
>
> I'm not following what the actual problem is. Yes, I see that you
> report that it results in section names like ".relaalloc_tags", but
> what's the actual _issue_ with that? It seems entirely harmless.
>
> In fact, when I was going the runtime sections, I was thinking how
> convenient it was for the linker to generate the start/stop symbols
> for us, and that we should perhaps *expand* on that pattern.
>
> So this seems a step backwards to me, with no real explanation of what
> the actual problem is.
>
> Yes, we have (two different) pre-existing patterns, but neither
> pattern seems to be an actual improvement.
>
We have this code in arch/x86/Makefile.postlink:
quiet_cmd_strip_relocs = RSTRIP $@
cmd_strip_relocs = \
$(OBJCOPY) --remove-section='.rel.*' --remove-section='.rel__*' \
--remove-section='.rela.*' --remove-section='.rela__*' $@
Of course, that could easily be fixed, I was just being cautious in
case there is other, out-of-tree tooling for live patch or kexec etc
that has similar assumptions wrt section names.