Skip to content

Always allow sleepable and fmod_ret programs on syscalls#11318

Closed
kernel-patches-daemon-bpf[bot] wants to merge 3 commits intobpf-next_basefrom
series/1062602=>bpf-next
Closed

Always allow sleepable and fmod_ret programs on syscalls#11318
kernel-patches-daemon-bpf[bot] wants to merge 3 commits intobpf-next_basefrom
series/1062602=>bpf-next

Conversation

@kernel-patches-daemon-bpf
Copy link
Copy Markdown

Pull request for series with
subject: Always allow sleepable and fmod_ret programs on syscalls
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1062602

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 6dd780f
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1062602
version: 2

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 6dd780f
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1062602
version: 2

@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 099bded
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1062602
version: 2

@kernel-patches-daemon-bpf kernel-patches-daemon-bpf Bot force-pushed the series/1062602=>bpf-next branch from 4e2d2d9 to 2f58532 Compare March 9, 2026 01:07
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>
fmod_ret BPF programs can only be attached to selected functions. For
convenience, the error injection list was originally used (along with
functions prefixed with "security_"), which contains syscalls and
several other functions.

When error injection is disabled (CONFIG_FUNCTION_ERROR_INJECTION=n),
that list is empty and fmod_ret programs are effectively unavailable for
most of the functions. In such a case, at least enable fmod_ret programs
on syscalls.

Signed-off-by: Viktor Malik <vmalik@redhat.com>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Acked-by: Leon Hwang <leon.hwang@linux.dev>
Now that sleepable programs are always enabled on syscalls, let
refcounted_kptr tests use syscalls rather than bpf_testmod_test_read,
which is not sleepable with error injection disabled.

The tests just check that the verifier can handle usage of RCU locks in
sleepable programs and never actually attach. So, the attachment target
doesn't matter (as long as it is sleepable) and with syscalls, the tests
pass on kernels with disabled error injection.

Signed-off-by: Viktor Malik <vmalik@redhat.com>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
@kernel-patches-daemon-bpf
Copy link
Copy Markdown
Author

Upstream branch: 099bded
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1062602
version: 2

@kernel-patches-daemon-bpf kernel-patches-daemon-bpf Bot force-pushed the series/1062602=>bpf-next branch from 2f58532 to b8b1d65 Compare March 9, 2026 02:45
@kernel-patches-daemon-bpf kernel-patches-daemon-bpf Bot deleted the series/1062602=>bpf-next branch March 11, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant