xref: /linux/tools/testing/selftests/bpf/progs/freplace_get_constant.c (revision cbecf716ca618fd44feda6bd9a64a8179d031fc5)
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/bpf.h>
3 #include <bpf/bpf_helpers.h>
4 #include <bpf/bpf_endian.h>
5 
6 volatile __u64 test_get_constant = 0;
7 SEC("freplace/get_constant")
security_new_get_constant(long val)8 int security_new_get_constant(long val)
9 {
10 	if (val != 123)
11 		return 0;
12 	test_get_constant = 1;
13 	return test_get_constant; /* original get_constant() returns val - 122 */
14 }
15 char _license[] SEC("license") = "GPL";
16