[PATCH bpf] selftests/bpf: add missing pointer dereference for map stacktrace fixup

Subsystems: bpf [general] (safe dynamic programs and tools), bpf [selftests] (test runners & infrastructure), kernel selftest framework, the rest

STALE2853d

3 messages, 3 authors, 2018-12-10 · open the first message on its own page

[PATCH bpf] selftests/bpf: add missing pointer dereference for map stacktrace fixup

From: Stanislav Fomichev <hidden>
Date: 2018-12-07 04:14:15

I get a segfault without it, other fixups always do dereference, and
without dereference I don't understand how it can ever work.

Fixes: 7c85c448e7d74 ("selftests/bpf: test_verifier, check
bpf_map_lookup_elem access in bpf prog")

Signed-off-by: Stanislav Fomichev <redacted>
---
 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 df6f751cc1e8..d23929a1985d 100644
--- a/tools/testing/selftests/bpf/test_verifier.c
+++ b/tools/testing/selftests/bpf/test_verifier.c
@@ -14166,7 +14166,7 @@ static void do_test_fixup(struct bpf_test *test, enum bpf_map_type prog_type,
 		do {
 			prog[*fixup_map_stacktrace].imm = map_fds[12];
 			fixup_map_stacktrace++;
-		} while (fixup_map_stacktrace);
+		} while (*fixup_map_stacktrace);
 	}
 }
 
-- 
2.20.0.rc2.403.gdbc3b29805-goog

Re: [PATCH bpf] selftests/bpf: add missing pointer dereference for map stacktrace fixup

From: Prashant Bhole <hidden>
Date: 2018-12-07 04:32:26


On 12/7/2018 1:14 PM, Stanislav Fomichev wrote:
quoted hunk
I get a segfault without it, other fixups always do dereference, and
without dereference I don't understand how it can ever work.

Fixes: 7c85c448e7d74 ("selftests/bpf: test_verifier, check
bpf_map_lookup_elem access in bpf prog")

Signed-off-by: Stanislav Fomichev <redacted>
---
  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 df6f751cc1e8..d23929a1985d 100644
--- a/tools/testing/selftests/bpf/test_verifier.c
+++ b/tools/testing/selftests/bpf/test_verifier.c
@@ -14166,7 +14166,7 @@ static void do_test_fixup(struct bpf_test *test, enum bpf_map_type prog_type,
  		do {
  			prog[*fixup_map_stacktrace].imm = map_fds[12];
  			fixup_map_stacktrace++;
-		} while (fixup_map_stacktrace);
+		} while (*fixup_map_stacktrace);
  	}
  }
It was my mistake. Thanks for the fix!

-Prashant

Re: [PATCH bpf] selftests/bpf: add missing pointer dereference for map stacktrace fixup

From: Daniel Borkmann <daniel@iogearbox.net>
Date: 2018-12-10 19:22:05

On 12/07/2018 05:14 AM, Stanislav Fomichev wrote:
I get a segfault without it, other fixups always do dereference, and
without dereference I don't understand how it can ever work.

Fixes: 7c85c448e7d74 ("selftests/bpf: test_verifier, check
bpf_map_lookup_elem access in bpf prog")

Signed-off-by: Stanislav Fomichev <redacted>
Applied to bpf, thanks Stanislav!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help