1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2021 Facebook */
5 #include <bpf/bpf_helpers.h>
8 char _license[] SEC("license") = "GPL";
13 __uint(type, BPF_MAP_TYPE_ARRAY);
16 __uint(max_entries, 1000);
17 } map_random_data SEC(".maps");
19 struct map_bloom_type {
20 __uint(type, BPF_MAP_TYPE_BLOOM_FILTER);
22 __uint(max_entries, 10000);
24 } map_bloom SEC(".maps");
27 __uint(type, BPF_MAP_TYPE_ARRAY_OF_MAPS);
30 __uint(max_entries, 1);
31 __array(values, struct map_bloom_type);
32 } outer_map SEC(".maps");
41 check_elem(struct bpf_map *map, __u32 *key, __u32 *val,
42 struct callback_ctx *data)
46 err = bpf_map_peek_elem(data->map, val);
49 return 1; /* stop the iteration */
55 SEC("fentry/" SYS_PREFIX "sys_getpgid")
56 int inner_map(void *ctx)
58 struct bpf_map *inner_map;
59 struct callback_ctx data;
62 inner_map = bpf_map_lookup_elem(&outer_map, &key);
69 bpf_for_each_map_elem(&map_random_data, check_elem, &data, 0);
74 SEC("fentry/" SYS_PREFIX "sys_getpgid")
75 int check_bloom(void *ctx)
77 struct callback_ctx data;
79 data.map = (struct bpf_map *)&map_bloom;
80 bpf_for_each_map_elem(&map_random_data, check_elem, &data, 0);