Files
linux/kernel
Deepak Gupta 5ca243f6e3 prctl: add arch-agnostic prctl()s for indirect branch tracking
Three architectures (x86, aarch64, riscv) have support for indirect
branch tracking feature in a very similar fashion. On a very high
level, indirect branch tracking is a CPU feature where CPU tracks
branches which use a memory operand to transfer control. As part of
this tracking, during an indirect branch, the CPU expects a landing
pad instruction on the target PC, and if not found, the CPU raises
some fault (architecture-dependent).

x86 landing pad instr - 'ENDBRANCH'
arch64 landing pad instr - 'BTI'
riscv landing instr - 'lpad'

Given that three major architectures have support for indirect branch
tracking, this patch creates architecture-agnostic 'prctls' to allow
userspace to control this feature.  They are:
 - PR_GET_INDIR_BR_LP_STATUS: Get the current configured status for indirect
   branch tracking.
 - PR_SET_INDIR_BR_LP_STATUS: Set the configuration for indirect branch
   tracking.
   The following status options are allowed:
       - PR_INDIR_BR_LP_ENABLE: Enables indirect branch tracking on user
         thread.
       - PR_INDIR_BR_LP_DISABLE: Disables indirect branch tracking on user
         thread.
 - PR_LOCK_INDIR_BR_LP_STATUS: Locks configured status for indirect branch
   tracking for user thread.

Reviewed-by: Mark Brown <[email protected]>
Reviewed-by: Zong Li <[email protected]>
Signed-off-by: Deepak Gupta <[email protected]>
Tested-by: Andreas Korb <[email protected]> # QEMU, custom CVA6
Tested-by: Valentin Haudiquet <[email protected]>
Link: https://patch.msgid.link/[email protected]
[[email protected]: cleaned up patch description, code comments]
Signed-off-by: Paul Walmsley <[email protected]>
2026-01-29 02:36:32 -07:00
..
2025-11-09 21:19:44 -08:00
2026-01-11 06:09:11 -10:00
2026-01-16 16:16:24 +01:00
…
…
…
…
…
…
…
2025-11-11 10:01:31 +01:00
2025-11-14 18:15:49 +08:00
…
2025-11-04 08:30:50 +01:00
…
…
…
2025-10-29 10:29:54 +01:00
2024-11-03 01:28:06 -05:00
…
…
…