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: <20240301001501.35592-1-dongli.zhang@oracle.com>
Date: Thu, 29 Feb 2024 16:15:01 -0800
From: Dongli Zhang <dongli.zhang@...cle.com>
To: x86@...nel.org
Cc: tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
        dave.hansen@...ux.intel.com, hpa@...or.com,
        linux-kernel@...r.kernel.org, joe.jin@...cle.com
Subject: [PATCH v2 1/1] x86/split_lock: add the source of exception to warning logs

Currently to trigger split lock exception at the guest side will print the
below to host logs.

"x86/split lock detection: #AC: CPU 1/KVM/65886 took a split_lock trap at
address: 0x401173"

Although it is more likely the split lock exception is from the guest side,
differentiate if it is from the guest side, or the host userspace
VMM (e.g., QEMU).

Signed-off-by: Dongli Zhang <dongli.zhang@...cle.com>
---
Changed since v1:
  - Pass the string rather than bools (suggested by Dave Hansen)

 arch/x86/kernel/cpu/intel.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index a927a8fc9624..26e45d9a66f2 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -1155,14 +1155,14 @@ static int splitlock_cpu_offline(unsigned int cpu)
 	return 0;
 }
 
-static void split_lock_warn(unsigned long ip)
+static void split_lock_warn(unsigned long ip, const char *from)
 {
 	struct delayed_work *work;
 	int cpu;
 
 	if (!current->reported_split_lock)
-		pr_warn_ratelimited("#AC: %s/%d took a split_lock trap at address: 0x%lx\n",
-				    current->comm, current->pid, ip);
+		pr_warn_ratelimited("#AC: %s/%d (%s) took a split_lock trap at address: 0x%lx\n",
+				    current->comm, current->pid, from, ip);
 	current->reported_split_lock = 1;
 
 	if (sysctl_sld_mitigate) {
@@ -1194,11 +1194,11 @@ static void split_lock_warn(unsigned long ip)
 bool handle_guest_split_lock(unsigned long ip)
 {
 	if (sld_state == sld_warn) {
-		split_lock_warn(ip);
+		split_lock_warn(ip, "guest");
 		return true;
 	}
 
-	pr_warn_once("#AC: %s/%d %s split_lock trap at address: 0x%lx\n",
+	pr_warn_once("#AC: %s/%d %s (guest) split_lock trap at address: 0x%lx\n",
 		     current->comm, current->pid,
 		     sld_state == sld_fatal ? "fatal" : "bogus", ip);
 
@@ -1237,7 +1237,7 @@ bool handle_user_split_lock(struct pt_regs *regs, long error_code)
 {
 	if ((regs->flags & X86_EFLAGS_AC) || sld_state == sld_fatal)
 		return false;
-	split_lock_warn(regs->ip);
+	split_lock_warn(regs->ip, "user");
 	return true;
 }
 
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ