summaryrefslogtreecommitdiff
path: root/tools/lib
diff options
context:
space:
mode:
authorMcCabe, Robert J <robert.mccabe@rockwellcollins.com>2019-04-19 18:37:20 -0500
committerAlexei Starovoitov <ast@kernel.org>2019-04-19 17:05:48 -0700
commit4519efa6f8ea343e43ade21b0189b0b295439202 (patch)
tree2172562ab6a1f435765957254b0ee7b85627d7cd /tools/lib
parent80695946737dff4cfc1ecdefd4ebf300f132d8ee (diff)
downloadlinux-rpi-4519efa6f8ea343e43ade21b0189b0b295439202.tar.gz
linux-rpi-4519efa6f8ea343e43ade21b0189b0b295439202.tar.bz2
linux-rpi-4519efa6f8ea343e43ade21b0189b0b295439202.zip
libbpf: fix BPF_LOG_BUF_SIZE off-by-one error
The BPF_PROG_LOAD condition for kernel version <= 5.1 is log->len_total > UINT_MAX >> 8 /* (16 * 1024 * 1024) - 1 */ Signed-off-by: McCabe, Robert J <robert.mccabe@rockwellcollins.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/bpf/bpf.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
index bc30783d1403..ff2506fe6bd2 100644
--- a/tools/lib/bpf/bpf.h
+++ b/tools/lib/bpf/bpf.h
@@ -92,7 +92,7 @@ struct bpf_load_program_attr {
#define MAPS_RELAX_COMPAT 0x01
/* Recommend log buffer size */
-#define BPF_LOG_BUF_SIZE (16 * 1024 * 1024) /* verifier maximum in kernels <= 5.1 */
+#define BPF_LOG_BUF_SIZE (UINT32_MAX >> 8) /* verifier maximum in kernels <= 5.1 */
LIBBPF_API int
bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr,
char *log_buf, size_t log_buf_sz);