test_log_buf.c (407B)
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 7int a[4]; 8const volatile int off = 4000; 9 10SEC("raw_tp/sys_enter") 11int good_prog(const void *ctx) 12{ 13 a[0] = (int)(long)ctx; 14 return a[1]; 15} 16 17SEC("raw_tp/sys_enter") 18int bad_prog(const void *ctx) 19{ 20 /* out of bounds access */ 21 return a[off]; 22} 23 24char _license[] SEC("license") = "GPL";