mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-21 11:09:26 -04:00
selftests/bpf: Test passing scalar NULL to nonnull global subprog
Make sure the verifier reject passing a hardcoded NULL to an __arg_nonnull argument. Signed-off-by: Amery Hung <ameryhung@gmail.com> Link: https://patch.msgid.link/20260723221815.367797-2-ameryhung@gmail.com Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
This commit is contained in:
committed by
Eduard Zingerman
parent
289e680c89
commit
55c7bd2dde
@@ -185,6 +185,16 @@ int arg_tag_nonnull_ptr_good(void *ctx)
|
||||
return subprog_nonnull_ptr_good(&x, &y);
|
||||
}
|
||||
|
||||
SEC("?raw_tp")
|
||||
__failure __log_level(2)
|
||||
__msg("R1 is expected to be non-NULL")
|
||||
int arg_tag_nonnull_ptr_null_bad(void *ctx)
|
||||
{
|
||||
int y = 74;
|
||||
|
||||
return subprog_nonnull_ptr_good(NULL, &y);
|
||||
}
|
||||
|
||||
/* this global subprog can be now called from many types of entry progs, each
|
||||
* with different context type
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user