Skip to content

Commit 8f44986

Browse files
alindimagbionescu
authored andcommitted
[Release v0.24.4] devtool: add check_ssbd()
Signed-off-by: alindima <[email protected]>
1 parent 606f9b0 commit 8f44986

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tools/devtool

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,27 @@ check_swap () {
969969
say_warn "WARNING: SWAP enabled"
970970
}
971971

972+
check_SSBD () {
973+
arch=$(uname -m)
974+
if [ "$arch" = "aarch64" ]; then
975+
local param="ssbd=force-on"
976+
elif [ "$arch" = "x86_64" ]; then
977+
local param="spec_store_bypass_disable=on"
978+
fi
979+
980+
ssbd_sysfs_file="/sys/devices/system/cpu/vulnerabilities/spec_store_bypass"
981+
982+
if [ -f "$ssbd_sysfs_file" ]; then
983+
(grep -q "^Vulnerable" $ssbd_sysfs_file) && \
984+
say_warn "WARNING: SSBD mitigation is either globally disabled or"\
985+
"system does not support mitigation via prctl or seccomp. Try"\
986+
"enabling it system-wide, using the \`${param}\` boot parameter."
987+
else
988+
say_warn "WARNING: SSBD mitigation not supported on this kernel."\
989+
"View the prod-host-setup.md for more details."
990+
fi
991+
}
992+
972993
check_vm() {
973994
if [ $(dmesg | grep -c -i "hypervisor detected") -gt 0 ]; then
974995
say_warn "WARNING: you are running in a virtual machine." \
@@ -1001,6 +1022,7 @@ cmd_checkenv() {
10011022
check_L1TF
10021023
check_SMT
10031024
check_swap
1025+
check_SSBD
10041026
}
10051027

10061028
main() {

0 commit comments

Comments
 (0)