RFC bpf_sk_lookup.remote_port fixes
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest3 patches 14 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | bpf: Fix certain narrow loads with offsetskernel/ | +9 | 8 replies | |
| 2/3 | bpf: Fix bpf_sk_lookup.remote_port on big-endianinclude/ net/ tools/ | +32 | 6 replies | |
| 3/3 | selftests/bpf: Adapt bpf_sk_lookup.remote_port loadstools/ | +11 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH RFC bpf-next 0/3] bpf_sk_lookup.remote_port fixes
Hi,
These are my current patches for the discussion from [1] and [2].
With these changes tests pass on both x86_64 and s390x, but there are quite a few things I'm not sure about, hence it's just an RFC:
- Can moving size < target_size check lead to incorrect shifts in some corner cases that I missed?
- Are different layouts of remote_port on little- and big-endian a bug or a feature? Do we want things to be this way? If not, are we bound by the ABI anyway?
- Is there any way to make uapi changes look nicer? A wall of nested structs, unions and ifdefs in an otherwise clean struct definition isn't looking particularly good.
- What is the Officially Approved way to access the remote_port field from C code? I'm leaning towards bpf_ntohs((__u16)remote_port), like in [3], and I adjusted the test accordingly.
[1] https://lore.kernel.org/bpf/CAEf4BzaRNLw9_EnaMo5e46CdEkzbJiVU3j9oxnsemBKjNFf3wQ@mail.gmail.com/
[2] https://lore.kernel.org/bpf/[email protected]/
[3] https://lore.kernel.org/bpf/[email protected]/
Ilya Leoshkevich (3):
bpf: Fix certain narrow loads with offsets
bpf: Fix bpf_sk_lookup.remote_port on big-endian selftests/bpf: Adapt bpf_sk_lookup.remote_port loads
include/uapi/linux/bpf.h | 17 +++++++++++++++-- kernel/bpf/verifier.c | 14 +++++++++----- net/core/filter.c | 5 ++--- tools/include/uapi/linux/bpf.h | 17 +++++++++++++++-- .../selftests/bpf/progs/test_sk_lookup.c | 17 +++++++++++------ 5 files changed, 52 insertions(+), 18 deletions(-)
Signature · 1 line
2.34.1