31 lines · c
1// SPDX-License-Identifier: GPL-2.02/* Copyright (c) 2021 Facebook */3#include "vmlinux.h"4#include <bpf/bpf_helpers.h>5#define vm_flags vm_start6 7char _license[] SEC("license") = "GPL";8 9struct callback_ctx {10 int dummy;11};12 13static long write_vma(struct task_struct *task, struct vm_area_struct *vma,14 struct callback_ctx *data)15{16 /* writing to vma, which is illegal */17 vma->vm_start = 0xffffffffff600000;18 19 return 0;20}21 22SEC("raw_tp/sys_enter")23int handle_getpid(void)24{25 struct task_struct *task = bpf_get_current_task_btf();26 struct callback_ctx data = {};27 28 bpf_find_vma(task, 0, write_vma, &data, 0);29 return 0;30}31