Skip to content

Make 2-byte access to bpf_sk_lookup->remote_port endian-agnostic

Jakub Sitnicki bpf netdev 2 versions – Applied

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

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 0 repliesApplied 3/3
  2. v13 patches 3 repliesSuperseded

Changes in v2 from the cover letter

- Remove needless check that 4-byte load is from &ctx->remote_port offset (Martin)

Patches in v2 All 3 applied

#Subject and filesSizeRepliesApplied
1/3bpf: Treat bpf_sk_lookup remote_port as a 2-byte fieldnet/core/filter.c+18 -20 repliesApplied
2/3selftests/bpf: Fix u8 narrow load checks for bpf_sk_lookup remote_porttools/testing/selftests/bpf/progs/test_sk_lookup.c+1 -20 repliesApplied
3/3selftests/bpf: Fix test for 4-byte load from remote_port on big-endiantools/testing/selftests/bpf/progs/test_sk_lookup.c+8 -20 repliesApplied

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchMartin KaFai Lau
1/3A-b
2/3A-b
3/3A-b

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 bpf-next v2 0/3] Make 2-byte access to bpf_sk_lookup->remote_port endian-agnostic

This patch set is a result of a discussion we had around the RFC patchset from Ilya [1]. The fix for the narrow loads from the RFC series is still relevant, but this series does not depend on it. Nor is it required to unbreak sk_lookup tests on BE, if this series gets applied.

To summarize the takeaways from [1]:

1) we want to make 2-byte load from ctx->remote_port portable across LE and BE,
2) we keep the 4-byte load from ctx->remote_port as it is today - result varies on endianess of the platform.

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

v1 -> v2:
- Remove needless check that 4-byte load is from &ctx->remote_port offset (Martin)

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

Jakub Sitnicki (3):
bpf: Treat bpf_sk_lookup remote_port as a 2-byte field selftests/bpf: Fix u8 narrow load checks for bpf_sk_lookup remote_port selftests/bpf: Fix test for 4-byte load from remote_port on big-endian

 net/core/filter.c                             | 20 +++++++++++++++++--
 .../selftests/bpf/progs/test_sk_lookup.c      | 13 ++++++++----
 2 files changed, 27 insertions(+), 6 deletions(-)
Signature · 1 line
2.35.1