perf_event_detach_bpf_prog() broken?

From: Peter Zijlstra
Date: Tue Oct 22 2024 - 07:18:02 EST


Hi guys,

Per commit 170a7e3ea070 ("bpf: bpf_prog_array_copy() should return
-ENOENT if exclude_prog not found") perf_event_detach_bpf_prog() can now
return without doing bpf_prog_put() and leaving event->prog set.

This is very 'unexpected' behaviour.

I'm not sure what's sane from the BPF side of things here, but leaving
event->prog set is really rather unexpected.

Help?