Commit 1a371e6
x86/microcode/intel: Check patch signature before saving microcode for early loading
Currently, scan_microcode() leverages microcode_matches() to check
if the microcode matches the CPU by comparing the family and model.
However, the processor stepping and flags of the microcode signature
should also be considered when saving a microcode patch for early
update.
Use find_matching_signature() in scan_microcode() and get rid of the
now-unused microcode_matches() which is a good cleanup in itself.
Complete the verification of the patch being saved for early loading in
save_microcode_patch() directly. This needs to be done there too because
save_mc_for_early() will call save_microcode_patch() too.
The second reason why this needs to be done is because the loader still
tries to support, at least hypothetically, mixed-steppings systems and
thus adds all patches to the cache that belong to the same CPU model
albeit with different steppings.
For example:
microcode: CPU: sig=0x906ec, pf=0x2, rev=0xd6
microcode: mc_saved[0]: sig=0x906e9, pf=0x2a, rev=0xd6, total size=0x19400, date = 2020-04-23
microcode: mc_saved[1]: sig=0x906ea, pf=0x22, rev=0xd6, total size=0x19000, date = 2020-04-27
microcode: mc_saved[2]: sig=0x906eb, pf=0x2, rev=0xd6, total size=0x19400, date = 2020-04-23
microcode: mc_saved[3]: sig=0x906ec, pf=0x22, rev=0xd6, total size=0x19000, date = 2020-04-27
microcode: mc_saved[4]: sig=0x906ed, pf=0x22, rev=0xd6, total size=0x19400, date = 2020-04-23
The patch which is being saved for early loading, however, can only be
the one which fits the CPU this runs on so do the signature verification
before saving.
[ bp: Do signature verification in save_microcode_patch()
and rewrite commit message. ]
Fixes: ec400dd ("x86/microcode_intel_early.c: Early update ucode on Intel's CPU")
Signed-off-by: Chen Yu <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Cc: [email protected]
Link: https://bugzilla.kernel.org/show_bug.cgi?id=208535
Link: https://lkml.kernel.org/r/[email protected]1 parent 8986f22 commit 1a371e6
1 file changed
+10
-53
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | 103 | | |
151 | 104 | | |
152 | 105 | | |
| |||
164 | 117 | | |
165 | 118 | | |
166 | 119 | | |
167 | | - | |
| 120 | + | |
168 | 121 | | |
169 | 122 | | |
170 | 123 | | |
| |||
210 | 163 | | |
211 | 164 | | |
212 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
213 | 169 | | |
214 | 170 | | |
215 | 171 | | |
| |||
344 | 300 | | |
345 | 301 | | |
346 | 302 | | |
347 | | - | |
| 303 | + | |
| 304 | + | |
348 | 305 | | |
349 | 306 | | |
350 | 307 | | |
351 | 308 | | |
352 | 309 | | |
353 | | - | |
| 310 | + | |
354 | 311 | | |
355 | 312 | | |
356 | 313 | | |
| |||
483 | 440 | | |
484 | 441 | | |
485 | 442 | | |
486 | | - | |
| 443 | + | |
487 | 444 | | |
488 | 445 | | |
489 | 446 | | |
490 | 447 | | |
491 | 448 | | |
492 | 449 | | |
493 | | - | |
| 450 | + | |
494 | 451 | | |
495 | 452 | | |
496 | 453 | | |
| |||
935 | 892 | | |
936 | 893 | | |
937 | 894 | | |
938 | | - | |
| 895 | + | |
939 | 896 | | |
940 | 897 | | |
941 | 898 | | |
| |||
0 commit comments