mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 12:35:52 +02:00
selftests/bpf: null checks for rdonly_untrusted_mem should be preserved
Test case checking that verifier does not assume rdonly_untrusted_mem values as not null. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20250702073620.897517-2-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
This commit is contained in:
parent
c3b9faac9b
commit
a90f5f7370
|
|
@ -174,4 +174,25 @@ int misaligned_access(void *ctx)
|
|||
return combine(bpf_rdonly_cast(&global, 0) + 1);
|
||||
}
|
||||
|
||||
__weak int return_one(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
SEC("socket")
|
||||
__success
|
||||
__retval(1)
|
||||
int null_check(void *ctx)
|
||||
{
|
||||
int *p;
|
||||
|
||||
p = bpf_rdonly_cast(0, 0);
|
||||
if (p == 0)
|
||||
/* make this a function call to avoid compiler
|
||||
* moving r0 assignment before check.
|
||||
*/
|
||||
return return_one();
|
||||
return 0;
|
||||
}
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user