mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH bpf-next v2 0/2] bpf: Fix bpf_send_signal_task() from kernel thread context
@ 2026-10-01  7:24 Aditya Sharma
  2026-10-01  7:24 ` [PATCH bpf-next v2 1/2] bpf: Remove nmi_uaccess_okay() check in bpf_send_signal_common() Aditya Sharma
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Aditya Sharma @ 2026-10-01  7:24 UTC (permalink / raw)
  To: bpf
  Cc: ast, daniel, andrii, eddyz87, memxor, martin.lau, song,
	yonghong.song, jolsa, emil, ihor.solodrai, kpsingh, matt,
	rostedt, mhiramat, mathieu.desnoyers, shuah, puranjay,
	linux-kernel, linux-trace-kernel, linux-kselftest, Aditya Sharma

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/

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-10-24  5:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-01  7:24 [PATCH bpf-next v2 0/2] bpf: Fix bpf_send_signal_task() from kernel thread context Aditya Sharma
2026-10-01  7:24 ` [PATCH bpf-next v2 1/2] bpf: Remove nmi_uaccess_okay() check in bpf_send_signal_common() Aditya Sharma
2026-10-01  7:24 ` [PATCH bpf-next v2 2/2] selftests/bpf: Test bpf_send_signal_task() from kernel thread context Aditya Sharma
2026-10-23 12:45 ` [PATCH bpf-next v2 0/2] bpf: Fix " Aditya Sharma
2026-10-23 21:47   ` Andrii Nakryiko
2026-10-24  5:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®