The test closes the redirect target while the sender waits for its send memory. A part of the data has gone out, so sendmsg() returns that part and the test calls sendmsg() again. With apply_bytes, the previous patch keeps the verdict for the bytes that were not sent. The next sendmsg() sends to the same target and returns -EPIPE, instead of running the prog again, which no longer finds the target in the map and returns SK_DROP, -EACCES. Accept -EPIPE as well. Signed-off-by: Jiayuan Chen <jiay…@linux.dev> --- tools/testing/selftests/bpf/test_sockmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c index aaf2050e88450..771146268df77 100644 --- a/tools/testing/selftests/bpf/test_sockmap.c +++ b/tools/testing/selftests/bpf/test_sockmap.c @@ -566,7 +566,8 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt, sent = sendmsg(fd, &msg, flags); if (!drop && sent < 0) { - if (opt->tx_wait_mem && errno == EACCES) { + if (opt->tx_wait_mem && + (errno == EACCES || errno == EPIPE)) { errno = 0; goto out_errno; }
-- 2.43.0