lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240326101742.17421-4-aspsk@isovalent.com>
Date: Tue, 26 Mar 2024 10:17:42 +0000
From: Anton Protopopov <aspsk@...valent.com>
To: Alexei Starovoitov <ast@...nel.org>,
	Andrii Nakryiko <andrii@...nel.org>,
	Daniel Borkmann <daniel@...earbox.net>,
	Jiri Olsa <jolsa@...nel.org>,
	Martin KaFai Lau <martin.lau@...ux.dev>,
	Stanislav Fomichev <sdf@...gle.com>,
	bpf@...r.kernel.org
Cc: Anton Protopopov <aspsk@...valent.com>,
	Rumen Telbizov <rumen.telbizov@...losecurity.com>,
	David Ahern <dsahern@...nel.org>,
	netdev@...r.kernel.org
Subject: [PATCH v2 bpf-next 3/3] bpf: add a check for struct bpf_fib_lookup size

The struct bpf_fib_lookup should not grow outside of its 64 bytes.
Add a static assert to validate this.

Suggested-by: David Ahern <dsahern@...nel.org>
Signed-off-by: Anton Protopopov <aspsk@...valent.com>
---
 net/core/filter.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/core/filter.c b/net/core/filter.c
index 1205dd777dc2..786d792ac816 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -87,6 +87,9 @@
 
 #include "dev.h"
 
+/* Keep the struct bpf_fib_lookup small so that it fits into a cacheline */
+static_assert(sizeof(struct bpf_fib_lookup) == 64, "struct bpf_fib_lookup size check");
+
 static const struct bpf_func_proto *
 bpf_sk_base_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog);
 
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ