Skip to content

Commit 3d42b90

Browse files
committed
DO-NOT-MERGE: mptcp: improve code coverage for CI
tcp: warn if tcp_done() is called on a closed socket This is an extra check mainly for the CIs: to make sure we don't call tcp_done() on an already closed socket as it happened in the past. If we do such call, better to catch the error earlier. mptcp: warn in case of bogus mpc option on established client sk As discussed on [1], an additional check is done to catch local software bug. This patch is supposed to land only in our tree, for both 'export' and 'export-net' branches, because the warning could be triggered by bugged / malicious peer. We want it in our tree for our CI to detect internal bugs. Link: https://lore.kernel.org/all/[email protected]/ [1] Signed-off-by: Matthieu Baerts <[email protected]>
1 parent fe02aa8 commit 3d42b90

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

net/ipv4/tcp.c

+2
Original file line numberDiff line numberDiff line change
@@ -4925,6 +4925,8 @@ void tcp_done(struct sock *sk)
49254925
*/
49264926
req = rcu_dereference_protected(tcp_sk(sk)->fastopen_rsk, 1);
49274927

4928+
WARN_ON_ONCE(sk->sk_state == TCP_CLOSE);
4929+
49284930
if (sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV)
49294931
TCP_INC_STATS(sock_net(sk), TCP_MIB_ATTEMPTFAILS);
49304932

net/mptcp/Kconfig

+9
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,13 @@ config MPTCP_KUNIT_TEST
3636

3737
If unsure, say N.
3838

39+
config GCOV_PROFILE_MPTCP
40+
bool "Enable GCOV profiling on MPTCP"
41+
depends on GCOV_KERNEL
42+
help
43+
Enable GCOV profiling on MPTCP for checking which functions/lines
44+
are executed.
45+
46+
If unsure, say N.
47+
3948
endif

net/mptcp/Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ mptcp_token_test-objs := token_test.o
1313
obj-$(CONFIG_MPTCP_KUNIT_TEST) += mptcp_crypto_test.o mptcp_token_test.o
1414

1515
obj-$(CONFIG_BPF_SYSCALL) += bpf.o
16+
17+
# for GCOV coverage profiling
18+
ifdef CONFIG_GCOV_PROFILE_MPTCP
19+
GCOV_PROFILE := y
20+
endif

net/mptcp/options.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,8 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk,
987987
WRITE_ONCE(msk->pm.remote_deny_join_id0, true);
988988

989989
if (unlikely(!READ_ONCE(msk->pm.server_side)))
990-
pr_warn_once("bogus mpc option on established client sk");
990+
/* DO-NOT-MERGE: use WARN i/o pr_warn: only for MPTCP export */
991+
WARN_ONCE(1, "bogus mpc option on established client sk");
991992

992993
set_fully_established:
993994
mptcp_data_lock((struct sock *)msk);

0 commit comments

Comments
 (0)