selftests/bpf: Mark uprobe trigger functions with nocf_check attribute

Some distros seem to enable the -fcf-protection=branch by default,
which breaks our setup on first instruction of uprobe trigger
functions and place there endbr64 instruction.

Marking them with nocf_check attribute to skip that.

Ignoring unknown attribute warning in gcc for bench objects, because
nocf_check can be used only when -fcf-protection=branch is enabled,
otherwise we get a warning and break compilation.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240322134936.1075395-1-jolsa@kernel.org
This commit is contained in:
Jiri Olsa
2024-03-22 14:49:36 +01:00
committed by Andrii Nakryiko
parent 1684d6eb99
commit af8d27bf15
2 changed files with 9 additions and 3 deletions
+4
View File
@@ -58,6 +58,10 @@
#define noinline
#endif
#ifndef __nocf_check
#define __nocf_check __attribute__((nocf_check))
#endif
/* Are two types/vars the same type (ignoring qualifiers)? */
#ifndef __same_type
# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))