* [PATCH net-next v7 0/2] Add F_SETFL for fcntl in test_sockmap
@ 2024-06-12 9:19 Geliang Tang
2024-06-12 9:19 ` [PATCH net-next v7 1/2] tls: receive msg again for sk_redirect Geliang Tang
2024-06-12 9:19 ` [PATCH net-next v7 2/2] selftests/bpf: Add F_SETFL for fcntl in test_sockmap Geliang Tang
0 siblings, 2 replies; 4+ messages in thread
From: Geliang Tang @ 2024-06-12 9:19 UTC (permalink / raw)
To: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan, Boris Pismenny, Jakub Kicinski,
David S. Miller, Eric Dumazet, Paolo Abeni, Jakub Sitnicki
Cc: Geliang Tang, bpf, linux-kselftest, netdev
From: Geliang Tang <tanggeliang@kylinos.cn>
v7:
- a better fix for tls_sw_recvmsg.
v6:
- add a fix for tls_sw_recvmsg().
v5:
- add a new patch "Check recv lengths in test_sockmap" instead of using
"continue" in msg_loop.
v4:
- address Martin's comments for v3. (thanks.)
- add Yonghong's "Acked-by" tags. (thanks.)
- update subject-prefix from "bpf-next" to "bpf".
Patch 1, v3 of "selftests/bpf: Add F_SETFL for fcntl":
- detect nonblock flag automatically, then test_sockmap can run in both
block and nonblock modes.
- use continue instead of again in v2.
Patch 2, fix for umount cgroup2 error.
Geliang Tang (2):
tls: receive msg again for sk_redirect
selftests/bpf: Add F_SETFL for fcntl in test_sockmap
net/tls/tls_sw.c | 3 +++
tools/testing/selftests/bpf/test_sockmap.c | 4 +++-
2 files changed, 6 insertions(+), 1 deletion(-)
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next v7 1/2] tls: receive msg again for sk_redirect
2024-06-12 9:19 [PATCH net-next v7 0/2] Add F_SETFL for fcntl in test_sockmap Geliang Tang
@ 2024-06-12 9:19 ` Geliang Tang
2024-06-12 23:40 ` Jakub Kicinski
2024-06-12 9:19 ` [PATCH net-next v7 2/2] selftests/bpf: Add F_SETFL for fcntl in test_sockmap Geliang Tang
1 sibling, 1 reply; 4+ messages in thread
From: Geliang Tang @ 2024-06-12 9:19 UTC (permalink / raw)
To: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan, Boris Pismenny, Jakub Kicinski,
David S. Miller, Eric Dumazet, Paolo Abeni, Jakub Sitnicki
Cc: Geliang Tang, bpf, linux-kselftest, netdev
From: Geliang Tang <tanggeliang@kylinos.cn>
tls_sw doesn't work for sk_redirect in nonblock mode, sk_msg_recvmsg()
returns 0 in that case in tls_sw_recvmsg(). This patch fixes this by using
"continue" to receive msg again instead of ending it if strp isn't ready
and rx_list is empty.
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
net/tls/tls_sw.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 305a412785f5..ae8bbe7dc8ec 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -2017,6 +2017,9 @@ int tls_sw_recvmsg(struct sock *sk,
len -= chunk;
continue;
}
+ if (!chunk && !tls_strp_msg_ready(ctx) &&
+ skb_queue_empty_lockless(&ctx->rx_list))
+ continue;
}
goto recv_end;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net-next v7 2/2] selftests/bpf: Add F_SETFL for fcntl in test_sockmap
2024-06-12 9:19 [PATCH net-next v7 0/2] Add F_SETFL for fcntl in test_sockmap Geliang Tang
2024-06-12 9:19 ` [PATCH net-next v7 1/2] tls: receive msg again for sk_redirect Geliang Tang
@ 2024-06-12 9:19 ` Geliang Tang
1 sibling, 0 replies; 4+ messages in thread
From: Geliang Tang @ 2024-06-12 9:19 UTC (permalink / raw)
To: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan, Boris Pismenny, Jakub Kicinski,
David S. Miller, Eric Dumazet, Paolo Abeni, Jakub Sitnicki
Cc: Geliang Tang, bpf, linux-kselftest, netdev
From: Geliang Tang <tanggeliang@kylinos.cn>
Incorrect arguments are passed to fcntl() in test_sockmap.c when invoking
it to set file status flags. If O_NONBLOCK is used as 2nd argument and
passed into fcntl, -EINVAL will be returned (See do_fcntl() in fs/fcntl.c).
The correct approach is to use F_SETFL as 2nd argument, and O_NONBLOCK as
3rd one.
Fixes: 16962b2404ac ("bpf: sockmap, add selftests")
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
---
tools/testing/selftests/bpf/test_sockmap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c
index 9cba4ec844a5..99d3ca8e44bb 100644
--- a/tools/testing/selftests/bpf/test_sockmap.c
+++ b/tools/testing/selftests/bpf/test_sockmap.c
@@ -604,7 +604,9 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt,
struct timeval timeout;
fd_set w;
- fcntl(fd, fd_flags);
+ if (fcntl(fd, F_SETFL, fd_flags))
+ goto out_errno;
+
/* Account for pop bytes noting each iteration of apply will
* call msg_pop_data helper so we need to account for this
* by calculating the number of apply iterations. Note user
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v7 1/2] tls: receive msg again for sk_redirect
2024-06-12 9:19 ` [PATCH net-next v7 1/2] tls: receive msg again for sk_redirect Geliang Tang
@ 2024-06-12 23:40 ` Jakub Kicinski
0 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2024-06-12 23:40 UTC (permalink / raw)
To: Geliang Tang
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan, Boris Pismenny, David S. Miller,
Eric Dumazet, Paolo Abeni, Jakub Sitnicki, Geliang Tang, bpf,
linux-kselftest, netdev
On Wed, 12 Jun 2024 17:19:03 +0800 Geliang Tang wrote:
> tls_sw doesn't work for sk_redirect in nonblock mode, sk_msg_recvmsg()
> returns 0 in that case in tls_sw_recvmsg(). This patch fixes this by using
> "continue" to receive msg again instead of ending it if strp isn't ready
> and rx_list is empty.
Can you explain what user-visible behavior problem you're trying to fix?
sk_msg_recvmsg() returns 0, but tls_sw_recvmsg() will return -EAGAIN as
a whole, so everything seems in order.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-12 23:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-12 9:19 [PATCH net-next v7 0/2] Add F_SETFL for fcntl in test_sockmap Geliang Tang
2024-06-12 9:19 ` [PATCH net-next v7 1/2] tls: receive msg again for sk_redirect Geliang Tang
2024-06-12 23:40 ` Jakub Kicinski
2024-06-12 9:19 ` [PATCH net-next v7 2/2] selftests/bpf: Add F_SETFL for fcntl in test_sockmap Geliang Tang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox