Commit f3b8c28
Martin KaFai Lau
Merge branch 'bpf-tcp-fix-type-confusion-in-bpf-helper-functions'
Kuniyuki Iwashima says:
====================
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/20260430184405.1227386-1-kuniyu@google.com/
https://lore.kernel.org/mptcp/20260430-mptcp-bpf-mptcp-sock-type-v1-1-d2ed5cda7da9@kernel.org/
====================
Link: https://patch.msgid.link/20260504210610.180150-1-kuniyu@google.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>4 files changed
Lines changed: 37 additions & 6 deletions
File tree
- net
- core
- mptcp
- tools/testing/selftests/bpf
- prog_tests
- progs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5481 | 5481 | | |
5482 | 5482 | | |
5483 | 5483 | | |
5484 | | - | |
| 5484 | + | |
5485 | 5485 | | |
5486 | 5486 | | |
5487 | 5487 | | |
| |||
7475 | 7475 | | |
7476 | 7476 | | |
7477 | 7477 | | |
7478 | | - | |
| 7478 | + | |
7479 | 7479 | | |
7480 | 7480 | | |
7481 | 7481 | | |
| |||
11947 | 11947 | | |
11948 | 11948 | | |
11949 | 11949 | | |
11950 | | - | |
| 11950 | + | |
11951 | 11951 | | |
11952 | 11952 | | |
11953 | 11953 | | |
| |||
11963 | 11963 | | |
11964 | 11964 | | |
11965 | 11965 | | |
11966 | | - | |
| 11966 | + | |
11967 | 11967 | | |
11968 | 11968 | | |
11969 | 11969 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
| 193 | + | |
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
214 | 229 | | |
215 | 230 | | |
216 | 231 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
152 | 166 | | |
153 | 167 | | |
154 | 168 | | |
| |||
224 | 238 | | |
225 | 239 | | |
226 | 240 | | |
| 241 | + | |
| 242 | + | |
227 | 243 | | |
228 | 244 | | |
229 | 245 | | |
| |||
0 commit comments