[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMj1kXG_FeUa4H2kdgaLV=U8GniR0nK-oeB4hV7wuia6kt_e3w@mail.gmail.com>
Date: Fri, 9 Dec 2022 15:49:34 +0100
From: Ard Biesheuvel <ardb@...nel.org>
To: Alexander Gordeev <agordeev@...ux.ibm.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Jason Baron <jbaron@...mai.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] jump_label: explicitly annotate inittext labels as init
On Fri, 9 Dec 2022 at 15:48, Alexander Gordeev <agordeev@...ux.ibm.com> wrote:
>
> On Fri, Dec 09, 2022 at 02:48:49PM +0100, Ard Biesheuvel wrote:
> > On Fri, 9 Dec 2022 at 13:49, Alexander Gordeev <agordeev@...ux.ibm.com> wrote:
> > >
> > > On Fri, Dec 09, 2022 at 10:41:55AM +0100, Ard Biesheuvel wrote:
> > > > > diff --git a/kernel/jump_label.c b/kernel/jump_label.c
> > > > > index 714ac4c3b556..77680665d374 100644
> > > > > --- a/kernel/jump_label.c
> > > > > +++ b/kernel/jump_label.c
> > > > > @@ -481,13 +481,16 @@ void __init jump_label_init(void)
> > > > >
> > > > > for (iter = iter_start; iter < iter_stop; iter++) {
> > > > > struct static_key *iterk;
> > > > > + unsigned long addr;
> > > > > bool in_init;
> > > > >
> > > > > /* rewrite NOPs */
> > > > > if (jump_label_type(iter) == JUMP_LABEL_NOP)
> > > > > arch_jump_label_transform_static(iter, JUMP_LABEL_NOP);
> > > > >
> > > > > - in_init = init_section_contains((void *)jump_entry_code(iter), 1);
> > > > > + addr = jump_entry_code(iter);
> > > > > + in_init = init_section_contains((void *)addr, 1) ||
> > > > > + is_kernel_inittext(addr);
> > > >
> > > > Isn't it sufficient to only call is_kenel_inittext here?
> > >
> > > I am not sure every arch out there would stick to putting
> > > init code to inittext only.
> > >
> > > However, should not is_kernel_exittext() (which does not
> > > exist) also get checked here?
> >
> > No, exittext either exists or it doesn't, rather than disappearing at
> > runtime like inittext.
>
> May be just swap the order of init_section_contains() and
> is_kernel_inittext() checks then?
No I don't think we need both.
Powered by blists - more mailing lists