Thread (3 messages) 3 messages, 1 author, 15d ago

[PATCH bpf-next v2 0/2] bpf: Fix bpf_send_signal_task() from kernel thread context

flat view
COLD15d

From: Aditya Sharma <hidden>
Date: 2026-10-01 07:27:00
Also in: bpf, linux-kselftest, lkml

bpf_send_signal_task() returns -EPERM whenever the calling context is a
kernel thread, even when the signal is for a different task. The
cause is the nmi_uaccess_okay() check in bpf_send_signal_common(),
which is a statement about current and not about the target task.

Patch 1 removes the check, as the signal path does no user memory
access and the check has nothing to guard there.

Patch 2 adds a selftest that sends a signal to a user task from
tp_btf/workqueue_execute_start, where current is always a kworker.
Without patch 1, this test fails on x86.

v1 -> v2:
- Rebase onto current bpf-next.
- Add this cover letter (v1 was sent without one)
- Remove nmi_uaccess_okay() check (as per Andrii)
- Fixed a stale comment above checks in bpf_send_signal_common()
- Gate send_signal_kworker on a new kworker_test global that only this
  test sets. (Sashiko AI review)
- Put /* of a multi line comment on its own line (Sashiko AI review)

v1: https://lore.kernel.org/bpf/20260902150439.692725-1-adi.sharma@zohomail.in/ (local)

Aditya Sharma (2):
  bpf: Remove nmi_uaccess_okay() check in bpf_send_signal_common()
  selftests/bpf: Test bpf_send_signal_task() from kernel thread context

 kernel/trace/bpf_trace.c                      |   9 +-
 .../selftests/bpf/prog_tests/send_signal.c    | 106 ++++++++++++++++++
 .../bpf/progs/test_send_signal_kern.c         |  29 +++++
 3 files changed, 138 insertions(+), 6 deletions(-)


base-commit: 61c1e63c9b651a77b1e24208b9361965c69959e6
-- 
2.34.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help