* [PATCH bpf-next v2 2/3] bpf: selftests: Test constant key extraction on irrelevant maps
2025-02-04 17:25 [PATCH bpf-next v2 0/3] bpf: Some fixes for nullness elision Daniel Xu
@ 2025-02-04 17:25 ` Daniel Xu
2025-02-07 23:50 ` [PATCH bpf-next v2 0/3] bpf: Some fixes for nullness elision patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Xu @ 2025-02-04 17:25 UTC (permalink / raw)
To: eddyz87, ast, daniel, andrii, shuah
Cc: martin.lau, song, yonghong.song, john.fastabend, kpsingh, sdf,
haoluo, jolsa, mykolal, bpf, linux-kselftest, linux-kernel,
mhartmay, iii
Test that very high constant map keys are not interpreted as an error
value by the verifier. This would previously fail.
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
---
.../selftests/bpf/progs/verifier_array_access.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/tools/testing/selftests/bpf/progs/verifier_array_access.c b/tools/testing/selftests/bpf/progs/verifier_array_access.c
index 29eb9568633f..0a187ff725cc 100644
--- a/tools/testing/selftests/bpf/progs/verifier_array_access.c
+++ b/tools/testing/selftests/bpf/progs/verifier_array_access.c
@@ -713,4 +713,19 @@ unsigned int non_stack_key_lookup(void)
return val->index;
}
+SEC("socket")
+__description("doesn't reject UINT64_MAX as s64 for irrelevant maps")
+__success __retval(42)
+unsigned int doesnt_reject_irrelevant_maps(void)
+{
+ __u64 key = 0xFFFFFFFFFFFFFFFF;
+ struct test_val *val;
+
+ val = bpf_map_lookup_elem(&map_hash_48b, &key);
+ if (val)
+ return val->index;
+
+ return 42;
+}
+
char _license[] SEC("license") = "GPL";
--
2.47.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH bpf-next v2 0/3] bpf: Some fixes for nullness elision
2025-02-04 17:25 [PATCH bpf-next v2 0/3] bpf: Some fixes for nullness elision Daniel Xu
2025-02-04 17:25 ` [PATCH bpf-next v2 2/3] bpf: selftests: Test constant key extraction on irrelevant maps Daniel Xu
@ 2025-02-07 23:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-02-07 23:50 UTC (permalink / raw)
To: Daniel Xu; +Cc: linux-kselftest, linux-kernel, bpf, mhartmay, iii
Hello:
This series was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Tue, 4 Feb 2025 10:25:15 -0700 you wrote:
> Two fixes for nullness elision. See commits for more details.
>
> === Changelog ===
> Changes from v1:
> * Reword commit message in patch 1
> * Add tags
>
> [...]
Here is the summary with links:
- [bpf-next,v2,1/3] bpf: verifier: Do not extract constant map keys for irrelevant maps
https://git.kernel.org/bpf/bpf/c/884c3a18dadf
- [bpf-next,v2,2/3] bpf: selftests: Test constant key extraction on irrelevant maps
https://git.kernel.org/bpf/bpf/c/973cb1382ead
- [bpf-next,v2,3/3] bpf: verifier: Disambiguate get_constant_map_key() errors
https://git.kernel.org/bpf/bpf/c/7968c6581507
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread