From nobody Sat Feb 7 17:55:46 2026 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 0C053264A9D; Fri, 7 Nov 2025 13:07:56 +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=1762520877; cv=none; b=fu9DSZkUIV0DP0ZRESGWwSNryH8ihc5nPXdeyk6jwt2aOU46mUAsQ2jWkbbckQ43YF4Yq5gc5WYPyalI7G9TYW3RZrk2i67xA5C5jWIjkTO6FQe4MpUVuXNWA2yB5uLnwnai/DtzoSTYd4uFzbOXqndet6fgvJX9eFaDBnTlv2w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762520877; c=relaxed/simple; bh=gTCe6+8DCvvTv/gwaosX0O1LJx32TQrppUBdFg7nEZ4=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=GNpGRsyTnQO02YHdK1M5W8CS24Bz3MaCvLXb44ZfGr5eskDEanp9L1KcISkGMP8sJiFcKK1DG+lLfbZDxPcUzCkYMmz/MGNMbNAOI2lMfe+RhzPTTC0MnM7YGgHPUqJ+o+y7ISq34/5qpA734qkY+H4pUj6vO6Sbn9KqcBYrWZg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GyHqf8Tw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GyHqf8Tw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB87EC19421; Fri, 7 Nov 2025 13:07:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762520876; bh=gTCe6+8DCvvTv/gwaosX0O1LJx32TQrppUBdFg7nEZ4=; h=Date:From:To:Cc:Subject:References:From; b=GyHqf8TwIU4rt1cFeUgO4fS4nNJ6DVg8ytscgRw4KL4L3gaewE1KKnGmw/TlKo/nM SI1mAPSUB/M1mDxvwmNJy+b+fFqF5cMQw4pnAvqNT/cR4+ejYkPpCvrinXK6/UrWYp FNyqKkviQLAASmtazERNk3yVPzwYzJuv+3VGFXKHoNafAFiph/IaSOohjasYUK/uds DvlYoDxN3oFoMwi+Jr7e9y2utGowRaqKFw0bDWMfr2uKxDhxUg/sEtIw4csAfP0QjZ 1xnfkBxLLiA7VzG2oq4TpEIpV8+Y0GRaSsL4BkBLXl0ide4d/CHQem41exgdfl0Pc9 OCIrQijE17auA== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vHMC6-00000000GGV-0MR2; Fri, 07 Nov 2025 08:07:58 -0500 Message-ID: <20251107130757.937218818@kernel.org> User-Agent: quilt/0.68 Date: Fri, 07 Nov 2025 08:07:31 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Tomas Glozar , John Kacur , stable@vger.kernel.org, Vincent Donnefort , syzbot+92a3745cea5ec6360309@syzkaller.appspotmail.com Subject: [for-linus][PATCH 1/3] ring-buffer: Do not warn in ring_buffer_map_get_reader() when reader catches up References: <20251107130730.158197641@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Steven Rostedt The function ring_buffer_map_get_reader() is a bit more strict than the other get reader functions, and except for certain situations the rb_get_reader_page() should not return NULL. If it does, it triggers a warning. This warning was triggering but after looking at why, it was because another acceptable situation was happening and it wasn't checked for. If the reader catches up to the writer and there's still data to be read on the reader page, then the rb_get_reader_page() will return NULL as there's no new page to get. In this situation, the reader page should not be updated and no warning should trigger. Cc: stable@vger.kernel.org Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Cc: Vincent Donnefort Reported-by: syzbot+92a3745cea5ec6360309@syzkaller.appspotmail.com Closes: https://lore.kernel.org/all/690babec.050a0220.baf87.0064.GAE@google= .com/ Link: https://lore.kernel.org/20251016132848.1b11bb37@gandalf.local.home Fixes: 117c39200d9d7 ("ring-buffer: Introducing ring-buffer mapping functio= ns") Signed-off-by: Steven Rostedt (Google) --- kernel/trace/ring_buffer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 1244d2c5c384..afcd3747264d 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -7344,6 +7344,10 @@ int ring_buffer_map_get_reader(struct trace_buffer *= buffer, int cpu) goto out; } =20 + /* Did the reader catch up with the writer? */ + if (cpu_buffer->reader_page =3D=3D cpu_buffer->commit_page) + goto out; + reader =3D rb_get_reader_page(cpu_buffer); if (WARN_ON(!reader)) goto out; --=20 2.51.0 From nobody Sat Feb 7 17:55:46 2026 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 54AC52BDC34 for ; Fri, 7 Nov 2025 13:07:57 +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=1762520877; cv=none; b=ONwrcU288OjjG1mfhXe2PxXgElZSnOFVDxY6IMLkaLUiJMXTT83FEXcO3Ehn4bGAEYbb4C+bOdA6k2E9ZrlY8yuYISRTj/su6HGVUJDo8x6aqZ74U3iogyWqFfvVUtE5m61yBjzeD5VJulYgDb8Bseg3sDnB7SAFYEzjG3sgdvE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762520877; c=relaxed/simple; bh=HF3so+PDtP59y2oejyEjViinp3zdIxJ+DfAN5qy7mxM=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=jKzS/OYnDeMm9SIi+FUSp/iBr2wn1RMpu75OWATcaxVQRGkONw/eC1QcHJZ4kjefly4OL7Cyqs1KcNN+Cb0bINKNd77aiUAF9zKIPBwaoQypXO2ZlG+UIM4ZeLgXMCEHsOGDAYVeDLE9uyVmo/0XqRPhqvo2OD2P9mC4e71xxRs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lL9cy0/4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lL9cy0/4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7B69C19422; Fri, 7 Nov 2025 13:07:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762520876; bh=HF3so+PDtP59y2oejyEjViinp3zdIxJ+DfAN5qy7mxM=; h=Date:From:To:Cc:Subject:References:From; b=lL9cy0/4VKkmYNj/eNTlSwqT8MlQb94nOk9CB1ypflDgvIzZv4hbwudjTvp/djFBw rOg/7Y3HQe34zg/kcVc/hZ3FP7gFKdHBtIbEKP0AI8QezQ83IUnGSUz11FZftiWdnt cmX/EO5ucjscDfQFz9s5lSkJLeV6zCBLl3kFc0yB3DENpm4jdo7Zj/CRMI81BgH6Ou btCTR47ldXuyooQzh3TwCuBIOaIBH4tCNq1H4Cj1cupEjqbRU+EolaPG03yZW6KPeC HCCS3AMaK0oit9Z/FLaojSo1VgBkyJ07llmihKE/+DGmns3ZS4jWtfOkqN5H4BDIBh BaUzVUpKfWPCw== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vHMC6-00000000GGz-13ie; Fri, 07 Nov 2025 08:07:58 -0500 Message-ID: <20251107130758.106460323@kernel.org> User-Agent: quilt/0.68 Date: Fri, 07 Nov 2025 08:07:32 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Tomas Glozar , John Kacur , Zilin Guan Subject: [for-linus][PATCH 2/3] tracing: Fix memory leaks in create_field_var() References: <20251107130730.158197641@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zilin Guan The function create_field_var() allocates memory for 'val' through create_hist_field() inside parse_atom(), and for 'var' through create_var(), which in turn allocates var->type and var->var.name internally. Simply calling kfree() to release these structures will result in memory leaks. Use destroy_hist_field() to properly free 'val', and explicitly release the memory of var->type and var->var.name before freeing 'var' itself. Link: https://patch.msgid.link/20251106120132.3639920-1-zilin@seu.edu.cn Fixes: 02205a6752f22 ("tracing: Add support for 'field variables'") Signed-off-by: Zilin Guan Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_events_hist.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_h= ist.c index 1d536219b624..6bfaf1210dd2 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -3272,14 +3272,16 @@ static struct field_var *create_field_var(struct hi= st_trigger_data *hist_data, var =3D create_var(hist_data, file, field_name, val->size, val->type); if (IS_ERR(var)) { hist_err(tr, HIST_ERR_VAR_CREATE_FIND_FAIL, errpos(field_name)); - kfree(val); + destroy_hist_field(val, 0); ret =3D PTR_ERR(var); goto err; } =20 field_var =3D kzalloc(sizeof(struct field_var), GFP_KERNEL); if (!field_var) { - kfree(val); + destroy_hist_field(val, 0); + kfree_const(var->type); + kfree(var->var.name); kfree(var); ret =3D -ENOMEM; goto err; --=20 2.51.0 From nobody Sat Feb 7 17:55:46 2026 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 6ED322BFC8F for ; Fri, 7 Nov 2025 13:07:57 +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=1762520877; cv=none; b=MluVmFxzvgAwubSR1WTw39HeztimWtFtw2NZ1dR92X02NWG09qsrQBsJ6NNIG0utL9zyan4ouKaE0ah+vIPEymwuPsSfT7a9q3KEP0mXT9eP9m0WZeFXWcpTChMnO4NbuJ0WPfG1ShaHTwGATLUbh+P77lJWYxnNY/qA+h/MAaU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762520877; c=relaxed/simple; bh=x5i4jI3rGTtuKkTnNhWVfyENMY/Cb47mGtDuLs0h73k=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=uujlzJmQ8fIetN3Plk8UQ2VHMcRyZtDVBsxu7syQ4sKM0Y1N4sUQgEvdn/6hUIUuML+aeLCc6mIUgTmI95vJbNF49SIJ+mhdDY2aadD4NECQreyJAQPtx4XNygQwMzAVUDFAMMUx+U+D6yO2x2GA0bp+3xH05KlxVTm8E2KuXnE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dAolzATU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dAolzATU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1162AC19423; Fri, 7 Nov 2025 13:07:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762520877; bh=x5i4jI3rGTtuKkTnNhWVfyENMY/Cb47mGtDuLs0h73k=; h=Date:From:To:Cc:Subject:References:From; b=dAolzATU2a3p+yGycrbdk8H8eIeyRpVCgJfxXD7Gi3WLq/UonLrNqbfG/QcLanaLe PoVIJ/jWRf3ty6HmgviJNHjx6Eq2zwvxglbjgBfAOZJRMLUdyweAC2BA9w/N3gRsC/ 84lbeom6dLpUHhLWdoQA4SFNcR+wH+rmXZhs1/gmrZPgA1SK1rv78KqX/2vrTBViHb ufYRgS2TBBEjEui/L+8B8u7/mfSahBCMTzNaZHNzQ+r73L67KVK3boNZP/Rh7FIBFD 320uuNpSi6erT4CVjQAR3pxWODxXhdg6go+LvdbJOPB8+zl7pf5IlgMXd/1Gb1u4oP HVGbWXEOOSJAQ== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1vHMC6-00000000GHT-1kU6; Fri, 07 Nov 2025 08:07:58 -0500 Message-ID: <20251107130758.272051237@kernel.org> User-Agent: quilt/0.68 Date: Fri, 07 Nov 2025 08:07:33 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Tomas Glozar , John Kacur , Zhang Chujun Subject: [for-linus][PATCH 3/3] tracing/tools: Fix incorrcet short option in usage text for --threads References: <20251107130730.158197641@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zhang Chujun The help message incorrectly listed '-t' as the short option for --threads, but the actual getopt_long configuration uses '-e'. This mismatch can confuse users and lead to incorrect command-line usage. This patch updates the usage string to correctly show: "-e, --threads NRTHR" to match the implementation. Note: checkpatch.pl reports a false-positive spelling warning on 'Run', which is intentional. Link: https://patch.msgid.link/20251106031040.1869-1-zhangchujun@cmss.china= mobile.com Signed-off-by: Zhang Chujun Signed-off-by: Steven Rostedt (Google) --- tools/tracing/latency/latency-collector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tracing/latency/latency-collector.c b/tools/tracing/late= ncy/latency-collector.c index cf263fe9deaf..ef97916e3873 100644 --- a/tools/tracing/latency/latency-collector.c +++ b/tools/tracing/latency/latency-collector.c @@ -1725,7 +1725,7 @@ static void show_usage(void) "-n, --notrace\t\tIf latency is detected, do not print out the content of\= n" "\t\t\tthe trace file to standard output\n\n" =20 -"-t, --threads NRTHR\tRun NRTHR threads for printing. Default is %d.\n\n" +"-e, --threads NRTHR\tRun NRTHR threads for printing. Default is %d.\n\n" =20 "-r, --random\t\tArbitrarily sleep a certain amount of time, default\n" "\t\t\t%ld ms, before reading the trace file. The\n" --=20 2.51.0