Pull more x86 updates from Borislav Petkov: - Remove a bunch of asm implementing condition flags testing in KVM's emulator in favor of int3_emulate_jcc() which is written in C - Replace KVM fastops with C-based stubs which avoids problems with the fastop infra related to latter not adhering to the C ABI due to their special calling convention and, more importantly, bypassing compiler control-flow integrity checking because they're written in asm - Remove wrongly used static branches and other ugliness accumulated over time in hyperv's hypercall implementation with a proper static function call to the correct hypervisor call variant - Add some fixes and modifications to allow running FRED-enabled kernels in KVM even on non-FRED hardware - Add kCFI improvements like validating indirect calls and prepare for enabling kCFI with GCC. Add cmdline params documentation and other code cleanups - Use the single-byte 0xd6 insn as the official #UD single-byte undefined opcode instruction as agreed upon by both x86 vendors - Other smaller cleanups and touchups all over the place * tag 'x86_core_for_v6.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits) x86,retpoline: Optimize patch_retpoline() x86,ibt: Use UDB instead of 0xEA x86/cfi: Remove __noinitretpoline and __noretpoline x86/cfi: Add "debug" option to "cfi=" bootparam x86/cfi: Standardize on common "CFI:" prefix for CFI reports x86/cfi: Document the "cfi=" bootparam options x86/traps: Clarify KCFI instruction layout compiler_types.h: Move __nocfi out of compiler-specific header objtool: Validate kCFI calls x86/fred: KVM: VMX: Always use FRED for IRQs when CONFIG_X86_FRED=y x86/fred: Play nice with invoking asm_fred_entry_from_kvm() on non-FRED hardware x86/fred: Install system vector handlers even if FRED isn't fully enabled x86/hyperv: Use direct call to hypercall-page x86/hyperv: Clean up hv_do_hypercall() KVM: x86: Remove fastops KVM: x86: Convert em_salc() to C KVM: x86: Introduce EM_ASM_3WCL KVM: x86: Introduce EM_ASM_1SRC2 KVM: x86: Introduce EM_ASM_2CL KVM: x86: Introduce EM_ASM_2W ...
Showing the changes to include/linux (6 of 36 files). Show all
Unified · Split
| @@ -115,11 +115,6 @@ · 114 unmodified lines | ||
| 115 | 115 | # define __noscs __attribute__((__no_sanitize__("shadow-call-stack"))) |
| 116 | 116 | #endif |
| 117 | 117 | |
| 118 | −#if __has_feature(kcfi) | |
| 119 | −/* Disable CFI checking inside a function. */ | |
| 120 | −#define __nocfi __attribute__((__no_sanitize__("kcfi"))) | |
| 121 | −#endif | |
| 122 | − | |
| 123 | 118 | /* |
| 124 | 119 | * Turn individual warnings and errors on and off locally, depending |
| 125 | 120 | * on version. |
| @@ -35,10 +35,6 @@ · 34 unmodified lines | ||
| 35 | 35 | (typeof(ptr)) (__ptr + (off)); \ |
| 36 | 36 | }) |
| 37 | 37 | |
| 38 | −#ifdef CONFIG_MITIGATION_RETPOLINE | |
| 39 | −#define __noretpoline __attribute__((__indirect_branch__("keep"))) | |
| 40 | −#endif | |
| 41 | − | |
| 42 | 38 | #if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__) |
| 43 | 39 | #define __latent_entropy __attribute__((latent_entropy)) |
| 44 | 40 | #endif |
| @@ -455,7 +455,9 @@ struct ftrace_likely_data { · 454 unmodified lines | ||
| 455 | 455 | # define __noscs |
| 456 | 456 | #endif |
| 457 | 457 | |
| 458 | −#ifndef __nocfi | |
| 458 | +#if defined(CONFIG_CFI) | |
| 459 | +# define __nocfi __attribute__((__no_sanitize__("kcfi"))) | |
| 460 | +#else | |
| 459 | 461 | # define __nocfi |
| 460 | 462 | #endif |
| 461 | 463 | |
| @@ -7,13 +7,6 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <linux/stringify.h> |
| 8 | 8 | #include <linux/types.h> |
| 9 | 9 | |
| 10 | −/* Built-in __init functions needn't be compiled with retpoline */ | |
| 11 | −#if defined(__noretpoline) && !defined(MODULE) | |
| 12 | −#define __noinitretpoline __noretpoline | |
| 13 | −#else | |
| 14 | −#define __noinitretpoline | |
| 15 | −#endif | |
| 16 | − | |
| 17 | 10 | /* These macros are used to mark some functions or |
| 18 | 11 | * initialized data (doesn't apply to uninitialized data) |
| 19 | 12 | * as `initialization' functions. The kernel can take this |
| @@ -50,7 +43,6 @@ · 30 unmodified lines | ||
| 50 | 43 | /* These are for everybody (although not all archs will actually |
| 51 | 44 | discard it in modules) */ |
| 52 | 45 | #define __init __section(".init.text") __cold __latent_entropy \ |
| 53 | − __noinitretpoline \ | |
| 54 | 46 | __no_kstack_erase |
| 55 | 47 | #define __initdata __section(".init.data") |
| 56 | 48 | #define __initconst __section(".init.rodata") |
| @@ -184,6 +184,15 @@ · 183 unmodified lines | ||
| 184 | 184 | * WARN using UD2. |
| 185 | 185 | */ |
| 186 | 186 | #define ANNOTATE_REACHABLE(label) __ASM_ANNOTATE(label, ANNOTYPE_REACHABLE) |
| 187 | +/* | |
| 188 | + * This should not be used; it annotates away CFI violations. There are a few | |
| 189 | + * valid use cases like kexec handover to the next kernel image, and there is | |
| 190 | + * no security concern there. | |
| 191 | + * | |
| 192 | + * There are also a few real issues annotated away, like EFI because we can't | |
| 193 | + * control the EFI code. | |
| 194 | + */ | |
| 195 | +#define ANNOTATE_NOCFI_SYM(sym) asm(__ASM_ANNOTATE(sym, ANNOTYPE_NOCFI)) | |
| 187 | 196 | |
| 188 | 197 | #else |
| 189 | 198 | #define ANNOTATE_NOENDBR ANNOTATE type=ANNOTYPE_NOENDBR |
| @@ -194,6 +203,7 @@ · 4 unmodified lines | ||
| 194 | 203 | #define ANNOTATE_INTRA_FUNCTION_CALL ANNOTATE type=ANNOTYPE_INTRA_FUNCTION_CALL |
| 195 | 204 | #define ANNOTATE_UNRET_BEGIN ANNOTATE type=ANNOTYPE_UNRET_BEGIN |
| 196 | 205 | #define ANNOTATE_REACHABLE ANNOTATE type=ANNOTYPE_REACHABLE |
| 206 | +#define ANNOTATE_NOCFI_SYM ANNOTATE type=ANNOTYPE_NOCFI | |
| 197 | 207 | #endif |
| 198 | 208 | |
| 199 | 209 | #if defined(CONFIG_NOINSTR_VALIDATION) && \ |
| @@ -65,5 +65,6 @@ struct unwind_hint { · 64 unmodified lines | ||
| 65 | 65 | #define ANNOTYPE_IGNORE_ALTS 6 |
| 66 | 66 | #define ANNOTYPE_INTRA_FUNCTION_CALL 7 |
| 67 | 67 | #define ANNOTYPE_REACHABLE 8 |
| 68 | +#define ANNOTYPE_NOCFI 9 | |
| 68 | 69 | |
| 69 | 70 | #endif /* _LINUX_OBJTOOL_TYPES_H */ |