[PATCH net-next] bpf: Fix map-in-map checking in the verifier

Subsystems: bpf [core], bpf [general] (safe dynamic programs and tools), the rest

STALE3347d

5 messages, 5 authors, 2017-08-18 · open the first message on its own page

[PATCH net-next] bpf: Fix map-in-map checking in the verifier

From: Martin KaFai Lau <hidden>
Date: 2017-08-18 01:14:45

In check_map_func_compatibility(), a 'break' has been accidentally
removed for the BPF_MAP_TYPE_ARRAY_OF_MAPS and BPF_MAP_TYPE_HASH_OF_MAPS
cases.  This patch adds it back.

Fixes: 174a79ff9515 ("bpf: sockmap with sk redirect support")
Cc: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Martin KaFai Lau <redacted>
---
 kernel/bpf/verifier.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 40f669ddb571..4f6e7eb42ba0 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -1523,6 +1523,7 @@ static int check_map_func_compatibility(struct bpf_map *map, int func_id)
 	case BPF_MAP_TYPE_HASH_OF_MAPS:
 		if (func_id != BPF_FUNC_map_lookup_elem)
 			goto error;
+		break;
 	case BPF_MAP_TYPE_SOCKMAP:
 		if (func_id != BPF_FUNC_sk_redirect_map &&
 		    func_id != BPF_FUNC_sock_map_update &&
-- 
2.9.5

Re: [PATCH net-next] bpf: Fix map-in-map checking in the verifier

From: Alexei Starovoitov <hidden>
Date: 2017-08-18 01:18:06

On 8/17/17 6:14 PM, Martin KaFai Lau wrote:
In check_map_func_compatibility(), a 'break' has been accidentally
removed for the BPF_MAP_TYPE_ARRAY_OF_MAPS and BPF_MAP_TYPE_HASH_OF_MAPS
cases.  This patch adds it back.

Fixes: 174a79ff9515 ("bpf: sockmap with sk redirect support")
Cc: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Martin KaFai Lau <redacted>
Nice catch!
Acked-by: Alexei Starovoitov <ast@kernel.org>

Re: [PATCH net-next] bpf: Fix map-in-map checking in the verifier

From: John Fastabend <john.fastabend@gmail.com>
Date: 2017-08-18 02:08:38

On 08/17/2017 06:17 PM, Alexei Starovoitov wrote:
On 8/17/17 6:14 PM, Martin KaFai Lau wrote:
quoted
In check_map_func_compatibility(), a 'break' has been accidentally
removed for the BPF_MAP_TYPE_ARRAY_OF_MAPS and BPF_MAP_TYPE_HASH_OF_MAPS
cases.  This patch adds it back.

Fixes: 174a79ff9515 ("bpf: sockmap with sk redirect support")
Cc: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Martin KaFai Lau <redacted>
Nice catch!
Acked-by: Alexei Starovoitov <ast@kernel.org>
Thanks a lot!

Acked-by: John Fastabend <john.fastabend@gmail.com>

Re: [PATCH net-next] bpf: Fix map-in-map checking in the verifier

From: Daniel Borkmann <daniel@iogearbox.net>
Date: 2017-08-18 08:10:42

On 08/18/2017 03:14 AM, Martin KaFai Lau wrote:
In check_map_func_compatibility(), a 'break' has been accidentally
removed for the BPF_MAP_TYPE_ARRAY_OF_MAPS and BPF_MAP_TYPE_HASH_OF_MAPS
cases.  This patch adds it back.

Fixes: 174a79ff9515 ("bpf: sockmap with sk redirect support")
Cc: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Martin KaFai Lau <redacted>
Thanks for spotting!

Acked-by: Daniel Borkmann <daniel@iogearbox.net>

Re: [PATCH net-next] bpf: Fix map-in-map checking in the verifier

From: David Miller <davem@davemloft.net>
Date: 2017-08-18 23:26:03

From: Martin KaFai Lau <redacted>
Date: Thu, 17 Aug 2017 18:14:43 -0700
In check_map_func_compatibility(), a 'break' has been accidentally
removed for the BPF_MAP_TYPE_ARRAY_OF_MAPS and BPF_MAP_TYPE_HASH_OF_MAPS
cases.  This patch adds it back.

Fixes: 174a79ff9515 ("bpf: sockmap with sk redirect support")
Cc: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Martin KaFai Lau <redacted>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help