[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190729215111.209219-1-sdf@google.com>
Date: Mon, 29 Jul 2019 14:51:09 -0700
From: Stanislav Fomichev <sdf@...gle.com>
To: netdev@...r.kernel.org, bpf@...r.kernel.org
Cc: davem@...emloft.net, ast@...nel.org, daniel@...earbox.net,
Stanislav Fomichev <sdf@...gle.com>
Subject: [PATCH bpf-next 0/2] bpf: allocate extra memory for setsockopt hook buffer
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
Powered by blists - more mailing lists