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: <20260209093101.1623454-1-wutengda@huaweicloud.com>
Date: Mon,  9 Feb 2026 17:31:01 +0800
From: Tengda Wu <wutengda@...weicloud.com>
To: Steven Rostedt <rostedt@...dmis.org>,
	Masami Hiramatsu <mhiramat@...nel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Ingo Molnar <mingo@...e.hu>,
	Thomas Gleixner <tglx@...nel.org>,
	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	linux-trace-kernel@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Tengda Wu <wutengda@...weicloud.com>
Subject: [PATCH] tracing: Fix soft lockup when lseeking trace file

A soft lockup may occur when accessing trace file via lseek while
tracing is active and a large offset is provided. The call trace
is shown below:

watchdog: BUG: soft lockup - CPU#3 stuck for 26s! [poc:141]
CPU: 3 UID: 0 PID: 141 Comm: poc Not tainted 6.19.0 #1 PREEMPT(none)
Call Trace:
  ring_buffer_iter_peek
  peek_next_entry
  __find_next_entry
  trace_find_next_entry_inc
  s_next
  traverse.part.0
  seq_lseek
  tracing_lseek
  __x64_sys_lseek
  do_syscall_64
  entry_SYSCALL_64_after_hwframe

The root cause is that the lseek implementation for trace files
is based on seq_lseek, which contains a loop that repeatedly calls
show() and next() functions until the position reaches the target
offset. Since no scheduling point is set within this loop, a large
offset can cause the CPU to be stuck in the loop for an extended
period, triggering the soft lockup detector.

Fixed by adding cond_resched() in s_next().

Fixes: bc0c38d139ec ("ftrace: latency tracer infrastructure")
Signed-off-by: Tengda Wu <wutengda@...weicloud.com>
---
 kernel/trace/trace.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 8bd4ec08fb36..3afe148ef683 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3928,6 +3928,8 @@ static void *s_next(struct seq_file *m, void *v, loff_t *pos)
 
 	iter->pos = *pos;
 
+	cond_resched();
+
 	return ent;
 }
 
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ