Skip to contentSkip to conversation

mptcp: do not inherit inet proto ops

PATCH New Mat Martineau 1 participant 1 message Jan 24, 2020

Subsystems (3)
lore
Share & tools
lore

Mat Martineau

author
#0 lore raw

PATCH 1/1 mptcp: do not inherit inet proto ops

From: Florian Westphal <fw(a)strlen.de>

We need to initialise the struct ourselves, else we expose tcp-specific callbacks such as tcp_splice_read which will then trigger splat because the socket is an mptcp one:

BUG: KASAN: slab-out-of-bounds in tcp_mstamp_refresh+0x80/0xa0 net/ipv4/tcp_output.c:57
Write of size 8 at addr ffff888116aa21d0 by task syz-executor.0/5478

CPU: 1 PID: 5478 Comm: syz-executor.0 Not tainted 5.5.0-rc6 #3
Call Trace:
 tcp_mstamp_refresh+0x80/0xa0 net/ipv4/tcp_output.c:57
 tcp_rcv_space_adjust+0x72/0x7f0 net/ipv4/tcp_input.c:612
 tcp_read_sock+0x622/0x990 net/ipv4/tcp.c:1674
 tcp_splice_read+0x20b/0xb40 net/ipv4/tcp.c:791
 do_splice+0x1259/0x1560 fs/splice.c:1205

To prevent build error with ipv6, add the recv/sendmsg function declaration to ipv6.h. The functions are already accessible "thanks" to retpoline related work, but they are currently only made visible by socket.c specific INDIRECT_CALLABLE macros.

Reported-by Christoph Paasch <cpaasch(a)apple.com>
Signed-off-by Florian Westphal <fw(a)strlen.de>
Signed-off-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>

---

Patch is from
https://git.breakpoint.cc/cgit/fw/net-next.git/commit/?h=mptcp_fixes_02
and Florian asked me to test and post. (Florian, I wasn't sure if you wanted this on netdev today)

I've confirmed that the MPTCP self-tests pass with this patch applied to net-next and when applied to our export branch. I haven't set up syzkaller locally so I don't have results for that.

 include/net/ipv6.h   |  3 ++
 net/mptcp/protocol.c | 70 ++++++++++++++++++++++++++++++++------------
 2 files changed, 54 insertions(+), 19 deletions(-)
include/net/ipv6.h +3 -0
index 4e95f6df508c..cec1a54401f2 100644
@@ -1113,6 +1113,9 @@ int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
 
 int inet6_hash_connect(struct inet_timewait_death_row *death_row,
 			      struct sock *sk);
+int inet6_sendmsg(struct socket *sock, struct msghdr *msg, size_t size);
+int inet6_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
+		  int flags);
 
 /*
  * reassembly.c
net/mptcp/protocol.c +51 -19

94 lines not on this page · raw message

Signature · 1 line
2.25.0