sys: mask SIGPROF during BPF_PROG_LOAD to prevent livelocks
sys: mask SIGPROF during BPF_PROG_LOAD to prevent livelocks

If a thread receives a signal while blocked in BPF_PROG_LOAD, the verifier
can cooperatively interrupt itself by checking pending signals for the thread
and return -EAGAIN from the syscall to request userspace to retry.

When a Go program is built and run with pprof enabled, threads are routinely
sent a SIGPROF to make them dump profiling information, which can lead to a
runaway reaction if the program takes longer to verify than the interrupt
frequency. To prevent this, mask SIGPROF before calling BPF_PROG_LOAD and
remove it when done.

Signed-off-by: Timo Beckers <98c2d5a1e48c998bd9ba9dbc53d6857beae1c9bd@isovalent.com>

cilium/ebpf,cilium/ebpf