All of lore.kernel.org
 help / color / mirror / Atom feed
* [net v3] tcp: Specify cmsgbuf is user pointer for receive zerocopy.
@ 2021-05-06 22:35 Arjun Roy
  2021-05-07  1:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Arjun Roy @ 2021-05-06 22:35 UTC (permalink / raw)
  To: davem, netdev; +Cc: arjunroy, edumazet, soheil, kuba

From: Arjun Roy <arjunroy@google.com>

A prior change (1f466e1f15cf) introduces separate handling for
->msg_control depending on whether the pointer is a kernel or user
pointer. However, while tcp receive zerocopy is using this field, it
is not properly annotating that the buffer in this case is a user
pointer. This can cause faults when the improper mechanism is used
within put_cmsg().

This patch simply annotates tcp receive zerocopy's use as explicitly
being a user pointer.

Fixes: 7eeba1706eba ("tcp: Add receive timestamp support for receive zerocopy.")
Signed-off-by: Arjun Roy <arjunroy@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>

---

Changelog since v1:
- Updated "Fixes" tag and commit message to properly account for which
  commit introduced buggy behaviour.

 net/ipv4/tcp.c | 1 +
 1 file changed, 1 insertion(+)

Changelog since v2:
- Updated CC list. Added review-by annotation.

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index e14fd0c50c10..f1c1f9e3de72 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2039,6 +2039,7 @@ static void tcp_zc_finalize_rx_tstamp(struct sock *sk,
 		(__kernel_size_t)zc->msg_controllen;
 	cmsg_dummy.msg_flags = in_compat_syscall()
 		? MSG_CMSG_COMPAT : 0;
+	cmsg_dummy.msg_control_is_user = true;
 	zc->msg_flags = 0;
 	if (zc->msg_control == msg_control_addr &&
 	    zc->msg_controllen == cmsg_dummy.msg_controllen) {
-- 
2.31.1.607.g51e8a6a459-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [net v3] tcp: Specify cmsgbuf is user pointer for receive zerocopy.
  2021-05-06 22:35 [net v3] tcp: Specify cmsgbuf is user pointer for receive zerocopy Arjun Roy
@ 2021-05-07  1:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-07  1:10 UTC (permalink / raw)
  To: Arjun Roy; +Cc: davem, netdev, arjunroy, edumazet, soheil, kuba

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Thu,  6 May 2021 15:35:30 -0700 you wrote:
> From: Arjun Roy <arjunroy@google.com>
> 
> A prior change (1f466e1f15cf) introduces separate handling for
> ->msg_control depending on whether the pointer is a kernel or user
> pointer. However, while tcp receive zerocopy is using this field, it
> is not properly annotating that the buffer in this case is a user
> pointer. This can cause faults when the improper mechanism is used
> within put_cmsg().
> 
> [...]

Here is the summary with links:
  - [net,v3] tcp: Specify cmsgbuf is user pointer for receive zerocopy.
    https://git.kernel.org/netdev/net/c/a6f8ee58a8e3

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] 2+ messages in thread

end of thread, other threads:[~2021-05-07  1:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 22:35 [net v3] tcp: Specify cmsgbuf is user pointer for receive zerocopy Arjun Roy
2021-05-07  1: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.