L1TF/Linux: detect SMT via sysfs
We can figure out whether SMT is enabled or not, by checking the topology of the CPUs, as it is exposed in /sys. This means the information is available also when we are running in `--sysfs-only` mode.
This commit is contained in:
parent
26a5fe018a
commit
e1a2cae2c0
|
@ -3932,16 +3932,25 @@ check_CVE_2018_3646_linux()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
smt_enabled=-1
|
smt_enabled=-1
|
||||||
if [ "$opt_sysfs_only" != 1 ]; then
|
_info_nol " * Hyper-Threading (SMT) is enabled: "
|
||||||
_info_nol " * Hyper-Threading (SMT) is enabled: "
|
if [ "$opt_sysfs_only" = 1 ]; then
|
||||||
is_cpu_smt_enabled; smt_enabled=$?
|
# if SMT is on, `siblings_list` has more than one element,
|
||||||
if [ "$smt_enabled" = 0 ]; then
|
# separated by ','. Also, it is safe enough to assume that
|
||||||
pstatus yellow YES
|
# cpu0 (1) always exists, and (2) is always online.
|
||||||
elif [ "$smt_enabled" = 1 ]; then
|
if ! grep -q ',' /sys/devices/system/cpu/cpu0/topology/thread_siblings_list ; then
|
||||||
pstatus green NO
|
smt_enabled=1 # means disabled!
|
||||||
else
|
else
|
||||||
pstatus yellow UNKNOWN
|
smt_enabled=0
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
is_cpu_smt_enabled; smt_enabled=$?
|
||||||
|
fi
|
||||||
|
if [ "$smt_enabled" = 0 ]; then
|
||||||
|
pstatus yellow YES
|
||||||
|
elif [ "$smt_enabled" = 1 ]; then
|
||||||
|
pstatus green NO
|
||||||
|
else
|
||||||
|
pstatus yellow UNKNOWN
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! is_cpu_vulnerable "$cve"; then
|
if ! is_cpu_vulnerable "$cve"; then
|
||||||
|
|
Loading…
Reference in New Issue