summaryrefslogtreecommitdiff
path: root/scripts/basic
diff options
context:
space:
mode:
authorSoheil Hassas Yeganeh <soheil.kdev@gmail.com>2026-08-31 14:48:44 +0000
committerPeter Zijlstra <peterz@infradead.org>2026-09-10 11:01:31 +0200
commit5a5d26f2cfe13467166219f6bf58099326912ddb (patch)
tree60c0eb8e534bf9e64bf8e989394f2b55460f00be /scripts/basic
parentf7491d7c81db0e7c304a7bd757a76d2fbeaff80e (diff)
downloadlinux-5a5d26f2cfe13467166219f6bf58099326912ddb.tar.gz
linux-5a5d26f2cfe13467166219f6bf58099326912ddb.zip
x86/cfi: Fix FineIBT hash offset in cfi_get_func_hash()
The switch of the FineIBT preamble from "subl $hash, %r10d" to the shorter "subl $hash, %eax" moved the hash immediate from offset 7 to offset 5 of the preamble. fineibt_preamble_hash was updated to match, but the open-coded offset in cfi_get_func_hash() was missed and it still reads the hash at offset 7. cfi_get_func_hash() is used by the BPF JIT to give a struct_ops trampoline the CFI hash of the stub function it stands in for. With FineIBT the trampoline now gets the upper half of the real hash followed by the first two bytes of the next instruction, so the first indirect call from the kernel into a struct_ops program, tcp_init_congestion_control() calling ->init() of a BPF congestion control for example, fails the FineIBT check and the kernel dies with a CFI failure. Move the FineIBT preamble template and its offset defines above cfi_get_func_hash() and use fineibt_preamble_hash there, so every reader of the preamble shares one definition of its layout. The CFI_FINEIBT arm is only built with CONFIG_FINEIBT, the only configuration in which cfi_mode can take that value. cfi_get_func_arity() does not need the same treatment: the __bhi_args call whose displacement it reads still ends at the function address. Fixes: 85a2d4a890dc ("x86,ibt: Use UDB instead of 0xEA") Assisted-by: LLM Signed-off-by: Soheil Hassas Yeganeh <soheil.kdev@gmail.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: stable@vger.kernel.org # 6.18+ Link: https://patch.msgid.link/20260831-b4-x86-cfi-fineibt-func-hash-v1-1-6ffc0af5c4ec@gmail.com
Diffstat (limited to 'scripts/basic')
0 files changed, 0 insertions, 0 deletions