Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/3] bpf: Some fixes for nullness elision
@ 2025-02-01 19:58 Daniel Xu
  2025-02-01 19:58 ` [PATCH bpf-next 2/3] bpf: selftests: Test constant key extraction on irrelevant maps Daniel Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Xu @ 2025-02-01 19:58 UTC (permalink / raw)
  To: linux-kernel, linux-kselftest, bpf; +Cc: mhartmay, iii

Two fixes for nullness elision. See commits for more details.

Daniel Xu (3):
  bpf: verifier: Do not extract constant map keys for irrelevant maps
  bpf: selftests: Test constant key extraction on irrelevant maps
  bpf: verifier: Disambiguate get_constant_map_key() errors

 kernel/bpf/verifier.c                         | 29 ++++++++++++++-----
 .../bpf/progs/verifier_array_access.c         | 15 ++++++++++
 2 files changed, 36 insertions(+), 8 deletions(-)

-- 
2.47.1


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

* [PATCH bpf-next 2/3] bpf: selftests: Test constant key extraction on irrelevant maps
  2025-02-01 19:58 [PATCH bpf-next 0/3] bpf: Some fixes for nullness elision Daniel Xu
@ 2025-02-01 19:58 ` Daniel Xu
  2025-02-03 18:48   ` Eduard Zingerman
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Xu @ 2025-02-01 19:58 UTC (permalink / raw)
  To: daniel, eddyz87, shuah, andrii, ast
  Cc: mykolal, martin.lau, song, yonghong.song, john.fastabend, kpsingh,
	sdf, haoluo, jolsa, 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.

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 2/3] bpf: selftests: Test constant key extraction on irrelevant maps
  2025-02-01 19:58 ` [PATCH bpf-next 2/3] bpf: selftests: Test constant key extraction on irrelevant maps Daniel Xu
@ 2025-02-03 18:48   ` Eduard Zingerman
  0 siblings, 0 replies; 3+ messages in thread
From: Eduard Zingerman @ 2025-02-03 18:48 UTC (permalink / raw)
  To: Daniel Xu, daniel, shuah, andrii, ast
  Cc: mykolal, martin.lau, song, yonghong.song, john.fastabend, kpsingh,
	sdf, haoluo, jolsa, bpf, linux-kselftest, linux-kernel, mhartmay,
	iii

On Sat, 2025-02-01 at 12:58 -0700, Daniel Xu wrote:
> Test that very high constant map keys are not interpreted as an error
> value by the verifier. This would previously fail.
> 
> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
> ---

Acked-by: Eduard Zingerman <eddyz87@gmail.com>

[...]


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

end of thread, other threads:[~2025-02-03 18:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-01 19:58 [PATCH bpf-next 0/3] bpf: Some fixes for nullness elision Daniel Xu
2025-02-01 19:58 ` [PATCH bpf-next 2/3] bpf: selftests: Test constant key extraction on irrelevant maps Daniel Xu
2025-02-03 18:48   ` Eduard Zingerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox