]> git.ipfire.org Git - thirdparty/linux.git/commit
bpf: Always allow sleepable programs on syscalls
authorViktor Malik <vmalik@redhat.com>
Mon, 9 Mar 2026 11:23:56 +0000 (12:23 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 9 Mar 2026 16:28:42 +0000 (09:28 -0700)
commit16d9c5660692d6f0e6aba367274de2b6dfd4343c
tree41a8bbd851775558b61440526fe4b9f12f5762f9
parent099bded7525d9803f62bc5a1ed60e2c9ec4851e0
bpf: Always allow sleepable programs on syscalls

Sleepable BPF programs can only be attached to selected functions. For
convenience, the error injection list was originally used, which
contains syscalls and several other functions.

When error injection is disabled (CONFIG_FUNCTION_ERROR_INJECTION=n),
that list is empty and sleepable tracing programs are effectively
unavailable. In such a case, at least enable sleepable programs on
syscalls. For discussion why syscalls were chosen, see [1].

To detect that a function is a syscall handler, we check for
arch-specific prefixes for the most common architectures. Unfortunately,
the prefixes are hard-coded in arch syscall code so we need to hard-code
them, too.

[1] https://lore.kernel.org/bpf/CAADnVQK6qP8izg+k9yV0vdcT-+=axtFQ2fKw7D-2Ei-V6WS5Dw@mail.gmail.com/

Signed-off-by: Viktor Malik <vmalik@redhat.com>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Acked-by: Leon Hwang <leon.hwang@linux.dev>
Link: https://lore.kernel.org/r/2704a8512746655037e3c02b471b31bd0d76c8db.1773055375.git.vmalik@redhat.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c