Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright 2026 Google LLC.
4 */
5
6#include <vmlinux.h>
7#include <bpf/bpf_helpers.h>
8#include <bpf/bpf_tracing.h>
9
10#include "bpf_misc.h"
11#include "../test_kmods/bpf_testmod_kfunc.h"
12
13SEC("syscall")
14__success __retval(0)
15int test_default_trusted_ptr(void *ctx)
16{
17 struct prog_test_member *trusted_ptr;
18
19 trusted_ptr = bpf_kfunc_get_default_trusted_ptr_test();
20 /*
21 * Test BPF kfunc bpf_get_default_trusted_ptr_test() returns a
22 * PTR_TO_BTF_ID | PTR_TRUSTED, therefore it should be accepted when
23 * passed to a BPF kfunc only accepting KF_TRUSTED_ARGS.
24 */
25 bpf_kfunc_put_default_trusted_ptr_test(trusted_ptr);
26 return 0;
27}
28
29char _license[] SEC("license") = "GPL";