Commit 807662ca authored by Artem Savkov's avatar Artem Savkov Committed by Andrii Nakryiko
Browse files

selftests/bpf: Fix attach point for non-x86 arches in test_progs/lsm



Use SYS_PREFIX macro from bpf_misc.h instead of hard-coded '__x64_'
prefix for sys_setdomainname attach point in lsm test.

Signed-off-by: default avatarArtem Savkov <asavkov@redhat.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220816055231.717006-1-asavkov@redhat.com
parent 1f235777
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ test_bpffs # bpffs test failed 255
test_bprm_opts                           # failed to auto-attach program 'secure_exec': -524                           (trampoline)
test_ima                                 # failed to auto-attach program 'ima': -524                                   (trampoline)
test_local_storage                       # failed to auto-attach program 'unlink_hook': -524                           (trampoline)
test_lsm                                 # failed to find kernel BTF type ID of '__x64_sys_setdomainname': -3          (?)
test_lsm                                 # attach unexpected error: -524                                               (trampoline)
test_overhead                            # attach_fentry unexpected error: -524                                        (trampoline)
test_profiler                            # unknown func bpf_probe_read_str#45                                          (overlapping)
timer                                    # failed to auto-attach program 'test1': -524                                 (trampoline)
+2 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
 * Copyright 2020 Google LLC.
 */

#include "bpf_misc.h"
#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
@@ -160,7 +161,7 @@ int BPF_PROG(test_task_free, struct task_struct *task)

int copy_test = 0;

SEC("fentry.s/__x64_sys_setdomainname")
SEC("fentry.s/" SYS_PREFIX "sys_setdomainname")
int BPF_PROG(test_sys_setdomainname, struct pt_regs *regs)
{
	void *ptr = (void *)PT_REGS_PARM1(regs);