Fix: Disable IBT around indirect function calls
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 8 Jan 2024 18:31:04 +0000 (13:31 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 9 Jan 2024 16:26:03 +0000 (11:26 -0500)
commit41cbf57593c868985ccdcd0a79bdde8f54b8d67e
tree0b70b44120128cadc87ac1fd9cdcd410f4d725e9
parent7f1fa63204f0607ae82ac90cdd5de3f8f33612d5
Fix: Disable IBT around indirect function calls

When the Intel IBT feature is enabled, a CPU supporting this feature
validates that all indirect jumps/calls land on an ENDBR64 instruction.

The kernel seals functions which are not meant to be called indirectly,
which means that calling functions indirectly from their address fetched
using kallsyms or kprobes trigger a crash.

Use the MSR_IA32_S_CET CET_ENDBR_EN MSR bit to temporarily disable ENDBR
validation around indirect calls to kernel functions. Considering that
the main purpose of this feature is to prevent ROP-style attacks,
disabling the ENDBR validation temporarily around the call from a kernel
module does not affect the ROP protection.

Fixes #1408
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I97f5d8efce093c1e956cede1f44de2fcebf30227
include/wrapper/ibt.h [new file with mode: 0644]
include/wrapper/kallsyms.h
src/lttng-context-callstack-legacy-impl.h
src/lttng-context-callstack-stackwalk-impl.h
src/wrapper/irqdesc.c
src/wrapper/kallsyms.c
src/wrapper/page_alloc.c
This page took 0.027267 seconds and 4 git commands to generate.