Skip to content

bpf: tcp: Fix type confusion in bpf helper functions.

Kuniyuki Iwashima bpf mptcp netdev sashiko 2 versions – Applied

Status from this message: This series was applied to bpf/bpf.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 5 repliesApplied 6/6
  2. v12 patches 3 repliesSuperseded

Changes in v2 from the cover letter

* Inverse if (err) to if (!err) in the selftest
* Add patch 3 ~ 6

Patches in v2 All 6 applied

#Subject and filesSizeRepliesApplied
1/6bpf: tcp: Fix type confusion in bpf_tcp_sock().net/core/filter.c+1 -12 repliesApplied
2/6selftest: bpf: Add test for bpf_tcp_sock() and RAW socket.tools/testing/selftests/bpf/prog_tests/sockopt_sk.c tools/testing/selftests/bpf/progs/sockopt_sk.c+33 -11 replyApplied
3/6mptcp: bpf: fix type confusion in bpf_mptcp_sock_from_subflow()net/mptcp/bpf.c+1 -12 repliesApplied
4/6bpf: tcp: Fix type confusion in bpf_skc_to_tcp_sock().net/core/filter.c+1 -10 repliesApplied
5/6bpf: tcp: Fix type confusion in bpf_skc_to_tcp6_sock().net/core/filter.c+1 -10 repliesApplied
6/6bpf: tcp: Fix type confusion in sol_tcp_sockopt().net/core/filter.c+1 -10 repliesApplied

Reviews trailers per patch

2 of 6 patches have a Reviewed-by or Acked-by.

PatchDaniel BorkmannKuniyuki Iwashima
1/6A-b
2/6
3/6R-b
4/6
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 bpf 0/6] bpf: tcp: Fix type confusion in bpf helper functions.

bpf_tcp_sock() only check if sk->sk_protocol is IPPROTO_TCP, but RAW socket can bypass it:

socket(AF_INET, SOCK_RAW, IPPROTO_TCP)

The same issues exist in other bpf functions:

* bpf_mptcp_sock_from_subflow()
* bpf_skc_to_tcp_sock()
* bpf_skc_to_tcp6_sock()
* sol_tcp_sockopt()

Patch 1 fixes bpf_tcp_sock() and Patch 2 adds a test for it. Patch 3 ~ 6 fix the rest of the functions above.

Changes:
v2:
* Inverse if (err) to if (!err) in the selftest
* Add patch 3 ~ 6

v1: https://lore.kernel.org/bpf/[email protected]/

      https://lore.kernel.org/mptcp/[email protected]/

Kuniyuki Iwashima (5):
bpf: tcp: Fix type confusion in bpf_tcp_sock().
selftest: bpf: Add test for bpf_tcp_sock() and RAW socket.
bpf: tcp: Fix type confusion in bpf_skc_to_tcp_sock().
bpf: tcp: Fix type confusion in bpf_skc_to_tcp6_sock().
bpf: tcp: Fix type confusion in sol_tcp_sockopt().

Matthieu Baerts (NGI0) (1):
mptcp: bpf: fix type confusion in bpf_mptcp_sock_from_subflow()

 net/core/filter.c                              |  8 ++++----
 net/mptcp/bpf.c                                |  2 +-
 .../selftests/bpf/prog_tests/sockopt_sk.c      | 18 +++++++++++++++++-
 tools/testing/selftests/bpf/progs/sockopt_sk.c | 16 ++++++++++++++++
 4 files changed, 38 insertions(+), 6 deletions(-)
Signature · 1 line
2.54.0.545.g6539524ca2-goog