Filtering pid_tgid is meaningless when the current task is preempted by an interrupt. To address this, introduce the bpf_in_interrupt kfunc, which allows BPF programs to determine whether they are executing in interrupt context. Internally, bpf_in_interrupt() is a thin wrapper around in_interrupt(). It is marked as fastcall function. On x86_64, it is inlined for efficiency. Leon Hwang (2): bpf: Introduce bpf_in_interrupt kfunc selftests/bpf: Add case to test bpf_in_interrupt kfunc kernel/bpf/helpers.c | 9 +++++++++ kernel/bpf/verifier.c | 11 +++++++++++ tools/testing/selftests/bpf/progs/irq.c | 7 +++++++ 3 files changed, 27 insertions(+) -- 2.50.1