Skip to contentSkip to conversation

net: tls: set MSG_SPLICE_PAGES consistently

PATCH Applied Jakub Kicinski 3 participants 3 messages Aug 8, 2023 – Aug 10, 2023

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 net: tls: set MSG_SPLICE_PAGES consistently

We used to change the flags for the last segment, because non-last segments had the MSG_SENDPAGE_NOTLAST flag set. That flag is no longer a thing so remove the setting.

Since flags most likely don't have MSG_SPLICE_PAGES set this avoids passing parts of the sg as splice and parts as non-splice. Before commit under Fixes we'd have called tcp_sendpage() which would add the MSG_SPLICE_PAGES.

Why this leads to trouble remains unclear but Tariq reports hitting the WARN_ON(!sendpage_ok()) due to page refcount of 0.

Fixes e117dcfd646e ("tls: Inline do_tcp_sendpages()")

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 net/tls/tls_main.c | 3 ---
 1 file changed, 3 deletions(-)
net/tls/tls_main.c +0 -3
index 7dbb8cd8f809..f550c84f3408 100644
@@ -139,9 +139,6 @@ int tls_push_sg(struct sock *sk,
 
 	ctx->splicing_pages = true;
 	while (1) {
-		if (sg_is_last(sg))
-			msg.msg_flags = flags;
-
 		/* is sending application-limited? */
 		tcp_rate_check_app_limited(sk);
 		p = sg_page(sg);
Signature · 1 line
2.41.0
Tested-by on v1 1/1
#1 lore raw
Quoted 30 lines · Jakub Kicinski

We used to change the flags for the last segment, because non-last segments had the MSG_SENDPAGE_NOTLAST flag set. That flag is no longer a thing so remove the setting.

Since flags most likely don't have MSG_SPLICE_PAGES set this avoids passing parts of the sg as splice and parts as non-splice. Before commit under Fixes we'd have called tcp_sendpage() which would add the MSG_SPLICE_PAGES.

Why this leads to trouble remains unclear but Tariq reports hitting the WARN_ON(!sendpage_ok()) due to page refcount of 0.

Fixes e117dcfd646e ("tls: Inline do_tcp_sendpages()")

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
  net/tls/tls_main.c | 3 ---
  1 file changed, 3 deletions(-)
net/tls/tls_main.c +0 -0
index 7dbb8cd8f809..f550c84f3408 100644

net/tls/tls_main.c int tls_push_sg(struct sock *sk, · line 144

Quoted 9 lines
net/tls/tls_main.c +0 -3
@@ -139,9 +139,6 @@ int tls_push_sg(struct sock *sk,
 
  	ctx->splicing_pages = true;
  	while (1) {
-		if (sg_is_last(sg))
-			msg.msg_flags = flags;
-
  		/* is sending application-limited? */
  		tcp_rate_check_app_limited(sk);
  		p = sg_page(sg);

Thanks for your patch.

#2 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Tue, 8 Aug 2023 11:09:17 -0700 you wrote:

We used to change the flags for the last segment, because non-last segments had the MSG_SENDPAGE_NOTLAST flag set. That flag is no longer a thing so remove the setting.

Since flags most likely don't have MSG_SPLICE_PAGES set this avoids passing parts of the sg as splice and parts as non-splice. Before commit under Fixes we'd have called tcp_sendpage() which would add the MSG_SPLICE_PAGES.

[...]

Here is the summary with links:
- [net] net: tls: set MSG_SPLICE_PAGES consistently

    https://git.kernel.org/netdev/net/c/6b486676b41c

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html