[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250812103858.234850285@infradead.org>
Date: Tue, 12 Aug 2025 12:38:58 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: tglx@...utronix.de
Cc: linux-kernel@...r.kernel.org,
peterz@...radead.org,
torvalds@...uxfoundation.org,
mingo@...nel.org,
namhyung@...nel.org,
acme@...hat.com,
kees@...nel.org
Subject: [PATCH v3 00/15] perf: Convert mmap() related reference counts to refcount_t
Took over the series from Thomas; much thanks to him for cleaning this up.
The recently fixed reference count leaks could have been detected by using
refcount_t and refcount_t would have mitigated the potential overflow at
least.
It turned out that converting the code as is does not work as the
allocation code ends up doing a refcount_inc() for the first allocation,
which causes refcount_t sanity checks to emit a UAF warning.
The reason is that the code is sharing functionality at the wrong level and
ends up being overly complicated for no reason. That's what inevitable led
to the refcount leak problems.
Address this by splitting the ringbuffer and the AUX buffer mapping and
allocation parts out into seperate functions, which handle the reference
counts in a sane way.
That not only simplifies the code and makes it halfways comprehensible, but
also allows to convert the mmap() related reference counts to refcount_t.
It survives lightweight testing with perf and passes the perf/mmap
selftest.
Also available at:
git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/core
---
v2: https://lkml.kernel.org/r/20250811123458.050061356@linutronix.de
Changes vs v2:
- replaced patches 4,5 with fine grained steps
Powered by blists - more mailing lists