Skip to content

Commit 6823f10

Browse files
Rongronggg9bp3tk0v
authored andcommitted
x86/split_lock: Remove dead string when split_lock_detect=fatal
sld_state_show() has a dead str1 below: if (A) { ... } else if (B) { pr_info(... A ? str1 : str2 ...); } where A is always false in the second block, implied by the "if (A) else" pattern. Hence, str2 is always used. This seems to be some mysterious legacy inherited from the earlier patch revisions of ebb1064 ("x86/traps: Handle #DB for bus lock"). Earlier revisions¹ did enable both sld and bld at the same time to detect non-WB bus_locks when split_lock_detect=fatal, but that's no longer true in the merged revision. Remove it and translate the pr_info() into its equivalent form. ¹ https://lore.kernel.org/r/20201121023624.3604415-3-fenghua.yu@intel.com [ bp: Massage commit message; simplify braces ] Signed-off-by: Rong Zhang <i@rong.moe> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://patch.msgid.link/20251215182907.152881-1-i@rong.moe
1 parent f8f9c1f commit 6823f10

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

arch/x86/kernel/cpu/bus_lock.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,10 @@ static void sld_state_show(void)
410410
}
411411
break;
412412
case sld_fatal:
413-
if (boot_cpu_has(X86_FEATURE_SPLIT_LOCK_DETECT)) {
413+
if (boot_cpu_has(X86_FEATURE_SPLIT_LOCK_DETECT))
414414
pr_info("#AC: crashing the kernel on kernel split_locks and sending SIGBUS on user-space split_locks\n");
415-
} else if (boot_cpu_has(X86_FEATURE_BUS_LOCK_DETECT)) {
416-
pr_info("#DB: sending SIGBUS on user-space bus_locks%s\n",
417-
boot_cpu_has(X86_FEATURE_SPLIT_LOCK_DETECT) ?
418-
" from non-WB" : "");
419-
}
415+
else if (boot_cpu_has(X86_FEATURE_BUS_LOCK_DETECT))
416+
pr_info("#DB: sending SIGBUS on user-space bus_locks\n");
420417
break;
421418
case sld_ratelimit:
422419
if (boot_cpu_has(X86_FEATURE_BUS_LOCK_DETECT))

0 commit comments

Comments
 (0)