@@ -441,21 +441,21 @@ static void __init setup_cr_pinning(void)
441
441
static_key_enable (& cr_pinning .key );
442
442
}
443
443
444
- /*
445
- * Temporary hack: FSGSBASE is unsafe until a few kernel code paths are
446
- * updated. This allows us to get the kernel ready incrementally.
447
- *
448
- * Once all the pieces are in place, these will go away and be replaced with
449
- * a nofsgsbase chicken flag.
450
- */
451
- static bool unsafe_fsgsbase ;
452
-
453
- static __init int setup_unsafe_fsgsbase (char * arg )
444
+ static __init int x86_nofsgsbase_setup (char * arg )
454
445
{
455
- unsafe_fsgsbase = true;
446
+ /* Require an exact match without trailing characters. */
447
+ if (strlen (arg ))
448
+ return 0 ;
449
+
450
+ /* Do not emit a message if the feature is not present. */
451
+ if (!boot_cpu_has (X86_FEATURE_FSGSBASE ))
452
+ return 1 ;
453
+
454
+ setup_clear_cpu_cap (X86_FEATURE_FSGSBASE );
455
+ pr_info ("FSGSBASE disabled via kernel command line\n" );
456
456
return 1 ;
457
457
}
458
- __setup ("unsafe_fsgsbase " , setup_unsafe_fsgsbase );
458
+ __setup ("nofsgsbase " , x86_nofsgsbase_setup );
459
459
460
460
/*
461
461
* Protection Keys are not available in 32-bit mode.
@@ -1512,12 +1512,8 @@ static void identify_cpu(struct cpuinfo_x86 *c)
1512
1512
setup_umip (c );
1513
1513
1514
1514
/* Enable FSGSBASE instructions if available. */
1515
- if (cpu_has (c , X86_FEATURE_FSGSBASE )) {
1516
- if (unsafe_fsgsbase )
1517
- cr4_set_bits (X86_CR4_FSGSBASE );
1518
- else
1519
- clear_cpu_cap (c , X86_FEATURE_FSGSBASE );
1520
- }
1515
+ if (cpu_has (c , X86_FEATURE_FSGSBASE ))
1516
+ cr4_set_bits (X86_CR4_FSGSBASE );
1521
1517
1522
1518
/*
1523
1519
* The vendor-specific functions might have changed features.
0 commit comments