Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793216983; b=Uaoh8Y3S6JAOU79lERU7CRHUOIX2PyStVWhQS+GXTCs0y/Sgr/U1CI7aURFAXPZWLVSE STwlC65hOLvh9Z/ywx3JDdGVcFGoHZha9SD60EFJb0YlupCoZb5UtultqcFaxkzx0RDvX 0SKJkEbMcgGAQgkUrLiNWO8hZz9ZJBM4sQAa3/5DVBSsdC+ybxcTX153B7p1HYwkngMch fs9mFg+X5W/xhBqqgZYT8G7XU51xRrYbYb9mqpIXIoN8hkOhnOFB11KLZRdSHvyF0/hRg zFd1RldUhI69HHN0HzHCscrwXy2cy4naHlXrSFjvYc4MAAPzLQnPtA54FgKmd31tBLw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793216983; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=1dxWVXpedzUBDiEDNSwbsxqX2HbmIhPbGYcp8GiHFrI=; b=xX1x+85toIuwbIP0RcrDlQ/nY3J/FZ3IkC69v7FkjxVpz6UNkA+8T1I2VIt9y8nIRFJl dvaORn/iw89QQTOnkzmzKP7dwd0jeLpCe96fLb7JBunRT4mwo5asT6W5sPAffGhPXzO5q HY65Ewc9gNILDG6iaV84K3aTKJdNZFlaeoxJejl8HYxro+ddSdwTWVjCUZnsD34tzUoz2 ut4Qc0BDHy5s/LGLO9giy4uGgpFz1xReNqNDDd+rRBywL0G+kJzYP1QZqThATuDPP5yjQ pcqxNLtNlIwA7BtuJpf+ovJk1cmkiOec52dlCig0uWdb6QqiIgaTUo1rkxBuurIbGbA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=GoWLYPDD; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D967606A31C; Wed, 28 Oct 2026 19:49:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=GoWLYPDD Received: by smtp.kernel.org (Postfix) with ESMTPSA id 669FB1F01825; Wed, 28 Oct 2026 19:49:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1793216983; bh=1dxWVXpedzUBDiEDNSwbsxqX2HbmIhPbGYcp8GiHFrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GoWLYPDDFvGCaoTvU5Fqd5WL3Uo3MAc9TrPkM2i/AnU6egFJvhng55vZUd7z6XKdY p/RbOhG/vmy2hRhF9s44J4UeFGzSsqjRau1aIouB6oCPFdQFnOLdVkApJWDgBkPkC5 BWeJHfyMVSnuDf9Ror0MujWMJnWPvr+B5jiqjx/U= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Michal=20Such=C3=A1nek?= , Amit Machhiwal , "Masami Hiramatsu (Google)" , Steven Rostedt Subject: [PATCH 6.1 1748/1887] tracing: Do not initialize tracefs work if tracing is disabled Date: Wed, 28 Oct 2026 18:04:04 +0100 Message-ID: <20261028170539.234995834@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261028170459.200466217@linuxfoundation.org> References: <20261028170459.200466217@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Amit Machhiwal commit b3b974008388ab59e44d764ba7a63c988fec2524 upstream. If trace buffer allocation fails during early boot (e.g. in early_trace_init() -> allocate_trace_buffers()), tracing_disabled is left set to 1 and the global trace array events list remains uninitialized. Later during boot, tracer_init_tracefs() (invoked via fs_initcall) queues tracerfs_init_work asynchronously without checking if tracing was disabled. When tracer_init_tracefs_work_func() runs, it calls event_trace_init() and init_tracer_tracefs(&global_trace, NULL) unconditionally. This leads to __find_event_file() dereferencing an uninitialized tr->events list, causing an early boot NULL pointer dereference Oops: BUG: Kernel NULL pointer dereference on read at 0x00000010 Faulting instruction address: 0xc000000000485be0 Oops: Kernel access of bad area, sig: 7 [#1] ... NIP [c000000000485be0] __find_event_file+0x70/0x3c0 LR [c000000000448874] init_tracer_tracefs+0x274/0xc80 Call Trace: init_tracer_tracefs+0x274/0xc80 tracer_init_tracefs_work_func+0x50/0x320 process_one_work+0x1e8/0x5c0 worker_thread+0x1dc/0x3d0 kthread+0x194/0x1b0 start_kernel_thread+0x14/0x18 Check tracing_disabled at the beginning of tracer_init_tracefs_work_func() and return immediately if tracing is disabled or failed to initialize, preventing the crash. Cc: stable@vger.kernel.org Fixes: 6621a7004684 ("tracing: make tracer_init_tracefs initcall asynchronous") Link: https://patch.msgid.link/20261009163557.88467-2-amachhiw@linux.ibm.com Reported-by: Michal Suchánek Closes: https://lore.kernel.org/all/arYskzbiaNzBR9MD@kunlun.suse.cz/ Signed-off-by: Amit Machhiwal Tested-by: Michal Suchánek Acked-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -10005,6 +10005,12 @@ static struct notifier_block trace_modul static __init void tracer_init_tracefs_work_func(struct work_struct *work) { + /* + * Do not attempt to initialize tracefs if tracing was disabled or + * failed to allocate + */ + if (tracing_disabled) + return; event_trace_init();