tools/testing/selftests/bpf/prog_tests/ptr_untrusted.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/prog_tests/ptr_untrusted.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/prog_tests/ptr_untrusted.c- Extension
.c- Size
- 990 bytes
- Lines
- 37
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
string.hlinux/bpf.htest_progs.htest_ptr_untrusted.skel.h
Detected Declarations
function serial_test_ptr_untrusted
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2023 Yafang Shao <laoar.shao@gmail.com> */
#include <string.h>
#include <linux/bpf.h>
#include <test_progs.h>
#include "test_ptr_untrusted.skel.h"
#define TP_NAME "sched_switch"
void serial_test_ptr_untrusted(void)
{
struct test_ptr_untrusted *skel;
int err;
skel = test_ptr_untrusted__open_and_load();
if (!ASSERT_OK_PTR(skel, "skel_open"))
goto cleanup;
/* First, attach lsm prog */
skel->links.lsm_run = bpf_program__attach_lsm(skel->progs.lsm_run);
if (!ASSERT_OK_PTR(skel->links.lsm_run, "lsm_attach"))
goto cleanup;
/* Second, attach raw_tp prog. The lsm prog will be triggered. */
skel->links.raw_tp_run = bpf_program__attach_raw_tracepoint(skel->progs.raw_tp_run,
TP_NAME);
if (!ASSERT_OK_PTR(skel->links.raw_tp_run, "raw_tp_attach"))
goto cleanup;
err = strncmp(skel->bss->tp_name, TP_NAME, strlen(TP_NAME));
ASSERT_EQ(err, 0, "cmp_tp_name");
cleanup:
test_ptr_untrusted__destroy(skel);
}
Annotation
- Immediate include surface: `string.h`, `linux/bpf.h`, `test_progs.h`, `test_ptr_untrusted.skel.h`.
- Detected declarations: `function serial_test_ptr_untrusted`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.