also check for cpuinfo flag

This commit is contained in:
Stéphane Lesimple 2018-01-14 15:28:53 +01:00
parent c483a2cf60
commit a422b53d7c
1 changed files with 8 additions and 8 deletions

View File

@ -664,7 +664,7 @@ check_variant2()
sys_interface_available=1 sys_interface_available=1
else else
_info "* Mitigation 1" _info "* Mitigation 1"
_info_nol "* Hardware / CPU microcode support for mitigation (SPEC_CTRL MSR): " _info_nol "* Hardware (CPU microcode) support for mitigation [SPEC_CTRL MSR]: "
if [ ! -e /dev/cpu/0/msr ]; then if [ ! -e /dev/cpu/0/msr ]; then
# try to load the module ourselves (and remember it so we can rmmod it afterwards) # try to load the module ourselves (and remember it so we can rmmod it afterwards)
modprobe msr 2>/dev/null && insmod_msr=1 modprobe msr 2>/dev/null && insmod_msr=1
@ -691,8 +691,7 @@ check_variant2()
fi fi
# CPUID test # CPUID test
_info_nol "* Hardware / CPU microcode support for mitigation (CPUID bit): " _info_nol "* Hardware (CPU microcode) support for mitigation [CPUID bit]: "
# $(dd if=/dev/cpu/0/cpuid bs=16 skip=7 iflag=skip_bytes count=1 2>/dev/null | dd bs=1 skip=15 count=1 2>/dev/null | od -t u -A n | awk '{print $1}'); echo $z; echo $(($z & 32))
if [ ! -e /dev/cpu/0/cpuid ]; then if [ ! -e /dev/cpu/0/cpuid ]; then
# try to load the module ourselves (and remember it so we can rmmod it afterwards) # try to load the module ourselves (and remember it so we can rmmod it afterwards)
modprobe cpuid 2>/dev/null && insmod_cpuid=1 modprobe cpuid 2>/dev/null && insmod_cpuid=1
@ -720,12 +719,13 @@ check_variant2()
fi fi
fi fi
if [ "$insmod_cpuid" = 1 ]; then # hardware support according to kernel
# if we used modprobe ourselves, rmmod the module _info_nol "* Hardware (CPU microcode) support for mitigation [cpuinfo flag]: "
rmmod cpuid 2>/dev/null if grep -qw spec_ctrl /proc/cpuinfo; then
_debug "attempted to unload module cpuid, ret=$?" pstatus green YES
else
pstatus red NO
fi fi
# /CPUID test
_info_nol "* Kernel support for IBRS: " _info_nol "* Kernel support for IBRS: "
if [ "$opt_live" = 1 ]; then if [ "$opt_live" = 1 ]; then