Bug 1533764 - Microcode procced do not wok
Summary: Microcode procced do not wok
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: microcode_ctl
Version: 27
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Anton Arapov
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-01-12 07:19 UTC by sirjacek
Modified: 2018-03-20 18:21 UTC (History)
4 users (show)

Fixed In Version: microcode_ctl-2.1-22.fc26 microcode_ctl-2.1-22.fc27
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-03-20 17:34:51 UTC
Type: Bug


Attachments (Terms of Use)
IMG1 (30.62 KB, image/png)
2018-03-19 21:51 UTC, ALI-S0
no flags Details
IMG2 (17.80 KB, image/png)
2018-03-19 21:52 UTC, ALI-S0
no flags Details

Description sirjacek 2018-01-12 07:19:46 UTC
Description of problem:
I try update microcode on my fedora27   by 2 methods 
first using dd return "invalid argument"
second method copying uuicode to custom directory and reload microcode by echo 1 and  refresh dracut, after reboot nothing change cersion of microcode is this same . 



Version-Release number of selected component (if applicable):
 cpuinfo version: (3, 3, 0)                      
 Vendor ID: GenuineIntel                         
 Hardware Raw:                                   
 Brand: Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz 
 Hz Advertised: 2.6000 GHz                       
 Hz Actual: 1.3716 GHz                           
 Hz Advertised Raw: (2600000000, 0)              
 Hz Actual Raw: (1371591000, 0)                  
 Arch: X86_64                                    
 Bits: 64                                        
 Count: 4                                        
 Raw Arch String: x86_64                         
 L2 Cache Size: 3072 KB                          
 L2 Cache Line Size:                             
 L2 Cache Associativity:                         
 Stepping: 9                                     
 Model: 58                                       
 Family: 6                                       
 Processor Type:                                 
 Extended Model:                                 
 Extended Family:                                
 Flags: acpi, aes, aperfmperf, apic, arat, arch_perfmon, avx, bts, clflush, 
 cmov, constant_tsc, cpuid, cpuid_fault, cx16, cx8, de, ds_cpl, dtes64, dtherm, 
 dts, epb, ept, erms, est, f16c, flexpriority, fpu, fsgsbase, fxsr, ht, ida, 
 lahf_lm, lm, mca, mce, mmx, monitor, msr, mtrr, nonstop_tsc, nopl, nx, pae, 
 pat, pbe, pcid, pclmulqdq, pdcm, pebs, pge, pln, pni, popcnt, pse, pse36, pti, 
 pts, rdrand, rdtscp, rep_good, sep, smep, smx, ss, sse, sse2, sse4_1, sse4_2, 
 ssse3, syscall, tm, tm2, tpr_shadow, tsc, tsc_deadline_timer, vme, vmx, vnmi, 
 vpid, x2apic, xsave, xsaveopt, xtopology, xtpr                     

________________________________

➜  ~uname -r
 4.15.0-0.rc7.git0.2.dzaczek.fc28.x86_64                                                                                                                                                           
➜  ~ dmesg | grep microcode                                                                                                                                                                       
[    0.639821] microcode: sig=0x306a9, pf=0x10, revision=0x1c                                                                                                                                     
[    0.639911] microcode: Microcode Update Driver: v2.2.                                                                                                                                          

➜  ~ cat /boot/config-4.15.0-0.rc7.git0.2.dzaczek.fc28.x86_64| grep -i microco
CONFIG_MICROCODE=y
CONFIG_MICROCODE_INTEL=y
CONFIG_MICROCODE_AMD=y
CONFIG_MICROCODE_OLD_INTERFACE=y
 



How reproducible:

https://asciinema.org/a/RjoMEywLQdK0p6MUiufRom2u9


Actual results:
first method:

▶ dd if=microcode.dat of=/dev/cpu/microcode bs=1M                                                                                                                                                 
dddd: error writing '/dev/cpu/microcode': Invalid argument                                                                                                                                        
1+0 records in                                                                                                                                                                                    
0+0 records out                                                                                                                                                                                   
0 bytes copied, 0,00122481 s, 0,0 kB/s                                                                                                                                                            
                                        
dmesg: [402.184723] microcode: error! Bad data in microcode data file 

second method:

cp -v intel-ucode/* /lib/firmware/intel-ucode/
echo 1 > /sys/devices/system/cpu/microcode/reload  
dracut -vvf
reboot 


Expected results:
Update microcode 


Additional info:

Comment 1 Anton Arapov 2018-01-12 12:00:57 UTC
Hi,

first method is deprecated, and you can't just dd the microcode. You need a special tool: https://pagure.io/microcode_ctl/blob/master/f/microcode_ctl.c

second method is way to go and you did it properly. 
- echo 1 > /sys/devices/system/cpu/microcode/reload  
reloads microcode without reboot.
NOTE, that it doesn't write anything to dmesg in case there nothing to update. E.g. your cpu was already patched.

- dracut -vvf
puts micrcode into initramfs image, so that you have your cpu load at the early tage.

Details are here: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/x86/microcode.txt


What you want to do is, compare dmesg outputs with and without updated microcode.
- You could get new micrcode with BIOS update, did you do any recently?
- Your cpu might not have any update at all.

Although if you feel that's something is still wrong, attach the output of $ cat /proc/cpuinfo here.

If you are worrying about recent spectre/meltdown security issue, you may find this tool useful:
https://github.com/speed47/spectre-meltdown-checker

Comment 2 Anton Arapov 2018-01-12 12:04:07 UTC
And I don't need cpuinfo, it's already in comment #1, apologize.

Comment 3 sirjacek 2018-01-12 18:59:26 UTC
Hi after copy files do lib/firmware/intel-ucode/ , reload microcode by echo nothing change , dracut and restart nothing change 

 spectre-meltdown-checker.sh shows "Hardware (CPU microcode) support for mitigation:  NO " 
___________________________________________________________________
➜  ~ dmesg | grep microcode
[    0.639821] microcode: sig=0x306a9, pf=0x10, revision=0x1c
[    0.639911] microcode: Microcode Update Driver: v2.2.


➜  ~ sudo sh  spectre-meltdown-checker.sh
Spectre and Meltdown mitigation detection tool v0.17

Checking for vulnerabilities against live running kernel Linux 4.15.0-0.rc7.git0.2.dzaczek.fc28.x86_64 #1 SMP Tue Jan 9 08:56:36 CET 2018 x86_64
Will use vmlinux image /boot/vmlinuz-4.15.0-0.rc7.git0.2.dzaczek.fc28.x86_64
Will use kconfig /boot/config-4.15.0-0.rc7.git0.2.dzaczek.fc28.x86_64
Will use System.map file /boot/System.map-4.15.0-0.rc7.git0.2.dzaczek.fc28.x86_64

CVE-2017-5753 [bounds check bypass] aka 'Spectre Variant 1'
* Kernel compiled with LFENCE opcode inserted at the proper places:  YES  (270 opcodes found, which is >= 70)
> STATUS:  NOT VULNERABLE 

CVE-2017-5715 [branch target injection] aka 'Spectre Variant 2'
* Mitigation 1
*   Hardware (CPU microcode) support for mitigation:  NO 
*   Kernel support for IBRS:  NO 
*   IBRS enabled for Kernel space:  NO 
*   IBRS enabled for User space:  NO 
* Mitigation 2
*   Kernel compiled with retpoline option:  NO 
*   Kernel compiled with a retpoline-aware compiler:  NO 
> STATUS:  VULNERABLE  (IBRS hardware + kernel support OR kernel with retpoline are needed to mitigate the vulnerability)

CVE-2017-5754 [rogue data cache load] aka 'Meltdown' aka 'Variant 3'
* Kernel supports Page Table Isolation (PTI):  YES 
* PTI enabled and active:  YES 
> STATUS:  NOT VULNERABLE  (PTI mitigates the vulnerability)

Comment 4 Anton Arapov 2018-01-15 11:46:29 UTC
It looks fine and safe for today. Not all Spectre fixes have got to the upstream kernel still. The Variant 2 is non-exploitable to date, there are no known exploits afaik. (correct me if I'm wrong)

Comment 5 sirjacek 2018-01-20 13:12:31 UTC
Hi i tied again few times update microcode of my x230 thinkpad  after upgade BIOS to lastest  v 2.7 and  recompile kernel to version 4.15-rc8 or use mainstream kernel from fedora repo .
 Still i cant upgrade microcode to  version 2018. I don have idea what i can do at the moment sent question to "Support Lenovo" or something else ? 


`▶ dmesg | grep micro
[    0.628371] microcode: sig=0x306a9, pf=0x10, revision=0x1c
[    0.628477] microcode: Microcode Update Driver: v2.2.`

Dmidecode:  
https://paste.fedoraproject.org/paste/ZkDAgkJ4GZCXjbJSByoleg

Comment 6 Fedora Update System 2018-03-15 12:16:21 UTC
microcode_ctl-2.1-22.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-5767adea74

Comment 7 Fedora Update System 2018-03-15 12:22:24 UTC
microcode_ctl-2.1-22.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2018-172ca25120

Comment 8 Fedora Update System 2018-03-15 15:58:59 UTC
microcode_ctl-2.1-22.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-172ca25120

Comment 9 Fedora Update System 2018-03-15 16:29:03 UTC
microcode_ctl-2.1-22.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-5767adea74

Comment 10 ALI-S0 2018-03-19 21:51:37 UTC
Created attachment 1410160 [details]
IMG1

Comment 11 ALI-S0 2018-03-19 21:52:56 UTC
Created attachment 1410161 [details]
IMG2

Comment 12 ALI-S0 2018-03-19 21:54:16 UTC
-- Same problem has been detected --

I try to update microcode to latest version, i followed the instructions of Intel to update it.. i get same output of sirjacek@gmail.com.

** SEE ATTACHED IMAGE (IMG1) **

But when I did the following, the microcode was successfully updated

First: I downloaded source code of microcode_ctl from
    -- https://pagure.io/microcode_ctl/blob/master/f/microcode_ctl.c --
and converted it to execution file and copied execution file into microcode file that i was downloaded it 

Second: Write these commands

# ./a.out -f microcode.dat

# sudo cp -r intel-ucode /lib/firmware/

# echo 1 > /sys/devices/system/cpu/microcode/reload

# dracut -vf

# reboot 

After that the microcode was successfully updated 

** SEE ATTACHED IMAGE (IMG2) **

Comment 13 Fedora Update System 2018-03-20 17:34:51 UTC
microcode_ctl-2.1-22.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2018-03-20 18:21:03 UTC
microcode_ctl-2.1-22.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.