BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/6] bpf: handle another corner case in getsockopt
@ 2023-04-18 22:53 Stanislav Fomichev
  2023-04-18 22:53 ` [PATCH bpf-next 1/6] bpf: Don't EFAULT for getsockopt with optval=NULL Stanislav Fomichev
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Stanislav Fomichev @ 2023-04-18 22:53 UTC (permalink / raw)
  To: bpf
  Cc: ast, daniel, andrii, martin.lau, song, yhs, john.fastabend,
	kpsingh, sdf, haoluo, jolsa, Martin KaFai Lau

Martin reports another case where getsockopt EFAULTs perfectly
valid callers. Let's fix it and also replace EFAULT with
pr_info_ratelimited. That should hopefully make this place
less error prone.

First 2 patches fix the issue with NETLINK_LIST_MEMBERSHIPS and
test it.

Second 2 patches replace EFAULT with pr_inro_limited and update
the tests.

The remaining patches update documentation and existing selftests
to be more gentle with 'optlen > 4096' cases. People might be
copy-pasting from there, so let's be more pedantic.

Cc: Martin KaFai Lau <martin.lau@kernel.org>

Stanislav Fomichev (6):
  bpf: Don't EFAULT for getsockopt with optval=NULL
  selftests/bpf: Verify optval=NULL case
  bpf: Don't EFAULT for {g,s}setsockopt with wrong optlen
  selftests/bpf: Update EFAULT {g,s}etsockopt selftests
  selftests/bpf: Correctly handle optlen > 4096
  bpf: Document EFAULT changes for sockopt

 Documentation/bpf/prog_cgroup_sockopt.rst     | 64 +++++++++++++++++--
 kernel/bpf/cgroup.c                           | 17 +++--
 .../selftests/bpf/prog_tests/sockopt.c        | 42 ++++--------
 .../selftests/bpf/prog_tests/sockopt_sk.c     | 28 ++++++++
 .../progs/cgroup_getset_retval_getsockopt.c   | 12 ++++
 .../progs/cgroup_getset_retval_setsockopt.c   | 16 +++++
 .../selftests/bpf/progs/sockopt_inherit.c     | 16 ++++-
 .../selftests/bpf/progs/sockopt_multi.c       | 24 ++++++-
 .../selftests/bpf/progs/sockopt_qos_to_cc.c   |  8 ++-
 .../testing/selftests/bpf/progs/sockopt_sk.c  | 33 ++++++++--
 10 files changed, 211 insertions(+), 49 deletions(-)

-- 
2.40.0.634.g4ca3ef3211-goog


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

end of thread, other threads:[~2023-04-26 18:07 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-18 22:53 [PATCH bpf-next 0/6] bpf: handle another corner case in getsockopt Stanislav Fomichev
2023-04-18 22:53 ` [PATCH bpf-next 1/6] bpf: Don't EFAULT for getsockopt with optval=NULL Stanislav Fomichev
2023-04-18 22:53 ` [PATCH bpf-next 2/6] selftests/bpf: Verify optval=NULL case Stanislav Fomichev
2023-04-18 22:53 ` [PATCH bpf-next 3/6] bpf: Don't EFAULT for {g,s}setsockopt with wrong optlen Stanislav Fomichev
2023-04-21 15:24   ` Daniel Borkmann
2023-04-21 16:09     ` Stanislav Fomichev
2023-04-25  0:56       ` Martin KaFai Lau
2023-04-25 17:12         ` Stanislav Fomichev
2023-04-25 18:31           ` Martin KaFai Lau
2023-04-26 17:27             ` Stanislav Fomichev
2023-04-26 18:07               ` Martin KaFai Lau
2023-04-18 22:53 ` [PATCH bpf-next 4/6] selftests/bpf: Update EFAULT {g,s}etsockopt selftests Stanislav Fomichev
2023-04-18 22:53 ` [PATCH bpf-next 5/6] selftests/bpf: Correctly handle optlen > 4096 Stanislav Fomichev
2023-04-18 22:53 ` [PATCH bpf-next 6/6] bpf: Document EFAULT changes for sockopt Stanislav Fomichev
2023-04-19 20:08   ` kernel test robot
2023-04-20 18:17     ` Stanislav Fomichev
2023-04-21 15:20 ` [PATCH bpf-next 0/6] bpf: handle another corner case in getsockopt patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox