fix: wrmsr: specify core number (closes #294)

built from commit fe5bf7c003
 dated 2026-04-06 17:01:17 +0200
 by Stéphane Lesimple (speed47_github@speed47.net)
This commit is contained in:
github-actions[bot]
2026-04-06 15:02:33 +00:00
parent 8ae598802c
commit e8a3c7d7f5

View File

@@ -13,7 +13,7 @@
# #
# Stephane Lesimple # Stephane Lesimple
# #
VERSION='26.32.0406542' VERSION='26.32.0406626'
# --- Common paths and basedirs --- # --- Common paths and basedirs ---
readonly VULN_SYSFS_BASE="/sys/devices/system/cpu/vulnerabilities" readonly VULN_SYSFS_BASE="/sys/devices/system/cpu/vulnerabilities"
@@ -2957,14 +2957,13 @@ write_msr_one_core() {
ret=$? ret=$?
else else
# for Linux # for Linux
# convert to decimal
if [ ! -w $CPU_DEV_BASE/"$core"/msr ]; then if [ ! -w $CPU_DEV_BASE/"$core"/msr ]; then
ret_write_msr_msg="No write permission on $CPU_DEV_BASE/$core/msr" ret_write_msr_msg="No write permission on $CPU_DEV_BASE/$core/msr"
return $WRITE_MSR_RET_ERR return $WRITE_MSR_RET_ERR
# if wrmsr is available, use it # if wrmsr is available, use it
elif command -v wrmsr >/dev/null 2>&1 && [ "${SMC_NO_WRMSR:-}" != 1 ]; then elif command -v wrmsr >/dev/null 2>&1 && [ "${SMC_NO_WRMSR:-}" != 1 ]; then
pr_debug "write_msr: using wrmsr" pr_debug "write_msr: using wrmsr"
wrmsr $msr_dec $value_dec 2>/dev/null wrmsr -p "$core" $msr_dec $value_dec 2>/dev/null
ret=$? ret=$?
# ret=4: msr doesn't exist, ret=127: msr.allow_writes=off # ret=4: msr doesn't exist, ret=127: msr.allow_writes=off
[ "$ret" = 127 ] && write_denied=1 [ "$ret" = 127 ] && write_denied=1