[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXHqS=fTOa13LHqs1bqxy-EeD0xNUGxJA4xK=bKya+XBwA@mail.gmail.com>
Date: Tue, 18 Feb 2025 18:44:23 +0100
From: Ard Biesheuvel <ardb@...nel.org>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: Ard Biesheuvel <ardb+git@...gle.com>, linux-kernel@...r.kernel.org, x86@...nel.org,
Huacai Chen <chenhuacai@...nel.org>, Peter Zijlstra <peterz@...radead.org>,
Tiezhu Yang <yangtiezhu@...ngson.cn>
Subject: Re: [PATCH] objtool: Use idiomatic section name for relocatable
rodata under PIE
On Tue, 18 Feb 2025 at 18:38, Josh Poimboeuf <jpoimboe@...nel.org> wrote:
>
> On Tue, Feb 18, 2025 at 10:25:39AM +0100, Ard Biesheuvel wrote:
> > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> > index 91a7e824ed8b..337d3336e175 100644
> > --- a/include/asm-generic/vmlinux.lds.h
> > +++ b/include/asm-generic/vmlinux.lds.h
> > @@ -457,7 +457,7 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG)
> > . = ALIGN((align)); \
> > .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
> > __start_rodata = .; \
> > - *(.rodata) *(.rodata.*) *(..rodata.*) \
> > + *(.rodata) *(.rodata.*) *(.data.rel.ro*) \
>
> If I understand correctly, this is fixing an existing bug in loongarch
> and any other arches using PIE, right?
There are no other arches using PIE as far as I know. But it indeed
fixes an oversight in how -fPIE is used in the kernel.
> And it has nothing to do with
> objtool?
>
That didn't stop you from taking the previous fix :-)
> If so, it feels like this needs to be its own patch, described as a fix.
>
Fair enough. But better to drop the previous patch from the objtool tree then.
> > SCHED_DATA \
> > RO_AFTER_INIT_DATA /* Read only after init */ \
> > . = ALIGN(8); \
> > diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> > index 3d013f1412e0..27024a128a6a 100644
> > --- a/include/linux/compiler.h
> > +++ b/include/linux/compiler.h
> > @@ -110,7 +110,11 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
> > /* Unreachable code */
> > #ifdef CONFIG_OBJTOOL
> > /* Annotate a C jump table to allow objtool to follow the code flow */
> > -#define __annotate_jump_table __section("..rodata.c_jump_table")
> > +#ifndef __pie__
> > +#define __annotate_jump_table __section(".rodata.c_jump_table")
> > +#else
> > +#define __annotate_jump_table __section(".data.rel.ro.c_jump_table")
> > +#endif
>
> Why have two different section names, does .data.rel.ro.* not work for
> non-PIE?
>
Yeah, that is actually better, as long as we treat .data.rel.ro
consistently as .rodata.
Powered by blists - more mailing lists