mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
x86/static-call: provide a way to do very early static-call updates
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@citrix.com> Signed-off-by: Juergen Gross <jgross@suse.com> Co-developed-by: Peter Zijlstra <peterz@infradead.org> Co-developed-by: Josh Poimboeuf <jpoimboe@redhat.com>
This commit is contained in:
@@ -216,18 +216,6 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
/*
|
||||
* Force the compiler to emit 'sym' as a symbol, so that we can reference
|
||||
* it from inline assembler. Necessary in case 'sym' could be inlined
|
||||
* otherwise, or eliminated entirely due to lack of references that are
|
||||
* visible to the compiler.
|
||||
*/
|
||||
#define ___ADDRESSABLE(sym, __attrs) \
|
||||
static void * __used __attrs \
|
||||
__UNIQUE_ID(__PASTE(__addressable_,sym)) = (void *)(uintptr_t)&sym;
|
||||
#define __ADDRESSABLE(sym) \
|
||||
___ADDRESSABLE(sym, __section(".discard.addressable"))
|
||||
|
||||
/**
|
||||
* offset_to_ptr - convert a relative memory offset to an absolute pointer
|
||||
* @off: the address of the 32-bit offset value
|
||||
@@ -239,6 +227,33 @@ static inline void *offset_to_ptr(const int *off)
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#ifdef CONFIG_64BIT
|
||||
#define ARCH_SEL(a,b) a
|
||||
#else
|
||||
#define ARCH_SEL(a,b) b
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Force the compiler to emit 'sym' as a symbol, so that we can reference
|
||||
* it from inline assembler. Necessary in case 'sym' could be inlined
|
||||
* otherwise, or eliminated entirely due to lack of references that are
|
||||
* visible to the compiler.
|
||||
*/
|
||||
#define ___ADDRESSABLE(sym, __attrs) \
|
||||
static void * __used __attrs \
|
||||
__UNIQUE_ID(__PASTE(__addressable_,sym)) = (void *)(uintptr_t)&sym;
|
||||
|
||||
#define __ADDRESSABLE(sym) \
|
||||
___ADDRESSABLE(sym, __section(".discard.addressable"))
|
||||
|
||||
#define __ADDRESSABLE_ASM(sym) \
|
||||
.pushsection .discard.addressable,"aw"; \
|
||||
.align ARCH_SEL(8,4); \
|
||||
ARCH_SEL(.quad, .long) __stringify(sym); \
|
||||
.popsection;
|
||||
|
||||
#define __ADDRESSABLE_ASM_STR(sym) __stringify(__ADDRESSABLE_ASM(sym))
|
||||
|
||||
#ifdef __CHECKER__
|
||||
#define __BUILD_BUG_ON_ZERO_MSG(e, msg) (0)
|
||||
#else /* __CHECKER__ */
|
||||
|
||||
Reference in New Issue
Block a user