[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250714112122.GL1613633@noisy.programming.kicks-ass.net>
Date: Mon, 14 Jul 2025 13:21:22 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: x86@...nel.org
Cc: kys@...rosoft.com, haiyangz@...rosoft.com, wei.liu@...nel.org,
decui@...rosoft.com, tglx@...utronix.de, mingo@...hat.com,
bp@...en8.de, dave.hansen@...ux.intel.com, hpa@...or.com,
seanjc@...gle.com, pbonzini@...hat.com, ardb@...nel.org,
kees@...nel.org, Arnd Bergmann <arnd@...db.de>,
gregkh@...uxfoundation.org, jpoimboe@...nel.org,
linux-hyperv@...r.kernel.org, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, linux-efi@...r.kernel.org,
samitolvanen@...gle.com, ojeda@...nel.org
Subject: Re: [PATCH v3 16/16] objtool: Validate kCFI calls
On Mon, Jul 14, 2025 at 12:49:19PM +0200, Peter Zijlstra wrote:
> On Mon, Jul 14, 2025 at 12:20:27PM +0200, Peter Zijlstra wrote:
>
> > --- a/arch/x86/platform/efi/efi_stub_64.S
> > +++ b/arch/x86/platform/efi/efi_stub_64.S
> > @@ -11,6 +11,10 @@
> > #include <asm/nospec-branch.h>
> >
> > SYM_FUNC_START(__efi_call)
> > + /*
> > + * The EFI code doesn't have any CFI, annotate away the CFI violation.
> > + */
> > + ANNOTATE_NOCFI_SYM
> > pushq %rbp
> > movq %rsp, %rbp
> > and $~0xf, %rsp
>
> FWIW, we should probably do something like this as well.
>
> ---
>
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -562,6 +562,13 @@ __noendbr u64 ibt_save(bool disable)
> {
> u64 msr = 0;
>
> + /*
> + * Firmware code will not provide the same level of
> + * control-flow-integriry. Taint the kernel to let the user know.
> + */
> + if (disable || (IS_ENABLED(CONFIG_CFI_CLANG) && cfi_mode != CFI_OFF))
> + add_taint(TAINT_CFI, LOCKDEP_STILL_OK);
Or perhaps:
WARN_TAINT_ONCE(disable || IS_ENABLED(CONFIG_CFI_CLANG) && cfi_mode != CFI_OFF),
TAINT_CFI, "Firmware has weaker CFI");
> +
> if (cpu_feature_enabled(X86_FEATURE_IBT)) {
> rdmsrq(MSR_IA32_S_CET, msr);
> if (disable)
> --- a/include/linux/panic.h
> +++ b/include/linux/panic.h
> @@ -73,7 +73,8 @@ static inline void set_arch_panic_timeou
> #define TAINT_RANDSTRUCT 17
> #define TAINT_TEST 18
> #define TAINT_FWCTL 19
> -#define TAINT_FLAGS_COUNT 20
> +#define TAINT_CFI 20
> +#define TAINT_FLAGS_COUNT 21
> #define TAINT_FLAGS_MAX ((1UL << TAINT_FLAGS_COUNT) - 1)
>
> struct taint_flag {
Powered by blists - more mailing lists