ibrs: check for spec_ctrl_ibrs in cpuinfo

This commit is contained in:
Stéphane Lesimple 2018-01-14 16:36:51 +01:00
parent 749f432d32
commit 71213c11b3
1 changed files with 19 additions and 3 deletions

View File

@ -728,10 +728,14 @@ check_variant2()
# hardware support according to kernel
if [ "$opt_verbose" -ge 2 ]; then
_verbose_nol "* The kernel has set the spec_ctrl flag in cpuinfo: "
if grep -qw spec_ctrl /proc/cpuinfo; then
pstatus green YES
if [ "$opt_live" = 1 ]; then
if grep -qw spec_ctrl /proc/cpuinfo; then
pstatus green YES
else
pstatus red NO
fi
else
pstatus red NO
pstatus blue N/A "not testable in offline mode"
fi
fi
@ -756,6 +760,18 @@ check_variant2()
_debug "ibrs: file $ibrs_file doesn't exist"
fi
done
# on some newer kernels, the spec_ctrl_ibrs flag in /proc/cpuinfo
# is set when ibrs has been administratively enabled (usually from cmdline)
# which in that case means ibrs is supported *and* enabled for kernel & user
# as per the ibrs patch series v3
if [ "$ibrs_supported" = 0 ]; then
if grep -qw spec_ctrl_ibrs /proc/cpuinfo; then
_debug "ibrs: found spec_ctrl_ibrs flag in /proc/cpuinfo"
ibrs_supported=1
# enabled=2 -> kernel & user
ibrs_enabled=2
fi
fi
fi
if [ "$ibrs_supported" != 1 -a -n "$opt_map" ]; then
if grep -q spec_ctrl "$opt_map"; then