tools/testing/selftests/bpf/progs/find_vma_fail1.c

Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/find_vma_fail1.c

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/bpf/progs/find_vma_fail1.c
Extension
.c
Size
628 bytes
Lines
31
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct callback_ctx {
	int dummy;
};

static long write_vma(struct task_struct *task, struct vm_area_struct *vma,
		      struct callback_ctx *data)
{
	/* writing to vma, which is illegal */
	vma->vm_start = 0xffffffffff600000;

	return 0;
}

SEC("raw_tp/sys_enter")
int handle_getpid(void)
{
	struct task_struct *task = bpf_get_current_task_btf();
	struct callback_ctx data = {};

	bpf_find_vma(task, 0, write_vma, &data, 0);
	return 0;
}

Annotation

Implementation Notes