FILE
struct_ops_refcounted_fail__tail_call.c
File preview with syntax highlighting.
linux-6.19.14/tools/testing/selftests/bpf/progs/struct_ops_refcounted_fail__tail_call.c
1// SPDX-License-Identifier: GPL-2.0 2/* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */ 3#include <vmlinux.h> 4#include <bpf/bpf_tracing.h> 5#include "../test_kmods/bpf_testmod.h" 6#include "bpf_misc.h" 7 8char _license[] SEC("license") = "GPL"; 9 10struct { 11 __uint(type, BPF_MAP_TYPE_PROG_ARRAY); 12 __uint(max_entries, 1); 13 __uint(key_size, sizeof(__u32)); 14 __uint(value_size, sizeof(__u32)); 15} prog_array SEC(".maps"); 16 17/* Test that the verifier rejects a program with referenced kptr arguments 18 * that tail call 19 */ 20SEC("struct_ops/test_refcounted") 21__failure __msg("program with __ref argument cannot tail call") 22int refcounted_fail__tail_call(unsigned long long *ctx) 23{ 24 struct task_struct *task = (struct task_struct *)ctx[1]; 25 26 bpf_task_release(task); 27 bpf_tail_call(ctx, &prog_array, 0); 28 29 return 0; 30} 31 32SEC(".struct_ops.link") 33struct bpf_testmod_ops testmod_ref_acquire = { 34 .test_refcounted = (void *)refcounted_fail__tail_call, 35}; 36
~/
Read-only file preview.