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/* Copyright (C) 2025 Google LLC. */
3#include <linux/bpf.h>
4#include <time.h>
5#include <bpf/bpf_helpers.h>
6
7#include "bpf_misc.h"
8
9struct {
10 __uint(type, BPF_MAP_TYPE_ARRAY);
11 __type(key, __u32);
12 __type(value, __u32);
13 __uint(max_entries, 1);
14} excl_map SEC(".maps");
15
16char _license[] SEC("license") = "GPL";
17
18SEC("?fentry.s/" SYS_PREFIX "sys_getpgid")
19int should_have_access(void *ctx)
20{
21 int key = 0, value = 0xdeadbeef;
22
23 bpf_map_update_elem(&excl_map, &key, &value, 0);
24 return 0;
25}
26
27SEC("?fentry.s/" SYS_PREFIX "sys_getpgid")
28int should_not_have_access(void *ctx)
29{
30 int key = 0, value = 0xdeadbeef;
31
32 bpf_map_update_elem(&excl_map, &key, &value, 0);
33 return 0;
34}