lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251028094333.49841-1-wangfushuai@baidu.com>
Date: Tue, 28 Oct 2025 17:43:33 +0800
From: Fushuai Wang <wangfushuai@...du.com>
To: <tglx@...utronix.de>, <mingo@...hat.com>, <bp@...en8.de>,
	<dave.hansen@...ux.intel.com>, <x86@...nel.org>, <hpa@...or.com>,
	<linux-kernel@...r.kernel.org>
CC: <gpiccoli@...lia.com>, <peterz@...radead.org>,
	<davydov-max@...dex-team.ru>, <martin.petersen@...cle.com>,
	<jani.nikula@...el.com>, <joel.granados@...nel.org>, <xin@...or.com>,
	<linux-doc@...r.kernel.org>, Fushuai Wang <wangfushuai@...du.com>
Subject: [PATCH RESEND] x86/split_lock: Make split lock mitigation sleep duration configurable

Commit 727209376f49 ("x86/split_lock: Add sysctl to control the misery
mode") introduce a sysctl 'sysctl_sld_mitigate' to control the misery
mode for split lock detection (0 to disable, 1 to enable). However,
when enabled, the sleep duration for split lockers was fixed at 10 ms.

This patch extands 'sysctl_sld_mitigate' to allow configuring the sleep
duration in milliseconds. Now, when 'sysctl_sld_mitigate' is set to
N (N > 0), split lockers will sleep for N milliseconds.

Signed-off-by: Fushuai Wang <wangfushuai@...du.com>
---
The last email wasn't delivered. So resend it.

 Documentation/admin-guide/sysctl/kernel.rst | 4 ++--
 arch/x86/kernel/cpu/bus_lock.c              | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst
index f3ee807b5d8b..92e34041ea73 100644
--- a/Documentation/admin-guide/sysctl/kernel.rst
+++ b/Documentation/admin-guide/sysctl/kernel.rst
@@ -1472,8 +1472,8 @@ increase system exposure to denial of service attacks from split lock users.
 = ===================================================================
 0 Disable the mitigation mode - just warns the split lock on kernel log
   and exposes the system to denials of service from the split lockers.
-1 Enable the mitigation mode (this is the default) - penalizes the split
-  lockers with intentional performance degradation.
+N Enable the mitigation mode (default is 10) - penalizes the split lockers
+  by suspending their execution for N milliseconds.
 = ===================================================================
 
 
diff --git a/arch/x86/kernel/cpu/bus_lock.c b/arch/x86/kernel/cpu/bus_lock.c
index 981f8b1f0792..a5f0ad1b5c24 100644
--- a/arch/x86/kernel/cpu/bus_lock.c
+++ b/arch/x86/kernel/cpu/bus_lock.c
@@ -46,7 +46,7 @@ static const struct {
 
 static struct ratelimit_state bld_ratelimit;
 
-static unsigned int sysctl_sld_mitigate = 1;
+static unsigned int sysctl_sld_mitigate = 10;
 static DEFINE_SEMAPHORE(buslock_sem, 1);
 
 #ifdef CONFIG_PROC_SYSCTL
@@ -58,7 +58,7 @@ static const struct ctl_table sld_sysctls[] = {
 		.mode           = 0644,
 		.proc_handler	= proc_douintvec_minmax,
 		.extra1         = SYSCTL_ZERO,
-		.extra2         = SYSCTL_ONE,
+		.extra2         = SYSCTL_INT_MAX,
 	},
 };
 
@@ -252,9 +252,9 @@ static void split_lock_warn(unsigned long ip)
 	if (saved_sld_mitigate) {
 		/*
 		 * misery factor #1:
-		 * sleep 10ms before trying to execute split lock.
+		 * sleep 'saved_sld_mitigate' ms before trying to execute split lock.
 		 */
-		if (msleep_interruptible(10) > 0)
+		if (msleep_interruptible(saved_sld_mitigate) > 0)
 			return;
 		/*
 		 * Misery factor #2:
-- 
2.36.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ