Re: [PATCH bpf 1/2] bpf, sockmap: Stop reporting EPIPE on zero-length skb redirect

From: Eli Skeggs

Date: Sun Oct 25 2026 - 22:26:06 EST


On Mon, Oct 26, 2026 at 01:51:43AM +0000, Alexei Starovoitov wrote:
> On Sun, Oct 25, 2026 at 04:41 PM Eli Skeggs via B4 Relay <devnull+kernel.eliskeggs.com@xxxxxxxxxx> wrote:
> > On an ingress redirect, the empty message is still queued as before, but
> > the target socket no longer reports EPIPE.
>
> That leaves the target broken.
> Nothing dequeues the empty sk_msg. __sk_msg_recvmsg() sees
> sge->length == 0, returns -EFAULT and leaves it at the head of ingress_msg.
> tcp_bpf_recvmsg_parser() finds FIN in is_next_msg_fin(), returns 0 and
> does copied_seq++ on a socket that didn't receive any FIN.
> So every recv() on the target returns 0 and moves its copied_seq further
> past rcv_nxt, and the data redirected from other sockets stays behind
> that msg forever.

Thanks, I'd missed that detail of __sk_msg_recvmsg().

> Lets skip empty skbs instead. That covers both directions.
> The socket's own FIN that goes through the backlog is not queued either,
> but SOCK_DONE check in tcp_bpf_recvmsg_parser() returns 0 anyway.

That does sound much cleaner. v2 will skip empty skbs entirely, and I'll
add a corresponding selftest for the ingress pathway.