]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - arch/x86/kernel/cpu/bugs.c
x86/bugs: Do not enable IBPB-on-entry when IBPB is not supported
[mirror_ubuntu-jammy-kernel.git] / arch / x86 / kernel / cpu / bugs.c
index d7bc563136e9fd1a9156066bbb4a641c66d4ad92..e068caeb1b1d80605c0e3e050a54f435f80ffd8c 100644 (file)
@@ -858,7 +858,10 @@ static void __init retbleed_select_mitigation(void)
                break;
 
        case RETBLEED_CMD_IBPB:
-               if (IS_ENABLED(CONFIG_CPU_IBPB_ENTRY)) {
+               if (!boot_cpu_has(X86_FEATURE_IBPB)) {
+                       pr_err("WARNING: CPU does not support IBPB.\n");
+                       goto do_cmd_auto;
+               } else if (IS_ENABLED(CONFIG_CPU_IBPB_ENTRY)) {
                        retbleed_mitigation = RETBLEED_MITIGATION_IBPB;
                } else {
                        pr_err("WARNING: kernel not compiled with CPU_IBPB_ENTRY.\n");
@@ -873,7 +876,7 @@ do_cmd_auto:
                    boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
                        if (IS_ENABLED(CONFIG_CPU_UNRET_ENTRY))
                                retbleed_mitigation = RETBLEED_MITIGATION_UNRET;
-                       else if (IS_ENABLED(CONFIG_CPU_IBPB_ENTRY))
+                       else if (IS_ENABLED(CONFIG_CPU_IBPB_ENTRY) && boot_cpu_has(X86_FEATURE_IBPB))
                                retbleed_mitigation = RETBLEED_MITIGATION_IBPB;
                }