tcp: Specify cmsgbuf is user pointer for receive zerocopy.
Subsystems (3)
From: Arjun Roy <[email protected]>
A prior change introduces separate handling for ->msg_control depending on whether the pointer is a kernel or user pointer. However, it does not update tcp receive zerocopy (which uses a user pointer), which can cause faults when the improper mechanism is used.
This patch simply annotates tcp receive zerocopy's use as explicitly being a user pointer.
--- net/ipv4/tcp.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/tcp.c +1 -0
@@ -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) {
Signature · 1 line
2.31.1.607.g51e8a6a459-goog
Soheil Hassas Yeganeh
Acked-byQuoted 8 lines · Arjun Roy
From: Arjun Roy <[email protected]>
A prior change introduces separate handling for ->msg_control depending on whether the pointer is a kernel or user pointer. However, it does not update tcp receive zerocopy (which uses a user pointer), which can cause faults when the improper mechanism is used.
Quoted 5 lines
This patch simply annotates tcp receive zerocopy's use as explicitly being a user pointer.
Fixes 1f466e1f15cf ("net: cleanly handle kernel vs user buffers for ->msg_control")Signed-off-by Arjun Roy <[email protected]>
Thank you for the fix!
Quoted 19 lines
--- net/ipv4/tcp.c | 1 + 1 file changed, 1 insertion(+)net/ipv4/tcp.c +1
-1@@ -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
Quoted 8 lines · Arjun Roy
From: Arjun Roy <[email protected]>
A prior change introduces separate handling for ->msg_control depending on whether the pointer is a kernel or user pointer. However, it does not update tcp receive zerocopy (which uses a user pointer), which can cause faults when the improper mechanism is used.
Quoted 4 lines
This patch simply annotates tcp receive zerocopy's use as explicitly being a user pointer.
Fixes 1f466e1f15cf ("net: cleanly handle kernel vs user buffers for ->msg_control")
This Fixes: tag is wrong.
When this commit was merged, tcp_zc_finalize_rx_tstamp() was not yet there.
Quoted 20 lines
Signed-off-by Arjun Roy <[email protected]>--- net/ipv4/tcp.c | 1 + 1 file changed, 1 insertion(+)net/ipv4/tcp.c +1
-1@@ -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
Quoted 10 lines · Eric Dumazet
Quoted 8 lines · Arjun Roy
From: Arjun Roy <[email protected]>
A prior change introduces separate handling for ->msg_control depending on whether the pointer is a kernel or user pointer. However, it does not update tcp receive zerocopy (which uses a user pointer), which can cause faults when the improper mechanism is used.
Quoted 9 lines
Quoted 4 lines
This patch simply annotates tcp receive zerocopy's use as explicitly being a user pointer.
Fixes 1f466e1f15cf ("net: cleanly handle kernel vs user buffers for ->msg_control")This Fixes: tag is wrong.
When this commit was merged,
tcp_zc_finalize_rx_tstamp()was not yet there.
Makes sense - I'll send out an amended v2 patch that tags '7eeba1706eba' instead.
-Arjun
Quoted 20 lines
Quoted 20 lines
Signed-off-by Arjun Roy <[email protected]>--- net/ipv4/tcp.c | 1 + 1 file changed, 1 insertion(+)net/ipv4/tcp.c +1
-1@@ -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