From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
stable@vger.kernel.org, sashiko-bot@kernel.org
Subject: [for-linus][PATCH 1/8] tracing: Fix crash on lseek of recursed_functions file in WRONLY mode
Date: Thu, 03 Dec 2026 09:17:26 -0500 [thread overview]
Message-ID: <20261203141756.126494816@kernel.org> (raw)
In-Reply-To: 20261203141725.845506016@kernel.org
From: Steven Rostedt <rostedt@goodmis.org>
The lseek method for the "recursed_functions" file only handles
seq_lseek() which is for when the file is opened for reading. If the file
is opened for WRONLY, it will cause a NULL pointer dereferenced:
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000012: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000090-0x0000000000000097]
CPU: 5 UID: 0 PID: 1100 Comm: lseek Not tainted 7.4.0-rc4-test-00006-g4dca8a8ee893 #36 PREEMPT(lazy)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.17.0-debian-1.17.0-1 04/01/2014
RIP: 0010:__mutex_lock+0x162/0x2550
Code: 08 84 d2 0f 85 a1 1c 00 00 44 8b 0d 38 cb df 03 45 85 c9 75 29 48 b8 00 00 00 00 00 fc ff df 48 8d 7b 58 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 a6 1c 00 00 48 3b 5b 58 0f 85 3f 0e 00 00 bf 01
RSP: 0018:ffff8881211afd10 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: 0000000000000038 RCX: 8000000000000000
RDX: 0000000000000012 RSI: ffffffff8588bdfb RDI: 0000000000000090
RBP: ffff8881211afe70 R08: 0000000000000001 R09: 0000000000000000
R10: ffff8881083f8000 R11: ffffed10247ebc54 R12: 0000000000000000
R13: 0000000000000000 R14: dffffc0000000000 R15: 1ffff11024235fac
FS: 00007fb27d236780(0000) GS:ffff8882b4581000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055fb6eb6e008 CR3: 000000011d26e006 CR4: 0000000000172ef0
Call Trace:
<TASK>
? seq_lseek+0x60/0x3d0
? kmem_cache_free+0x14b/0x610
? __pfx___mutex_lock+0x10/0x10
? do_sys_openat2+0xd8/0x180
? seq_lseek+0x60/0x3d0
seq_lseek+0x60/0x3d0
? __pfx___x64_sys_openat+0x10/0x10
ksys_lseek+0x3c/0xb0
do_syscall_64+0xcd/0x6f0
entry_SYSCALL_64_after_hwframe+0x76/0x7e
RIP: 0033:0x7fb27d33fa17
Code: 8b 05 fd 03 0e 00 64 c7 00 0d 00 00 00 eb b2 e8 ef 98 01 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 08 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 8b 15 c9 03 0e 00 f7 d8 64 89 02 48
RSP: 002b:00007ffd486d0258 EFLAGS: 00000202 ORIG_RAX: 0000000000000008
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fb27d33fa17
RDX: 0000000000000002 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00007ffd486d0280 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000002
R13: 00007fb27d482000 R14: 00007ffd486d03b0 R15: 000055fb6eb6cdd8
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
A helper function "tracing_lseek()" already exists for this use case. Have
the file_operations for the recursed_functions file use that.
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261125162834.2df4c684@gandalf.local.home
Fixes: 773c16705058e ("ftrace: Add recording of functions that caused recursion")
Reported-by: sashiko-bot@kernel.org
Closes: https://sashiko.dev/?list=org.kernel.vger.linux-trace-kernel#/patchset/20260502174741.39636-1-yashsuthar983%40gmail.com
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_recursion_record.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/trace_recursion_record.c b/kernel/trace/trace_recursion_record.c
index 4f63bec052fc..0452c9c4c558 100644
--- a/kernel/trace/trace_recursion_record.c
+++ b/kernel/trace/trace_recursion_record.c
@@ -217,7 +217,7 @@ static const struct file_operations recursed_functions_fops = {
.open = recursed_function_open,
.write = recursed_function_write,
.read = seq_read,
- .llseek = seq_lseek,
+ .llseek = tracing_lseek,
.release = recursed_function_release,
};
--
2.53.0
next prev parent reply other threads:[~2026-12-03 14:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 14:17 [for-linus][PATCH 0/8] tracing: Fixes for v7.4 Steven Rostedt
2026-12-03 14:17 ` Steven Rostedt [this message]
2026-12-03 14:17 ` [for-linus][PATCH 2/8] tracing/filters: Fix glob matching on zero size string fields Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 3/8] ring-buffer: Use irqsave for the reader lock in ring_buffer_poll_remote Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 4/8] ring-buffer: Avoid reader_lock deadlock during panic Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 5/8] tracing/histograms: Reject non-string fields for synthetic string fields Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 6/8] tracing: Free all event filters after RCU synchronization Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 7/8] tracing: Fix trace_event_file leak on read-only instances Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 8/8] tracing: Reject backup instance opens only after autoremove is queued Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261203141756.126494816@kernel.org \
--to=rostedt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=sashiko-bot@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.