All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC bpf-next 0/3] bpf_sk_lookup.remote_port fixes
@ 2022-02-22 18:25 Ilya Leoshkevich
  2022-02-22 18:25 ` [PATCH RFC bpf-next 1/3] bpf: Fix certain narrow loads with offsets Ilya Leoshkevich
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Ilya Leoshkevich @ 2022-02-22 18:25 UTC (permalink / raw)
  To: Jakub Sitnicki, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: bpf, Heiko Carstens, Vasily Gorbik, Ilya Leoshkevich

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/20220221180358.169101-1-jakub@cloudflare.com/
[3] https://lore.kernel.org/bpf/20220113070245.791577-1-imagedong@tencent.com/

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(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2022-03-14 21:49 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 18:25 [PATCH RFC bpf-next 0/3] bpf_sk_lookup.remote_port fixes Ilya Leoshkevich
2022-02-22 18:25 ` [PATCH RFC bpf-next 1/3] bpf: Fix certain narrow loads with offsets Ilya Leoshkevich
2022-03-08 15:01   ` Jakub Sitnicki
2022-03-08 23:58     ` Ilya Leoshkevich
2022-03-09  8:36       ` Jakub Sitnicki
2022-03-09 12:34         ` Ilya Leoshkevich
2022-03-10 22:57           ` Jakub Sitnicki
2022-03-14 17:35             ` Jakub Sitnicki
2022-03-14 18:25               ` Ilya Leoshkevich
2022-03-14 20:57                 ` Jakub Sitnicki
2022-02-22 18:25 ` [PATCH RFC bpf-next 2/3] bpf: Fix bpf_sk_lookup.remote_port on big-endian Ilya Leoshkevich
2022-02-27  2:44   ` Alexei Starovoitov
2022-02-27 20:30     ` Jakub Sitnicki
2022-02-28 10:19       ` Ilya Leoshkevich
2022-02-28 13:26         ` Jakub Sitnicki
2022-03-01  0:39           ` Ilya Leoshkevich
2022-03-01  0:40           ` Ilya Leoshkevich
2022-02-22 18:25 ` [PATCH RFC bpf-next 3/3] selftests/bpf: Adapt bpf_sk_lookup.remote_port loads Ilya Leoshkevich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.