Re: [PATCH] perf: Fix data race in perf_event_set_bpf_handler()
From: Qing Wang
Date: Thu Jan 29 2026 - 22:34:33 EST
On Wed, 28 Jan 2026 at 05:29, Henry Zhang <zeri@xxxxxxxxx> wrote:
> Thanks, this looks good.
I thought my patch is incorrect after review.
1. The RCU protects 'prog->aux' but not 'prog', so 'rcu_dereference(event->prog)'
is incorrect.
2. The UAF issue of 'prog' may not exist. It's needed further anlysis.
Let's forget my patch.
The data race is correctly fixed by your patch but there is still a little
suggestion:
The 'event->prog = NULL' in perf_event_free_bpf_handler is needed WRITE_ONCE.
--
Best regards,
Qing