smt: Only disable SMT when the kernel thinks it is vulnerable

On virtual machines, it does not make sense to disable SMT for the
virtual cores. This has to be done by the hypervisor.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2019-06-11 17:07:23 +00:00
parent 8e101c0bda
commit 894eaf5184

View File

@@ -23,7 +23,7 @@ case "${1}" in
# Disable SMT when the processor is vulnerable to Foreshadow or Fallout/ZombieLoad/RIDL
for vuln in l1tf mds; do
if [ -r "/sys/devices/system/cpu/vulnerabilities/${vuln}" ] && \
[ "$(</sys/devices/system/cpu/vulnerabilities/${vuln})" != "Not affected" ]; then
[[ "$(</sys/devices/system/cpu/vulnerabilities/${vuln})" =~ "SMT vulnerable" ]]; then
# Disable SMT
boot_mesg "Disabling Simultaneous Multi-Threading (SMT)..."
echo "forceoff" > /sys/devices/system/cpu/smt/control