* [PATCH] tls splice: check SPLICE_F_NONBLOCK instead of MSG_DONTWAIT
@ 2021-05-14 3:11 Jim Ma
2021-05-14 19:27 ` Jakub Kicinski
2021-05-14 22:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 5+ messages in thread
From: Jim Ma @ 2021-05-14 3:11 UTC (permalink / raw)
To: kuba, borisp, john.fastabend, daniel; +Cc: netdev, Jim Ma
In tls_sw_splice_read, checkout MSG_* is inappropriate, should use
SPLICE_*, update tls_wait_data to accept nonblock arguments instead
of flags for recvmsg and splice.
Signed-off-by: Jim Ma <majinjing3@gmail.com>
---
net/tls/tls_sw.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 1dcb34dfd56b..694de024d0ee 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -37,6 +37,7 @@
#include <linux/sched/signal.h>
#include <linux/module.h>
+#include <linux/splice.h>
#include <crypto/aead.h>
#include <net/strparser.h>
@@ -1281,7 +1282,7 @@ int tls_sw_sendpage(struct sock *sk, struct page *page,
}
static struct sk_buff *tls_wait_data(struct sock *sk, struct sk_psock *psock,
- int flags, long timeo, int *err)
+ bool nonblock, long timeo, int *err)
{
struct tls_context *tls_ctx = tls_get_ctx(sk);
struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx);
@@ -1306,7 +1307,7 @@ static struct sk_buff *tls_wait_data(struct sock *sk, struct sk_psock *psock,
if (sock_flag(sk, SOCK_DONE))
return NULL;
- if ((flags & MSG_DONTWAIT) || !timeo) {
+ if (nonblock || !timeo) {
*err = -EAGAIN;
return NULL;
}
@@ -1786,7 +1787,7 @@ int tls_sw_recvmsg(struct sock *sk,
bool async_capable;
bool async = false;
- skb = tls_wait_data(sk, psock, flags, timeo, &err);
+ skb = tls_wait_data(sk, psock, flags & MSG_DONTWAIT, timeo, &err);
if (!skb) {
if (psock) {
int ret = sk_msg_recvmsg(sk, psock, msg, len,
@@ -1990,9 +1991,9 @@ ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos,
lock_sock(sk);
- timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
+ timeo = sock_rcvtimeo(sk, flags & SPLICE_F_NONBLOCK);
- skb = tls_wait_data(sk, NULL, flags, timeo, &err);
+ skb = tls_wait_data(sk, NULL, flags & SPLICE_F_NONBLOCK, timeo, &err);
if (!skb)
goto splice_read_end;
--
2.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] tls splice: check SPLICE_F_NONBLOCK instead of MSG_DONTWAIT
2021-05-14 3:11 [PATCH] tls splice: check SPLICE_F_NONBLOCK instead of MSG_DONTWAIT Jim Ma
@ 2021-05-14 19:27 ` Jakub Kicinski
[not found] ` <SY4P282MB2854227891D8F8F8FF2406E5A72E9@SY4P282MB2854.AUSP282.PROD.OUTLOOK.COM>
2021-05-18 6:17 ` Jim Ma
2021-05-14 22:10 ` patchwork-bot+netdevbpf
1 sibling, 2 replies; 5+ messages in thread
From: Jakub Kicinski @ 2021-05-14 19:27 UTC (permalink / raw)
To: Jim Ma; +Cc: borisp, john.fastabend, daniel, netdev
On Fri, 14 May 2021 11:11:02 +0800 Jim Ma wrote:
> In tls_sw_splice_read, checkout MSG_* is inappropriate, should use
> SPLICE_*, update tls_wait_data to accept nonblock arguments instead
> of flags for recvmsg and splice.
>
> Signed-off-by: Jim Ma <majinjing3@gmail.com>
Fixes: c46234ebb4d1 ("tls: RX path for ktls")
right?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tls splice: check SPLICE_F_NONBLOCK instead of MSG_DONTWAIT
2021-05-14 3:11 [PATCH] tls splice: check SPLICE_F_NONBLOCK instead of MSG_DONTWAIT Jim Ma
2021-05-14 19:27 ` Jakub Kicinski
@ 2021-05-14 22:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-14 22:10 UTC (permalink / raw)
To: Jim Ma; +Cc: kuba, borisp, john.fastabend, daniel, netdev
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
On Fri, 14 May 2021 11:11:02 +0800 you wrote:
> In tls_sw_splice_read, checkout MSG_* is inappropriate, should use
> SPLICE_*, update tls_wait_data to accept nonblock arguments instead
> of flags for recvmsg and splice.
>
> Signed-off-by: Jim Ma <majinjing3@gmail.com>
> ---
> net/tls/tls_sw.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
Here is the summary with links:
- tls splice: check SPLICE_F_NONBLOCK instead of MSG_DONTWAIT
https://git.kernel.org/netdev/net/c/974271e5ed45
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tls splice: check SPLICE_F_NONBLOCK instead of MSG_DONTWAIT
[not found] ` <SY4P282MB2854227891D8F8F8FF2406E5A72E9@SY4P282MB2854.AUSP282.PROD.OUTLOOK.COM>
@ 2021-05-17 16:01 ` Jakub Kicinski
0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2021-05-17 16:01 UTC (permalink / raw)
To: Jim Ma, netdev
On Sun, 16 May 2021 04:58:11 +0000 Jim Ma wrote:
> No, this patch fix using MSG_* in splice.
>
> I have tested read, write, sendmsg, recvmsg fot tls, and try to
> implement tls in golang. In develop, I have found those issues and
> try to fix them.
To be clear the Fixes tag points to the commit where the issue was
first introduced. AFAICT the issue was there from the start, that
is commit c46234ebb4d1 ("tls: RX path for ktls"). Are you saying that
it used to work in the beginning and then another commit broke it?
We need the fixes tag to be able to tell how far back (in terms of
LTS releases) to backport.
> An other issue, when before enable TLS_RX in cleint, the server sends
> a tls record, client will receive bad message or message too long
> error. I'm try to fix this issue.
Please reply all and don't top post.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tls splice: check SPLICE_F_NONBLOCK instead of MSG_DONTWAIT
2021-05-14 19:27 ` Jakub Kicinski
[not found] ` <SY4P282MB2854227891D8F8F8FF2406E5A72E9@SY4P282MB2854.AUSP282.PROD.OUTLOOK.COM>
@ 2021-05-18 6:17 ` Jim Ma
1 sibling, 0 replies; 5+ messages in thread
From: Jim Ma @ 2021-05-18 6:17 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: borisp, john.fastabend, daniel, netdev
Thanks for reminder.
I'm sure that, fix patch fixes: c46234ebb4d1 ("tls: RX path for ktls")
On 2021/5/18, 00:01, "Jakub Kicinski" <kuba@kernel.org> wrote:
On Sun, 16 May 2021 04:58:11 +0000 Jim Ma wrote:
> No, this patch fix using MSG_* in splice.
>
> I have tested read, write, sendmsg, recvmsg fot tls, and try to
> implement tls in golang. In develop, I have found those issues and
> try to fix them.
To be clear the Fixes tag points to the commit where the issue was
first introduced. AFAICT the issue was there from the start, that
is commit c46234ebb4d1 ("tls: RX path for ktls"). Are you saying that
it used to work in the beginning and then another commit broke it?
We need the fixes tag to be able to tell how far back (in terms of
LTS releases) to backport.
> An other issue, when before enable TLS_RX in cleint, the server sends
> a tls record, client will receive bad message or message too long
> error. I'm try to fix this issue.
Please reply all and don't top post.
On 2021/5/15, 03:27, "Jakub Kicinski" <kuba@kernel.org> wrote:
On Fri, 14 May 2021 11:11:02 +0800 Jim Ma wrote:
> In tls_sw_splice_read, checkout MSG_* is inappropriate, should use
> SPLICE_*, update tls_wait_data to accept nonblock arguments instead
> of flags for recvmsg and splice.
>
> Signed-off-by: Jim Ma <majinjing3@gmail.com>
Fixes: c46234ebb4d1 ("tls: RX path for ktls")
right?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-05-18 6:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14 3:11 [PATCH] tls splice: check SPLICE_F_NONBLOCK instead of MSG_DONTWAIT Jim Ma
2021-05-14 19:27 ` Jakub Kicinski
[not found] ` <SY4P282MB2854227891D8F8F8FF2406E5A72E9@SY4P282MB2854.AUSP282.PROD.OUTLOOK.COM>
2021-05-17 16:01 ` Jakub Kicinski
2021-05-18 6:17 ` Jim Ma
2021-05-14 22:10 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.