FILE
struct_ops_refcounted_fail__ref_leak.c
File preview with syntax highlighting.
linux-6.19.14/tools/testing/selftests/bpf/progs/struct_ops_refcounted_fail__ref_leak.c
1#include <vmlinux.h> 2#include <bpf/bpf_tracing.h> 3#include "../test_kmods/bpf_testmod.h" 4#include "bpf_misc.h" 5 6char _license[] SEC("license") = "GPL"; 7 8/* Test that the verifier rejects a program that acquires a referenced 9 * kptr through context without releasing the reference 10 */ 11SEC("struct_ops/test_refcounted") 12__failure __msg("Unreleased reference id=1 alloc_insn=0") 13int BPF_PROG(refcounted_fail__ref_leak, int dummy, 14 struct task_struct *task) 15{ 16 return 0; 17} 18 19SEC(".struct_ops.link") 20struct bpf_testmod_ops testmod_ref_acquire = { 21 .test_refcounted = (void *)refcounted_fail__ref_leak, 22};
~/
Read-only file preview.