[PATCH 0/1] perf: Fix warning from concurrent read/write of perf_event_pmu_context

From: James Clark
Date: Fri Jan 27 2023 - 09:32:06 EST


Hi Peter and Ravi,

I came across this issue, and I also found there was a syzbot report
for it and linked it on the commit. I have one question about the fix,
where I had to remove the if (epc->ctx) from put_pmu_ctx(). I assume
this was added for a reason, but I can't see where it's not ever set?
Unless it's removed, the function got a lot more complicated to take
the lock before the reference decrement.

Also now I think the atomic type for epc->refcount is redundant,
because everything is always done with the lock held. Except for
get_pmu_ctx(), but that is just a read for a warning. So unless you
think the scope of my extra locking can be reduced, I would probably
also send a commit to remove that as well.

Thanks
James

James Clark (1):
perf: Fix warning from concurrent read/write of perf_event_pmu_context

kernel/events/core.c | 42 ++++++++++++++++++++----------------------
1 file changed, 20 insertions(+), 22 deletions(-)


base-commit: 5912e15f25d6d584f3b8449e0b6a244a0f4f0903
--
2.39.1