bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf 1/2] flow_dissector: reject invalid attach_flags
@ 2020-06-12 16:01 Lorenz Bauer
  2020-06-12 16:01 ` [PATCH bpf 2/2] bpf: sockmap: " Lorenz Bauer
  2020-06-12 22:35 ` [PATCH bpf 1/2] flow_dissector: " Alexei Starovoitov
  0 siblings, 2 replies; 9+ messages in thread
From: Lorenz Bauer @ 2020-06-12 16:01 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Jakub Sitnicki
  Cc: kernel-team, Lorenz Bauer, netdev, bpf, linux-kernel

Using BPF_PROG_ATTACH on a flow dissector program supports neither flags
nor target_fd but accepts any value. Return EINVAL if either are non-zero.

Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
Fixes: b27f7bb590ba ("flow_dissector: Move out netns_bpf prog callbacks")
---
 kernel/bpf/net_namespace.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/bpf/net_namespace.c b/kernel/bpf/net_namespace.c
index 78cf061f8179..56133e78ae4f 100644
--- a/kernel/bpf/net_namespace.c
+++ b/kernel/bpf/net_namespace.c
@@ -192,6 +192,9 @@ int netns_bpf_prog_attach(const union bpf_attr *attr, struct bpf_prog *prog)
 	struct net *net;
 	int ret;
 
+	if (attr->attach_flags || attr->target_fd)
+		return -EINVAL;
+
 	type = to_netns_bpf_attach_type(attr->attach_type);
 	if (type < 0)
 		return -EINVAL;
-- 
2.25.1


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

end of thread, other threads:[~2020-06-23 17:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-12 16:01 [PATCH bpf 1/2] flow_dissector: reject invalid attach_flags Lorenz Bauer
2020-06-12 16:01 ` [PATCH bpf 2/2] bpf: sockmap: " Lorenz Bauer
2020-06-12 22:35 ` [PATCH bpf 1/2] flow_dissector: " Alexei Starovoitov
2020-06-15 14:43   ` Lorenz Bauer
2020-06-16  3:55     ` Alexei Starovoitov
2020-06-16  8:30       ` Lorenz Bauer
2020-06-16 20:37         ` Alexei Starovoitov
2020-06-17  6:49           ` John Fastabend
2020-06-23 17:07             ` Lorenz Bauer

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).