1 | // SPDX-License-Identifier: GPL-2.0 |
---|---|
2 | /* Copyright (c) 2021 Facebook */ |
3 | |
4 | #include <linux/bpf.h> |
5 | #include <bpf/bpf_helpers.h> |
6 | |
7 | int a[4]; |
8 | const volatile int off = 4000; |
9 | |
10 | SEC("raw_tp/sys_enter") |
11 | int good_prog(const void *ctx) |
12 | { |
13 | a[0] = (int)(long)ctx; |
14 | return a[1]; |
15 | } |
16 | |
17 | SEC("raw_tp/sys_enter") |
18 | int bad_prog(const void *ctx) |
19 | { |
20 | /* out of bounds access */ |
21 | return a[off]; |
22 | } |
23 | |
24 | char _license[] SEC("license") = "GPL"; |
25 |