History

x86/microcode: Default-disable late loading

It is dangerous and it should not be used anyway - there's a nice early loading already.

Borislav Petkov committed 4 years ago

Commit a77a94f1 parent 181b6f43 files · +19 −1Browse files

Unified · Split

3 files
  1. arch/x86/Kconfig +11 −0
  2. arch/x86/kernel/cpu/common.c +2 −0
  3. arch/x86/kernel/cpu/microcode/core.c +6 −1
arch/x86/Kconfig+11−0
@@ -1350,6 +1350,17 @@ config MICROCODE_AMD · 1349 unmodified lines
13501350 If you select this option, microcode patch loading support for AMD
13511351 processors will be enabled.
13521352
1353+config MICROCODE_LATE_LOADING
1354+ bool "Late microcode loading (DANGEROUS)"
1355+ default n
1356+ depends on MICROCODE
1357+ help
1358+ Loading microcode late, when the system is up and executing instructions
1359+ is a tricky business and should be avoided if possible. Just the sequence
1360+ of synchronizing all cores and SMT threads is one fragile dance which does
1361+ not guarantee that cores might not softlock after the loading. Therefore,
1362+ use this at your own risk. Late loading taints the kernel too.
1363+
13531364 config X86_MSR
13541365 tristate "/dev/cpu/*/msr - Model-specific register support"
13551366 help
arch/x86/kernel/cpu/common.c+2−0
@@ -2222,6 +2222,7 @@ void cpu_init_secondary(void) · 2221 unmodified lines
22222222 }
22232223 #endif
22242224
2225+#ifdef CONFIG_MICROCODE_LATE_LOADING
22252226 /*
22262227 * The microcode loader calls this upon late microcode load to recheck features,
22272228 * only when microcode has been updated. Caller holds microcode_mutex and CPU
@@ -2251,6 +2252,7 @@ void microcode_check(void) · 23 unmodified lines
22512252 pr_warn("x86/CPU: CPU features have changed after loading microcode, but might not take effect.\n");
22522253 pr_warn("x86/CPU: Please consider either early loading through initrd/built-in or a potential BIOS update.\n");
22532254 }
2255+#endif
22542256
22552257 /*
22562258 * Invoked from core CPU hotplug code after hotplug operations
arch/x86/kernel/cpu/microcode/core.c+6−1
@@ -376,6 +376,7 @@ static int apply_microcode_on_target(int cpu) · 375 unmodified lines
376376 /* fake device for request_firmware */
377377 static struct platform_device *microcode_pdev;
378378
379+#ifdef CONFIG_MICROCODE_LATE_LOADING
379380 /*
380381 * Late loading dance. Why the heavy-handed stomp_machine effort?
381382 *
@@ -543,6 +544,9 @@ put: · 161 unmodified lines
543544 return ret;
544545 }
545546
547+static DEVICE_ATTR_WO(reload);
548+#endif
549+
546550 static ssize_t version_show(struct device *dev,
547551 struct device_attribute *attr, char *buf)
548552 {
@@ -559,7 +563,6 @@ static ssize_t pf_show(struct device *dev, · 10 unmodified lines
559563 return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
560564 }
561565
562−static DEVICE_ATTR_WO(reload);
563566 static DEVICE_ATTR(version, 0444, version_show, NULL);
564567 static DEVICE_ATTR(processor_flags, 0444, pf_show, NULL);
565568
@@ -712,7 +715,9 @@ static int mc_cpu_down_prep(unsigned int cpu) · 146 unmodified lines
712715 }
713716
714717 static struct attribute *cpu_root_microcode_attrs[] = {
718+#ifdef CONFIG_MICROCODE_LATE_LOADING
715719 &dev_attr_reload.attr,
720+#endif
716721 NULL
717722 };
718723

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t