diff options
| author | Mahe Tardy <mahe.tardy@gmail.com> | 2026-10-16 13:33:17 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-10-16 16:55:29 +0000 |
| commit | 60bbe76a3f9ea4760f53a09cd2f00e211f7db9e3 (patch) | |
| tree | c62dcc103d1123af9526dfcb9c7be442b5cad728 /tools/testing | |
| parent | aaae5e500a460d99a15313ae79f739fa653148e4 (diff) | |
bpf: Allow ksock connect/send calls from wq
The initial ksock implementation, commit 7ae4eb14c5f9 ("bpf: Add ksock
kfuncs"), kept LSM checks from the kfunc calls and disallowed
asynchronous workqueues because worker credentials differ from those of
the triggering task. However, discussions at Plumbers 2026[^1] revealed
that bypassing LSM checks for BPF-created sockets could be acceptable.
This patch allows workqueue use while retaining LSM checks for now,
paving the way to call bpf_ksock_connect() and bpf_ksock_send() from
non-sleepable programs, such as tracing programs, in future patches.
Note that bpf_ksock_create() still checks:
* for current to not be a kernel thread (thus excluding bpf workqueue
callbacks) because the socket is created within a userspace task
network namespace. It should, most of the time, be the process that
triggered the SYSCALL program, but could be another task when called
from bpf_task_work callbacks.
* for current->nsproxy to be non-NULL since when called from a
bpf_task_work callback and the task is in the do_exit() phase, nsproxy
is torn down just before the remaining task work is executed.
[^1]: https://lpc.events/event/20/contributions/2430/
Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Tested-by: Alan Maguire (Oracle) <almagui@kernel.org>
Link: https://patch.msgid.link/20261016133318.33999-1-mahe.tardy@gmail.com
Diffstat (limited to 'tools/testing')
0 files changed, 0 insertions, 0 deletions
