From: Qing Wang <wangqing7171@gmail.com>
To: rostedt@goodmis.org
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
mathieu.desnoyers@efficios.com, mhiramat@kernel.org,
syzbot+3b5dd2030fe08afdf65d@syzkaller.appspotmail.com,
syzkaller-bugs@googlegroups.com, wangqing7171@gmail.com
Subject: Re: [syzbot] [trace?] WARNING in tracing_buffers_mmap_close (3)
Date: Fri, 27 Feb 2026 11:07:37 +0800 [thread overview]
Message-ID: <20260227030737.1089041-1-wangqing7171@gmail.com> (raw)
In-Reply-To: <20260226115229.7111b070@gandalf.local.home>
On Fri, 27 Feb 2026 at 00:52, Steven Rostedt <rostedt@goodmis.org> wrote:
> OK, so the issue is that the ring buffer was mapped, then the process that
> mapped it forked duplicating the mappings. And then on exit (or unmap),
> the first one to unmap the buffer will cause the ring buffer to think it
> was fully unmapped causing the next one to unmap to trigger the error.
>
>
> > + */
> > +void ring_buffer_map_user_mapped_inc(struct trace_buffer *buffer, int cpu)
>
> Let's call this ring_buffer_map_dup() to be consistent with ring_buffer_map().
>
> inc would expect a dec, but dup() is more of what it is doing.
>
> > +{
> > + struct ring_buffer_per_cpu *cpu_buffer;
> > +
> > + if (!cpumask_test_cpu(cpu, buffer->cpumask))
> > + return;
>
> I wonder if this fails we should warn. As it should never be called unless
> it was successfully mapped.
>
> > +
> > + cpu_buffer = buffer->buffers[cpu];
> > +
> > + guard(mutex)(&cpu_buffer->mapping_lock);
> > +
> > + if (cpu_buffer->user_mapped)
> > + __rb_inc_dec_mapped(cpu_buffer, true);
>
> Probably should also warn if user_mapped is not set. Again, this should not
> ever not be mapped if we get here.
>
> -- Steve
Thanks for your suggestion. I sent a patch [0] and looking forward to your review.
[0] https://lore.kernel.org/all/20260227025842.1085206-1-wangqing7171@gmail.com/
--
Best regards,
Qing
prev parent reply other threads:[~2026-02-27 3:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-26 4:06 [syzbot] [trace?] WARNING in tracing_buffers_mmap_close (3) syzbot
2026-02-26 6:16 ` Qing Wang
2026-02-26 6:34 ` syzbot
2026-02-26 8:00 ` Qing Wang
2026-02-26 8:18 ` syzbot
2026-02-26 9:16 ` Qing Wang
2026-02-26 9:43 ` syzbot
2026-02-26 16:52 ` Steven Rostedt
2026-02-27 3:07 ` Qing Wang [this message]
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=20260227030737.1089041-1-wangqing7171@gmail.com \
--to=wangqing7171@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=syzbot+3b5dd2030fe08afdf65d@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox