* [PATCH bpf] bpf, sockmap: Stop the sk_msg verdict loop on a fatal signal
@ 2026-11-30 11:34 Sechang Lim
0 siblings, 0 replies; only message in thread
From: Sechang Lim @ 2026-11-30 11:34 UTC (permalink / raw)
To: bpf
Cc: netdev, john.fastabend, jakub, jiayuan.chen, edumazet, ncardwell,
kuniyu, davem, kuba, pabeni, willemb, horms, daniel
tcp_bpf_send_verdict() loops as long as msg has data left, sending at
most apply_bytes per round and running the SK_MSG program again when
apply_bytes is used up. A program that pushes at least as many bytes
as it applies, e.g. an 8-byte header with apply_bytes 8, keeps msg from
ever draining. With a redirect to a socket that keeps reading, send()
never returns and the task ignores SIGKILL.
Free the rest of msg and return -EINTR when a fatal signal is pending,
as the push error path does.
Fixes: 6fff607e2f14 ("bpf: sk_msg program helper bpf_msg_push_data")
Signed-off-by: Sechang Lim <rhkrqnwk98@gmail.com>
---
net/ipv4/tcp_bpf.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c
index 788ce08eef4d..f62c3238c300 100644
--- a/net/ipv4/tcp_bpf.c
+++ b/net/ipv4/tcp_bpf.c
@@ -580,8 +580,13 @@ static int tcp_bpf_send_verdict(struct sock *sk, struct sk_psock *psock,
}
if (msg &&
msg->sg.data[msg->sg.start].page_link &&
- msg->sg.data[msg->sg.start].length)
+ msg->sg.data[msg->sg.start].length) {
+ if (fatal_signal_pending(current)) {
+ *copied -= sk_msg_free(sk, msg);
+ return -EINTR;
+ }
goto more_data;
+ }
}
return ret;
}
--
2.56.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-30 11:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 11:34 [PATCH bpf] bpf, sockmap: Stop the sk_msg verdict loop on a fatal signal Sechang Lim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox