KSPP / linux

Linux kernel source tree (Kernel Self Protection Project)
https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project
Other
82 stars 5 forks source link

Make SCS and PAC selectable at runtime #168

Closed kees closed 1 month ago

kees commented 3 years ago

Not all arm64 devices support PAC, so for a distro or GKI kernel, there needs to be a way to dynamically select SCS or PAC at runtime so there is no redundant work happening in the PAC case.

objtool appears to be overkill for finding all the PAC/SCS instrumentation points, so a better approach is needed: https://lore.kernel.org/lkml/CAMj1kXF31FxCTbo4M8MX0aaegaq7AQXMUdCtsm6xrKUFSpkzjA@mail.gmail.com/

kees commented 3 years ago

cc @ardbiesheuvel

ardbiesheuvel commented 3 years ago

https://lore.kernel.org/all/20211013152243.2216899-1-ardb@kernel.org/

ardbiesheuvel commented 2 years ago

RFCv2 sent to the list

https://lore.kernel.org/linux-arm-kernel/20220505161011.1801596-1-ardb@kernel.org/

This version is Clang only for the moment, as GCC has a DWARF generation issue where the CFI annotation is emitted for the wrong instruction. Other than that, the implementation is mostly complete, in the sense that it applies to both the core kernel and loadable modules, and that it checks PAC/BTI h/w support first, and gives up if either is supported (PAC makes SCS redundant, and BTI conflicts with code patching, as the PACIASP instruction is also a landing pad, and therefore needs to be retained)

kees commented 1 month ago

CONFIG_DYNAMIC_SCS via commit 9beccca0984022a844850e32f0d7dd80d4a225de