From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15EC1308F32; Mon, 13 Oct 2025 15:43:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760370214; cv=none; b=sm5dZPGumh41THLsvlhn2nrS4vgvkjXTcRuBy7ijtUr5wgkQB8w6IXf3zjKVLY4MrDSj6KYKrrXvB3IfwRMvYC56bOgs61GYPGuUHKjr7kURKRnSuWCtexvPiARncHoOPx1QyDZ7ypBQ6YGtwZ+/3LS5ZK5SHhmNy01c46koHJI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760370214; c=relaxed/simple; bh=h9uX1va/AOcnF206t5bQkY48Hf7wHJNEeUq5QuUrAb0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sJHR7hpsic6M8c3aVAOFWGfxKwFv/JSnWfw5LZeTvH/HD0zPgX7FTZQlx03fSvVmpFyfxo+79bTSnAUqinCSjPo1L/fJcCPZyiJr7Y8C9SW9q+dJViBTQavCWSN7voRWpnLhE5f7pe2keZCsDGP4+lL4IBTm9qWbfCmFLTvbu6g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OZh120kd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="OZh120kd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95070C4CEFE; Mon, 13 Oct 2025 15:43:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760370214; bh=h9uX1va/AOcnF206t5bQkY48Hf7wHJNEeUq5QuUrAb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OZh120kdD5fCHe4dOfd+RKfKt4ACoeqo58xzkEKG1a3glXNfVBvK+sZYBQd7g7PHr 5ZHO9nlvNr1Vd3eaK3qV2OHRhubIUBpalLpbXN1jR+6OS6r81u1bWiuW1lzXYBrdab RjJMjScXqY51C+c9tmiLCHYtJREEDLRpH8vJ6oR4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , syzbot+9a2ede1643175f350105@syzkaller.appspotmail.com, "Steven Rostedt (Google)" Subject: [PATCH 6.17 517/563] tracing: Fix tracing_mark_raw_write() to use buf and not ubuf Date: Mon, 13 Oct 2025 16:46:18 +0200 Message-ID: <20251013144430.043938127@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251013144411.274874080@linuxfoundation.org> References: <20251013144411.274874080@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Steven Rostedt commit bda745ee8fbb63330d8f2f2ea4157229a5df959e upstream. The fix to use a per CPU buffer to read user space tested only the writes to trace_marker. But it appears that the selftests are missing tests to the trace_maker_raw file. The trace_maker_raw file is used by applications that writes data structures and not strings into the file, and the tools read the raw ring buffer to process the structures it writes. The fix that reads the per CPU buffers passes the new per CPU buffer to the trace_marker file writes, but the update to the trace_marker_raw write read the data from user space into the per CPU buffer, but then still used then passed the user space address to the function that records the data. Pass in the per CPU buffer and not the user space address. TODO: Add a test to better test trace_marker_raw. Cc: stable@vger.kernel.org Cc: Masami Hiramatsu Cc: Mark Rutland Cc: Mathieu Desnoyers Cc: Andrew Morton Link: https://lore.kernel.org/20251011035243.386098147@kernel.org Fixes: 64cf7d058a00 ("tracing: Have trace_marker use per-cpu data to read user space") Reported-by: syzbot+9a2ede1643175f350105@syzkaller.appspotmail.com Closes: https://lore.kernel.org/all/68e973f5.050a0220.1186a4.0010.GAE@google.com/ Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -7497,12 +7497,12 @@ tracing_mark_raw_write(struct file *filp if (tr == &global_trace) { guard(rcu)(); list_for_each_entry_rcu(tr, &marker_copies, marker_list) { - written = write_raw_marker_to_buffer(tr, ubuf, cnt); + written = write_raw_marker_to_buffer(tr, buf, cnt); if (written < 0) break; } } else { - written = write_raw_marker_to_buffer(tr, ubuf, cnt); + written = write_raw_marker_to_buffer(tr, buf, cnt); } return written;