perf: Convert mmap() related reference counts to refcount_t
Status from this message: The following commit has been merged into the perf/core branch of tip:
Get series with b4
b4 am [email protected]Versions newest first
Changes in v3 from the cover letter
- replaced patches 4,5 with fine grained steps
Patches in v3 Applied
Reviews trailers per patch
All 15 patches have a Reviewed-by or Acked-by.
| Patch | Lorenzo Stoakes | Thomas Gleixner |
|---|---|---|
| 1/15 | R-b | |
| 2/15 | R-b | |
| 3/15 | R-b | |
| 4/15 | R-b | |
| 5/15 | R-b | |
| 6/15 | R-b | |
| 7/15 | R-b | |
| 8/15 | R-b | |
| 9/15 | R-b | |
| 10/15 | R-b | Originally-by |
| 11/15 | R-b | |
| 12/15 | R-b | Originally-by |
| 13/15 | R-b | |
| 14/15 | R-b | |
| 15/15 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [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/[email protected]
Changes vs v2:
- replaced patches 4,5 with fine grained steps