Loading...
1// SPDX-License-Identifier: GPL-2.0-only
2/* Copyright (c) 2017 Facebook
3 */
4#include <stddef.h>
5#include <linux/bpf.h>
6#include <bpf/bpf_helpers.h>
7#include "bpf_misc.h"
8
9struct {
10 __uint(type, BPF_MAP_TYPE_ARRAY);
11 __uint(max_entries, 1);
12 __type(key, __u32);
13 __type(value, __u64);
14} test_map_id SEC(".maps");
15
16SEC("raw_tp/sys_enter")
17int test_obj_id(void *ctx)
18{
19 __u32 key = 0;
20 __u64 *value;
21
22 value = bpf_map_lookup_elem(&test_map_id, &key);
23 __sink(value);
24
25 return 0;
26}
1// SPDX-License-Identifier: GPL-2.0-only
2/* Copyright (c) 2017 Facebook
3 */
4#include <stddef.h>
5#include <linux/bpf.h>
6#include <linux/pkt_cls.h>
7#include "bpf_helpers.h"
8
9/* It is a dumb bpf program such that it must have no
10 * issue to be loaded since testing the verifier is
11 * not the focus here.
12 */
13
14int _version SEC("version") = 1;
15
16struct {
17 __uint(type, BPF_MAP_TYPE_ARRAY);
18 __uint(max_entries, 1);
19 __type(key, __u32);
20 __type(value, __u64);
21} test_map_id SEC(".maps");
22
23SEC("test_obj_id_dummy")
24int test_obj_id(struct __sk_buff *skb)
25{
26 __u32 key = 0;
27 __u64 *value;
28
29 value = bpf_map_lookup_elem(&test_map_id, &key);
30
31 return TC_ACT_OK;
32}