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
1350 If you select this option, microcode patch loading support for AMD1350 If you select this option, microcode patch loading support for AMD
1351 processors will be enabled.1351 processors will be enabled.
1352 1352
1353config 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
1353config X86_MSR1364config X86_MSR
1354 tristate "/dev/cpu/*/msr - Model-specific register support"1365 tristate "/dev/cpu/*/msr - Model-specific register support"
1355 help1366 help
arch/x86/kernel/cpu/common.c+2−0
@@ -2222,6 +2222,7 @@ void cpu_init_secondary(void) · 2221 unmodified lines
2222}2222}
2223#endif2223#endif
2224 2224
2225#ifdef CONFIG_MICROCODE_LATE_LOADING
2225/*2226/*
2226 * The microcode loader calls this upon late microcode load to recheck features,2227 * The microcode loader calls this upon late microcode load to recheck features,
2227 * only when microcode has been updated. Caller holds microcode_mutex and CPU2228 * only when microcode has been updated. Caller holds microcode_mutex and CPU
@@ -2251,6 +2252,7 @@ void microcode_check(void) · 23 unmodified lines
2251 pr_warn("x86/CPU: CPU features have changed after loading microcode, but might not take effect.\n");2252 pr_warn("x86/CPU: CPU features have changed after loading microcode, but might not take effect.\n");
2252 pr_warn("x86/CPU: Please consider either early loading through initrd/built-in or a potential BIOS update.\n");2253 pr_warn("x86/CPU: Please consider either early loading through initrd/built-in or a potential BIOS update.\n");
2253}2254}
2255#endif
2254 2256
2255/*2257/*
2256 * Invoked from core CPU hotplug code after hotplug operations2258 * 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
376/* fake device for request_firmware */376/* fake device for request_firmware */
377static struct platform_device *microcode_pdev;377static struct platform_device *microcode_pdev;
378 378
379#ifdef CONFIG_MICROCODE_LATE_LOADING
379/*380/*
380 * Late loading dance. Why the heavy-handed stomp_machine effort?381 * Late loading dance. Why the heavy-handed stomp_machine effort?
381 *382 *
@@ -543,6 +544,9 @@ put: · 161 unmodified lines
543 return ret;544 return ret;
544}545}
545 546
547static DEVICE_ATTR_WO(reload);
548#endif
549
546static ssize_t version_show(struct device *dev,550static ssize_t version_show(struct device *dev,
547 struct device_attribute *attr, char *buf)551 struct device_attribute *attr, char *buf)
548{552{
@@ -559,7 +563,6 @@ static ssize_t pf_show(struct device *dev, · 10 unmodified lines
559 return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);563 return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
560}564}
561 565
562static DEVICE_ATTR_WO(reload);
563static DEVICE_ATTR(version, 0444, version_show, NULL);566static DEVICE_ATTR(version, 0444, version_show, NULL);
564static DEVICE_ATTR(processor_flags, 0444, pf_show, NULL);567static DEVICE_ATTR(processor_flags, 0444, pf_show, NULL);
565 568
@@ -712,7 +715,9 @@ static int mc_cpu_down_prep(unsigned int cpu) · 146 unmodified lines
712}715}
713 716
714static struct attribute *cpu_root_microcode_attrs[] = {717static struct attribute *cpu_root_microcode_attrs[] = {
718#ifdef CONFIG_MICROCODE_LATE_LOADING
715 &dev_attr_reload.attr,719 &dev_attr_reload.attr,
720#endif
716 NULL721 NULL
717};722};
718 723

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