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