netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] bpf: allocate extra memory for setsockopt hook buffer
@ 2019-07-29 21:51 Stanislav Fomichev
  2019-07-29 21:51 ` [PATCH bpf-next 1/2] bpf: always allocate at least 16 bytes for setsockopt hook Stanislav Fomichev
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Stanislav Fomichev @ 2019-07-29 21:51 UTC (permalink / raw)
  To: netdev, bpf; +Cc: davem, ast, daniel, Stanislav Fomichev

Current setsockopt hook is limited to the size of the buffer that
user had supplied. Since we always allocate memory and copy the value
into kernel space, allocate just a little bit more in case BPF
program needs to override input data with a larger value.

The canonical example is TCP_CONGESTION socket option where
input buffer is a string and if user calls it with a short string,
BPF program has no way of extending it.

The tests are extended with TCP_CONGESTION use case.

Stanislav Fomichev (2):
  bpf: always allocate at least 16 bytes for setsockopt hook
  selftests/bpf: extend sockopt_sk selftest with TCP_CONGESTION use case

 kernel/bpf/cgroup.c                           | 17 ++++++++++---
 .../testing/selftests/bpf/progs/sockopt_sk.c  | 22 ++++++++++++++++
 tools/testing/selftests/bpf/test_sockopt_sk.c | 25 +++++++++++++++++++
 3 files changed, 60 insertions(+), 4 deletions(-)

-- 
2.22.0.709.g102302147b-goog

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

end of thread, other threads:[~2019-08-01 21:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-29 21:51 [PATCH bpf-next 0/2] bpf: allocate extra memory for setsockopt hook buffer Stanislav Fomichev
2019-07-29 21:51 ` [PATCH bpf-next 1/2] bpf: always allocate at least 16 bytes for setsockopt hook Stanislav Fomichev
2019-07-29 21:51 ` [PATCH bpf-next 2/2] selftests/bpf: extend sockopt_sk selftest with TCP_CONGESTION use case Stanislav Fomichev
2019-08-01 20:58 ` [PATCH bpf-next 0/2] bpf: allocate extra memory for setsockopt hook buffer Alexei Starovoitov
2019-08-01 21:11   ` Stanislav Fomichev
2019-08-01 21:29     ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).