Pull x86 CET-IBT (Control-Flow-Integrity) support from Peter Zijlstra: "Add support for Intel CET-IBT, available since Tigerlake (11th gen), which is a coarse grained, hardware based, forward edge Control-Flow-Integrity mechanism where any indirect CALL/JMP must target an ENDBR instruction or suffer #CP. Additionally, since Alderlake (12th gen)/Sapphire-Rapids, speculation is limited to 2 instructions (and typically fewer) on branch targets not starting with ENDBR. CET-IBT also limits speculation of the next sequential instruction after the indirect CALL/JMP [1]. CET-IBT is fundamentally incompatible with retpolines, but provides, as described above, speculation limits itself" [1] https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/technical-documentation/branch-history-injection.html * tag 'x86_core_for_5.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (53 commits) kvm/emulate: Fix SETcc emulation for ENDBR x86/Kconfig: Only allow CONFIG_X86_KERNEL_IBT with ld.lld >= 14.0.0 x86/Kconfig: Only enable CONFIG_CC_HAS_IBT for clang >= 14.0.0 kbuild: Fixup the IBT kbuild changes x86/Kconfig: Do not allow CONFIG_X86_X32_ABI=y with llvm-objcopy x86: Remove toolchain check for X32 ABI capability x86/alternative: Use .ibt_endbr_seal to seal indirect calls objtool: Find unused ENDBR instructions objtool: Validate IBT assumptions objtool: Add IBT/ENDBR decoding objtool: Read the NOENDBR annotation x86: Annotate idtentry_df() x86,objtool: Move the ASM_REACHABLE annotation to objtool.h x86: Annotate call_on_stack() objtool: Rework ASM_REACHABLE x86: Mark __invalid_creds() __noreturn exit: Mark do_group_exit() __noreturn x86: Mark stop_this_cpu() __noreturn objtool: Ignore extra-symbol code objtool: Rename --duplicate to --lto ...
Showing the changes to kernel/livepatch (1 of 95 files). Show all
Unified · Split
| @@ -124,19 +124,6 @@ unlock: · 123 unmodified lines | ||
| 124 | 124 | ftrace_test_recursion_unlock(bit); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | −/* | |
| 128 | − * Convert a function address into the appropriate ftrace location. | |
| 129 | − * | |
| 130 | − * Usually this is just the address of the function, but on some architectures | |
| 131 | − * it's more complicated so allow them to provide a custom behaviour. | |
| 132 | − */ | |
| 133 | −#ifndef klp_get_ftrace_location | |
| 134 | −static unsigned long klp_get_ftrace_location(unsigned long faddr) | |
| 135 | −{ | |
| 136 | − return faddr; | |
| 137 | −} | |
| 138 | −#endif | |
| 139 | − | |
| 140 | 127 | static void klp_unpatch_func(struct klp_func *func) |
| 141 | 128 | { |
| 142 | 129 | struct klp_ops *ops; |
| @@ -153,8 +140,7 @@ static void klp_unpatch_func(struct klp_func *func) · 10 unmodified lines | ||
| 153 | 140 | if (list_is_singular(&ops->func_stack)) { |
| 154 | 141 | unsigned long ftrace_loc; |
| 155 | 142 | |
| 156 | − ftrace_loc = | |
| 157 | − klp_get_ftrace_location((unsigned long)func->old_func); | |
| 143 | + ftrace_loc = ftrace_location((unsigned long)func->old_func); | |
| 158 | 144 | if (WARN_ON(!ftrace_loc)) |
| 159 | 145 | return; |
| 160 | 146 | |
| @@ -186,8 +172,7 @@ static int klp_patch_func(struct klp_func *func) · 25 unmodified lines | ||
| 186 | 172 | if (!ops) { |
| 187 | 173 | unsigned long ftrace_loc; |
| 188 | 174 | |
| 189 | − ftrace_loc = | |
| 190 | − klp_get_ftrace_location((unsigned long)func->old_func); | |
| 175 | + ftrace_loc = ftrace_location((unsigned long)func->old_func); | |
| 191 | 176 | if (!ftrace_loc) { |
| 192 | 177 | pr_err("failed to find location for function '%s'\n", |
| 193 | 178 | func->old_name); |