Commit 2f08af26 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Will Deacon
Browse files

BACKPORT: x86/cfi,bpf: Fix BPF JIT call



The current BPF call convention is __nocfi, except when it calls !JIT things,
then it calls regular C functions.

It so happens that with FineIBT the __nocfi and C calling conventions are
incompatible. Specifically __nocfi will call at func+0, while FineIBT will have
endbr-poison there, which is not a valid indirect target. Causing #CP.

Notably this only triggers on IBT enabled hardware, which is probably why this
hasn't been reported (also, most people will have JIT on anyway).

Implement proper CFI prologues for the BPF JIT codegen and drop __nocfi for
x86.

Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20231215092707.345270396@infradead.org


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>

Bug: 452811419
Change-Id: I84f6d7464da9d3d6ffa64a8ae6c8972121d70c3f
(cherry picked from commit 4f9087f1)
[liwei: discard the including of <asm/cfi.h> because it already exists
 and fix some minor conflicts]
Signed-off-by: default avatarwei li <sirius.liwei@honor.corp-partner.google.com>
parent b231cf42
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment