diff options
author | Matthieu Baerts (NGI0) <matttbe@kernel.org> | 2024-02-23 21:17:55 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-02-26 18:42:12 -0800 |
commit | dcc03f270d1e2f4b9715537d8deb734bd019e187 (patch) | |
tree | 1ad91eaa6a65cdfb00abbc7b093042bd4519cb2c /tools/perf/scripts/python/stackcollapse.py | |
parent | 28de50eeb734bbdbc1c4397134fa3501d3490a62 (diff) |
mptcp: check the protocol in tcp_sk() with DEBUG_NET
Fuzzers and static checkers might not detect when tcp_sk() is used with
a non tcp_sock structure.
This kind of mistake already happened a few times with MPTCP: when
wrongly using TCP-specific helpers with mptcp_sock pointers. On the
other hand, there are many 'tcp_xxx()' helpers that are taking a 'struct
sock' pointer as arguments, and some of them are only looking at fields
from 'struct sock', and nothing from 'struct tcp_sock'. It is then
tempting to use them with a 'struct mptcp_sock'.
So a new simple check is done when CONFIG_DEBUG_NET is enabled to tell
kernel devs when a non-TCP socket is being used as a TCP one. 'tcp_sk()'
macro is then re-defined to add a WARN when an unexpected socket is
being used.
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://lore.kernel.org/r/20240223-upstream-net-next-20240223-misc-improvements-v1-3-b6c8a10396bd@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions