objtool: Detect and warn about indirect calls in __nocfi functions
Status from this message: The following commit has been merged into the x86/core branch of tip:
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest16 patches 19 repliesApplied
- v213 patches 38 repliesSuperseded
- v16 patches 25 repliesSuperseded
Changes in v3 from the cover letter
- renamed COP to EM_ASM
- reworked the KVM-IDT stuff (Sean, Josh)
[1] https://lkml.kernel.org/r/[email protected]
[2] https://lkml.kernel.org/r/[email protected]
Patches in v3 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/16 | x86/kvm/emulate: Implement test_cc() in Carch/ arch/ | +15 | 0 replies | |
| 2/16 | x86/kvm/emulate: Introduce EM_ASM_1arch/ | +58 | 0 replies | |
| 3/16 | x86/kvm/emulate: Introduce EM_ASM_2arch/ | +47 | 0 replies | |
| 4/16 | x86/kvm/emulate: Introduce EM_ASM_2Rarch/ | +12 | 0 replies | |
| 5/16 | x86/kvm/emulate: Introduce EM_ASM_2Warch/ | +28 | 0 replies | |
| 6/16 | x86/kvm/emulate: Introduce EM_ASM_2CLarch/ | +24 | 0 replies | |
| 7/16 | x86/kvm/emulate: Introduce EM_ASM_1SRC2arch/ | +26 | 2 replies | |
| 8/16 | x86/kvm/emulate: Introduce EM_ASM_3WCLarch/ | +19 | 0 replies | |
| 9/16 | x86/kvm/emulate: Convert em_salc() to Carch/ | +9 | 0 replies | |
| 10/16 | x86/kvm/emulate: Remove fastopsarch/ | +1 | 0 replies | |
| 11/16 | x86,hyperv: Clean up hv_do_hypercall()arch/ arch/ arch/ +1 more | +89 | 2 replies | |
| 12/16 | x86_64,hyperv: Use direct call to hypercall-pagearch/ | +30 | 3 replies | |
| 13/16 | x86/fred: Install system vector handlers even if FRED isnt fully enabledarch/ arch/ | +6 | 0 replies | |
| 14/16 | x86/fred: Play nice with invoking asm_fred_entry_from_kvm() on non-FRED hardwarearch/ arch/ arch/ | +32 | 2 replies | |
| 15/16 | x86/fred: KVM: VMX: Always use FRED for IRQs when CONFIG_X86_FRED=yarch/ arch/ | +8 | 0 replies | |
| 16/16 | objtool: Validate kCFI callsarch/ arch/ arch/ +6 more | +72 | 9 replies |
Reviews trailers per patch
3 of 16 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Michael Kelley | Sean Christopherson | Wei Liu | Josh Poimboeuf |
|---|---|---|---|---|
| Series | A-b | |||
| 1/16 | ||||
| 2/16 | ||||
| 3/16 | ||||
| 4/16 | ||||
| 5/16 | ||||
| 6/16 | ||||
| 7/16 | ||||
| 8/16 | ||||
| 9/16 | ||||
| 10/16 | ||||
| 11/16 | T-b R-b | A-b | ||
| 12/16 | R-b | A-b | ||
| 13/16 | ||||
| 14/16 | Originally-by | |||
| 15/16 | ||||
| 16/16 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.
Cover letter [PATCH v3 00/16] objtool: Detect and warn about indirect calls in __nocfi functions
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 is completely rewritten -- 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. Paolo noted that pre-Westmere (2010) cares about this.
KVM has another; the VMX interrupt injection stuff calls the IDT handler directly. This is rewritten to to use the FRED dispatch table, which moves it all into C.
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 v2:
- renamed COP to EM_ASM
- reworked the KVM-IDT stuff (Sean, Josh)
[1] https://lkml.kernel.org/r/[email protected]
[2] https://lkml.kernel.org/r/[email protected]