linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/13] objtool: Detect and warn about indirect calls in __nocfi functions
@ 2025-04-30 11:07 Peter Zijlstra
  2025-04-30 11:07 ` [PATCH v2 01/13] x86/kvm/emulate: Implement test_cc() in C Peter Zijlstra
                   ` (14 more replies)
  0 siblings, 15 replies; 52+ messages in thread
From: Peter Zijlstra @ 2025-04-30 11:07 UTC (permalink / raw)
  To: x86
  Cc: kys, haiyangz, wei.liu, decui, tglx, mingo, bp, dave.hansen, hpa,
	seanjc, pbonzini, ardb, kees, Arnd Bergmann, gregkh, jpoimboe,
	peterz, linux-hyperv, linux-kernel, kvm, linux-efi, samitolvanen,
	ojeda

Hi!

On kCFI (CONFIG_CFI_CLANG=y) builds all indirect calls should have the CFI
check on (with very few exceptions). Not having the CFI checks undermines the
protection provided by CFI and will make these sites candidates for people
wanting to steal your cookies.

Specifically the ABI changes are so that doing indirect calls without the CFI
magic, to a CFI adorned function is not compatible (although it happens to work
for some setups, it very much does not for FineIBT).

Rust people tripped over this the other day, since their 'core' happened to
have some no_sanitize(kcfi) bits in, which promptly exploded when ran with
FineIBT on.

Since this is very much not a supported model -- on purpose, have objtool
detect and warn about such constructs.

This effort [1] found all existing [2] non-cfi indirect calls in the kernel.

Notably the KVM fastop emulation stuff -- which I've completely rewritten for
this version -- the generated code doesn't look horrific, but is slightly more
verbose. I'm running on the assumption that instruction emulation is not super
performance critical these days of zero VM-exit VMs etc.

KVM has another; the VMX interrupt injection stuff calls the IDT handler
directly.  Is there an alternative? Can we keep a table of Linux functions
slighly higher up the call stack (asm_\cfunc ?) and add CFI to those?

HyperV hypercall page stuff, which I've previously suggested use direct calls,
and which I've now converted (after getting properly annoyed with that code).

Also available at:

  git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/core

Changes since v1:

 - complete rewrite of the fastop stuff
 - HyperV tweaks (Michael)
 - objtool changes (Josh)


[1] https://lkml.kernel.org/r/20250410154556.GB9003@noisy.programming.kicks-ass.net
[2] https://lkml.kernel.org/r/20250410194334.GA3248459@google.com


^ permalink raw reply	[flat|nested] 52+ messages in thread

end of thread, other threads:[~2025-06-06 13:20 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-30 11:07 [PATCH v2 00/13] objtool: Detect and warn about indirect calls in __nocfi functions Peter Zijlstra
2025-04-30 11:07 ` [PATCH v2 01/13] x86/kvm/emulate: Implement test_cc() in C Peter Zijlstra
2025-04-30 11:07 ` [PATCH v2 02/13] x86/kvm/emulate: Introduce COP1 Peter Zijlstra
2025-04-30 16:19   ` Josh Poimboeuf
2025-04-30 19:05     ` Peter Zijlstra
2025-04-30 11:07 ` [PATCH v2 03/13] x86/kvm/emulate: Introduce COP2 Peter Zijlstra
2025-04-30 11:07 ` [PATCH v2 04/13] x86/kvm/emulate: Introduce COP2R Peter Zijlstra
2025-04-30 11:07 ` [PATCH v2 05/13] x86/kvm/emulate: Introduce COP2W Peter Zijlstra
2025-04-30 11:07 ` [PATCH v2 06/13] x86/kvm/emulate: Introduce COP2CL Peter Zijlstra
2025-04-30 11:07 ` [PATCH v2 07/13] x86/kvm/emulate: Introduce COP1SRC2 Peter Zijlstra
2025-04-30 11:07 ` [PATCH v2 08/13] x86/kvm/emulate: Introduce COP3WCL Peter Zijlstra
2025-04-30 11:07 ` [PATCH v2 09/13] x86/kvm/emulate: Convert em_salc() to C Peter Zijlstra
2025-04-30 11:07 ` [PATCH v2 10/13] x86/kvm/emulate: Remove fastops Peter Zijlstra
2025-04-30 11:07 ` [PATCH v2 11/13] x86,hyperv: Clean up hv_do_hypercall() Peter Zijlstra
2025-05-01  2:36   ` Michael Kelley
2025-04-30 11:07 ` [PATCH v2 12/13] x86_64,hyperv: Use direct call to hypercall-page Peter Zijlstra
2025-05-01  2:36   ` Michael Kelley
2025-05-01  8:59     ` Peter Zijlstra
2025-04-30 11:07 ` [PATCH v2 13/13] objtool: Validate kCFI calls Peter Zijlstra
2025-04-30 15:59   ` Josh Poimboeuf
2025-04-30 19:03     ` Peter Zijlstra
2025-05-01 15:56       ` Peter Zijlstra
2025-04-30 14:24 ` [PATCH v2 00/13] objtool: Detect and warn about indirect calls in __nocfi functions H. Peter Anvin
2025-04-30 19:06   ` Peter Zijlstra
2025-05-01 10:30     ` Peter Zijlstra
2025-05-01 15:38       ` Peter Zijlstra
2025-05-01 18:30         ` Sean Christopherson
2025-05-01 18:42           ` H. Peter Anvin
2025-05-01 18:59             ` Sean Christopherson
2025-05-02  6:12               ` Xin Li
2025-05-02  5:46           ` Xin Li
2025-05-02  5:48           ` Xin Li
2025-05-02 19:43             ` H. Peter Anvin
2025-05-02  8:40           ` Peter Zijlstra
2025-05-02 19:53             ` Sean Christopherson
2025-05-03  9:50               ` Peter Zijlstra
2025-05-03 18:28                 ` Josh Poimboeuf
2025-05-06  7:31                   ` Peter Zijlstra
2025-05-06 13:32                     ` Peter Zijlstra
2025-05-06 19:18                       ` Josh Poimboeuf
2025-05-28  7:44                         ` Peter Zijlstra
2025-05-28 16:30                           ` Peter Zijlstra
2025-05-28 16:35                             ` Peter Zijlstra
2025-05-29  9:30                               ` Peter Zijlstra
2025-06-03  5:43                                 ` Josh Poimboeuf
2025-06-03 16:29                                   ` Josh Poimboeuf
2025-06-05 17:19                                     ` Josh Poimboeuf
2025-06-06 10:49                                       ` Peter Zijlstra
2025-06-06 13:15                                         ` Sean Christopherson
2025-06-06 13:20                                           ` Peter Zijlstra
2025-05-01 18:33 ` Paolo Bonzini
2025-05-02 11:08   ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).