also check for spec_ctrl flag in cpuinfo

This commit is contained in:
Stéphane Lesimple 2018-01-14 15:44:11 +01:00
parent a422b53d7c
commit 749f432d32
1 changed files with 15 additions and 7 deletions

View File

@ -142,6 +142,11 @@ _verbose()
_echo 2 "$@" _echo 2 "$@"
} }
_verbose_nol()
{
_echo_nol 2 "$@"
}
_debug() _debug()
{ {
_echo 3 "\033[34m(debug) $@\033[0m" _echo 3 "\033[34m(debug) $@\033[0m"
@ -664,7 +669,8 @@ 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 "* Hardware (CPU microcode) support for mitigation"
_info_nol "* The SPEC_CTRL MSR is available: "
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,7 +697,7 @@ check_variant2()
fi fi
# CPUID test # CPUID test
_info_nol "* Hardware (CPU microcode) support for mitigation [CPUID bit]: " _info_nol "* The SPEC_CTRL CPUID feature bit is set: "
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,11 +726,13 @@ check_variant2()
fi fi
# hardware support according to kernel # hardware support according to kernel
_info_nol "* Hardware (CPU microcode) support for mitigation [cpuinfo flag]: " if [ "$opt_verbose" -ge 2 ]; then
if grep -qw spec_ctrl /proc/cpuinfo; then _verbose_nol "* The kernel has set the spec_ctrl flag in cpuinfo: "
pstatus green YES if grep -qw spec_ctrl /proc/cpuinfo; then
else pstatus green YES
pstatus red NO else
pstatus red NO
fi
fi fi
_info_nol "* Kernel support for IBRS: " _info_nol "* Kernel support for IBRS: "