Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 31 lines 868 B view raw
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__attribute__((nomerge)) extern void bpf_task_release(struct task_struct *p) __ksym; 9 10/* This is a test BPF program that uses struct_ops to access a referenced 11 * kptr argument. This is a test for the verifier to ensure that it 12 * 1) recognizes the task as a referenced object (i.e., ref_obj_id > 0), and 13 * 2) the same reference can be acquired from multiple paths as long as it 14 * has not been released. 15 */ 16SEC("struct_ops/test_refcounted") 17int BPF_PROG(refcounted, int dummy, struct task_struct *task) 18{ 19 if (dummy == 1) 20 bpf_task_release(task); 21 else 22 bpf_task_release(task); 23 return 0; 24} 25 26SEC(".struct_ops.link") 27struct bpf_testmod_ops testmod_refcounted = { 28 .test_refcounted = (void *)refcounted, 29}; 30 31