diff options
| author | Guillaume Maudoux <layus.on@gmail.com> | 2026-06-30 11:57:23 +0200 |
|---|---|---|
| committer | Andrii Nakryiko <andrii@kernel.org> | 2026-07-01 12:50:30 -0700 |
| commit | b4b8b334f6b535a86ab83f18d3d241fe01270bc3 (patch) | |
| tree | 5c8ecd9922107ab94256c38c62a72e08cdb394ca /tools/perf/scripts/python/stackcollapse.py | |
| parent | c4082e93d9be23833a2310473badf2fff9bd5989 (diff) | |
selftests/bpf: Mask socket type flags in mptcpify prog
The mptcpify BPF prog upgrades eligible TCP sockets to MPTCP, but only
when the socket type is exactly SOCK_STREAM. Its update_socket_protocol()
hook runs on the raw type from userspace, before the socket core masks
it with SOCK_TYPE_MASK, so the type may still carry SOCK_CLOEXEC or
SOCK_NONBLOCK in its upper bits and the equality check fails.
As a result, a socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0) -- what
common libraries do by default -- is silently left as plain TCP. This
was hit in practice with curl. Since mptcpify.c is referenced as example
code for enabling MPTCP transparently, the same mistake is likely to be
copied into real deployments where it fails the same way and is hard to
diagnose.
Mask the type before comparing, mirroring the socket core. Extend the
test to also create the server with SOCK_CLOEXEC set; the same masking
is applied to start_server_addr() so a flagged type still listens.
Fixes: ddba122428a7 ("selftests/bpf: Add mptcpify test")
Signed-off-by: Guillaume Maudoux <layus.on@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://lore.kernel.org/bpf/20260630095723.564392-1-layus.on@gmail.com
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
