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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251223203715.10954-1-khaled.saleh.req@gmail.com>
Date: Tue, 23 Dec 2025 22:37:14 +0200
From: Khaled Saleh <khaled.saleh.req@...il.com>
To: rostedt@...dmis.org
Cc: mhiramat@...nel.org,
	mathieu.desnoyers@...icios.com,
	linux-kernel@...r.kernel.org,
	Khaled Saleh <khaled.saleh.req@...il.com>
Subject: [PATCH] trace: make ftrace likely counters atomic

The correct and incorrect counters in ftrace_likely_update() are
updated without synchronization and may race on SMP systems.

Convert them to atomic counters to address the existing FIXME
without changing behavior.

Signed-off-by: Khaled Saleh <khaled.saleh.req@...il.com>
---
 kernel/trace/trace_branch.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c
index 6809b370e991..31a144fa975f 100644
--- a/kernel/trace/trace_branch.c
+++ b/kernel/trace/trace_branch.c
@@ -215,10 +215,11 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
 	trace_likely_condition(f, val, expect);
 
 	/* FIXME: Make this atomic! */
-	if (val == expect)
-		f->data.correct++;
-	else
-		f->data.incorrect++;
+	if (val == expect) {
+		atomic_long_inc(&f->data.correct);
+	} else {
+	atomic_long_inc(&f->data.incorrect);
+	}
 
 	user_access_restore(flags);
 }
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ