bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next] selftests/bpf: Fix map_fds buffer overflow in test_verifier
@ 2021-12-20 14:04 Ilya Leoshkevich
  2021-12-20 15:45 ` Yonghong Song
  0 siblings, 1 reply; 2+ messages in thread
From: Ilya Leoshkevich @ 2021-12-20 14:04 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: bpf, Heiko Carstens, Vasily Gorbik, Ilya Leoshkevich

do_test_fixup() accesses map_fds[21], which is out of bounds. Extend
map_fds array to 22 elements.

Fixes: e60e6962c503 ("selftests/bpf: Add tests for restricted helpers")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 tools/testing/selftests/bpf/test_verifier.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
index b0bd2a1f6d52..76cd903117af 100644
--- a/tools/testing/selftests/bpf/test_verifier.c
+++ b/tools/testing/selftests/bpf/test_verifier.c
@@ -53,7 +53,7 @@
 #define MAX_INSNS	BPF_MAXINSNS
 #define MAX_TEST_INSNS	1000000
 #define MAX_FIXUPS	8
-#define MAX_NR_MAPS	21
+#define MAX_NR_MAPS	22
 #define MAX_TEST_RUNS	8
 #define POINTER_VALUE	0xcafe4all
 #define TEST_DATA_LEN	64
-- 
2.31.1


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

* Re: [PATCH bpf-next] selftests/bpf: Fix map_fds buffer overflow in test_verifier
  2021-12-20 14:04 [PATCH bpf-next] selftests/bpf: Fix map_fds buffer overflow in test_verifier Ilya Leoshkevich
@ 2021-12-20 15:45 ` Yonghong Song
  0 siblings, 0 replies; 2+ messages in thread
From: Yonghong Song @ 2021-12-20 15:45 UTC (permalink / raw)
  To: Ilya Leoshkevich, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: bpf, Heiko Carstens, Vasily Gorbik



On 12/20/21 6:04 AM, Ilya Leoshkevich wrote:
> do_test_fixup() accesses map_fds[21], which is out of bounds. Extend
> map_fds array to 22 elements.
> 
> Fixes: e60e6962c503 ("selftests/bpf: Add tests for restricted helpers")
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>   tools/testing/selftests/bpf/test_verifier.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
> index b0bd2a1f6d52..76cd903117af 100644
> --- a/tools/testing/selftests/bpf/test_verifier.c
> +++ b/tools/testing/selftests/bpf/test_verifier.c
> @@ -53,7 +53,7 @@
>   #define MAX_INSNS	BPF_MAXINSNS
>   #define MAX_TEST_INSNS	1000000
>   #define MAX_FIXUPS	8
> -#define MAX_NR_MAPS	21
> +#define MAX_NR_MAPS	22

The patch has been fixed by:
   https://lore.kernel.org/bpf/20211214014800.78762-1-memxor@gmail.com/
and merged into bpf tree. It should circulate back to bpf-next later
when the patch goes from bpf->net->linus->net-next->bpf-next.

>   #define MAX_TEST_RUNS	8
>   #define POINTER_VALUE	0xcafe4all
>   #define TEST_DATA_LEN	64

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

end of thread, other threads:[~2021-12-20 15:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-20 14:04 [PATCH bpf-next] selftests/bpf: Fix map_fds buffer overflow in test_verifier Ilya Leoshkevich
2021-12-20 15:45 ` Yonghong Song

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