Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /* Copyright (c) 2021 Facebook */
0003 
0004 #include <linux/bpf.h>
0005 #include <bpf/bpf_helpers.h>
0006 
0007 int a[4];
0008 const volatile int off = 4000;
0009 
0010 SEC("raw_tp/sys_enter")
0011 int good_prog(const void *ctx)
0012 {
0013     a[0] = (int)(long)ctx;
0014     return a[1];
0015 }
0016 
0017 SEC("raw_tp/sys_enter")
0018 int bad_prog(const void *ctx)
0019 {
0020     /* out of bounds access */
0021     return a[off];
0022 }
0023 
0024 char _license[] SEC("license") = "GPL";