Re: [PATCH 6.12 168/172] x86/static-call: provide a way to do very early static-call updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 18, 2024 at 09:53:24AM +0100, Jürgen Groß wrote:
> On 18.12.24 09:37, Jiri Slaby wrote:
> > On 17. 12. 24, 18:08, Greg Kroah-Hartman wrote:
> > > 6.12-stable review patch.  If anyone has any objections, please let me know.
> > > 
> > > ------------------
> > > 
> > > From: Juergen Gross <jgross@xxxxxxxx>
> > > 
> > > commit 0ef8047b737d7480a5d4c46d956e97c190f13050 upstream.
> > > 
> > > Add static_call_update_early() for updating static-call targets in
> > > very early boot.
> > > 
> > > This will be needed for support of Xen guest type specific hypercall
> > > functions.
> > > 
> > > This is part of XSA-466 / CVE-2024-53241.
> > > 
> > > Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> > > Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
> > > Co-developed-by: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> > > Co-developed-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> > > ---
> > >   arch/x86/include/asm/static_call.h |   15 +++++++++++++++
> > >   arch/x86/include/asm/sync_core.h   |    6 +++---
> > >   arch/x86/kernel/static_call.c      |    9 +++++++++
> > >   include/linux/compiler.h           |   37 ++++++++++++++++++++++++++-----------
> > >   include/linux/static_call.h        |    1 +
> > >   kernel/static_call_inline.c        |    2 +-
> > >   6 files changed, 55 insertions(+), 15 deletions(-)
> > > 
> > > --- a/arch/x86/include/asm/static_call.h
> > > +++ b/arch/x86/include/asm/static_call.h
> > > @@ -65,4 +65,19 @@
> > >   extern bool __static_call_fixup(void *tramp, u8 op, void *dest);
> > > +extern void __static_call_update_early(void *tramp, void *func);
> > > +
> > > +#define static_call_update_early(name, _func)                \
> > > +({                                    \
> > > +    typeof(&STATIC_CALL_TRAMP(name)) __F = (_func);            \
> > > +    if (static_call_initialized) {                    \
> > > +        __static_call_update(&STATIC_CALL_KEY(name),        \
> > > +                     STATIC_CALL_TRAMP_ADDR(name), __F);\
> > > +    } else {                            \
> > > +        WRITE_ONCE(STATIC_CALL_KEY(name).func, _func);        \
> > > +        __static_call_update_early(STATIC_CALL_TRAMP_ADDR(name),\
> > > +                       __F);            \
> > > +    }                                \
> > > +})
> > ...
> > > --- a/kernel/static_call_inline.c
> > > +++ b/kernel/static_call_inline.c
> > > @@ -15,7 +15,7 @@ extern struct static_call_site __start_s
> > >   extern struct static_call_tramp_key __start_static_call_tramp_key[],
> > >                       __stop_static_call_tramp_key[];
> > > -static int static_call_initialized;
> > > +int static_call_initialized;
> > 
> > This breaks the build on i386:
> > > ld: arch/x86/xen/enlighten.o: in function `__xen_hypercall_setfunc':
> > > enlighten.c:(.noinstr.text+0x2a): undefined reference to
> > > `static_call_initialized'
> > > ld: enlighten.c:(.noinstr.text+0x62): undefined reference to
> > > `static_call_initialized'
> > > ld: arch/x86/kernel/static_call.o: in function `__static_call_update_early':
> > > static_call.c:(.noinstr.text+0x15): undefined reference to
> > > `static_call_initialized'
> > 
> > kernel/static_call_inline.c containing this `static_call_initialized` is
> > not built there as:
> > HAVE_STATIC_CALL_INLINE=n
> >   -> HAVE_OBJTOOL=n
> >      -> X86_64=n
> > 
> > This is broken in upstream too.
> 
> I've sent a fix already:
> 
> https://lore.kernel.org/lkml/20241218080228.9742-1-jgross@xxxxxxxx/T/#u

Thanks, I'll go queue that up (after fixing it up for the different
branches...)

greg k-h




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux