mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 00:48:50 +00:00
bee4b7e626
This adds a selftest that ensures that modify_return tracing programs cannot be attached to freplace programs. The security_ prefix is added to the freplace program because that would otherwise let it pass the check for modify_return. Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andriin@fb.com> Link: https://lore.kernel.org/bpf/160138355713.48470.3811074984255709369.stgit@toke.dk
14 lines
319 B
C
14 lines
319 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <linux/bpf.h>
|
|
#include <bpf/bpf_helpers.h>
|
|
#include <bpf/bpf_tracing.h>
|
|
|
|
volatile __u64 test_fmod_ret = 0;
|
|
SEC("fmod_ret/security_new_get_constant")
|
|
int BPF_PROG(fmod_ret_test, long val, int ret)
|
|
{
|
|
test_fmod_ret = 1;
|
|
return 120;
|
|
}
|
|
|
|
char _license[] SEC("license") = "GPL";
|