1 // SPDX-License-Identifier: GPL-2.0 2 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ 3 4 #include <vmlinux.h> 5 #include <bpf/bpf_tracing.h> 6 #include "bpf_misc.h" 7 8 char _license[] SEC("license") = "GPL"; 9 10 /* Ensure module parameter has PTR_MAYBE_NULL */ 11 SEC("tp_btf/bpf_testmod_test_raw_tp_null") 12 __failure __msg("R1 invalid mem access 'trusted_ptr_or_null_'") test_raw_tp_null_bpf_testmod_test_raw_tp_null_arg_1(void * ctx)13int test_raw_tp_null_bpf_testmod_test_raw_tp_null_arg_1(void *ctx) { 14 asm volatile("r1 = *(u64 *)(r1 +0); r1 = *(u64 *)(r1 +0);" ::: __clobber_all); 15 return 0; 16 } 17 18 /* Check NULL marking */ 19 SEC("tp_btf/sched_pi_setprio") 20 __failure __msg("R1 invalid mem access 'trusted_ptr_or_null_'") test_raw_tp_null_sched_pi_setprio_arg_2(void * ctx)21int test_raw_tp_null_sched_pi_setprio_arg_2(void *ctx) { 22 asm volatile("r1 = *(u64 *)(r1 +8); r1 = *(u64 *)(r1 +0);" ::: __clobber_all); 23 return 0; 24 } 25