mirror of https://gitee.com/openkylin/linux.git
selftests/seccomp: arm64: Define SYSCALL_NUM_SET macro
Remove the arm64 special-case in change_syscall(). Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/lkml/20200912110820.597135-6-keescook@chromium.org Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
aa8fbb80a8
commit
0dd7d68572
|
@ -1717,6 +1717,18 @@ TEST_F(TRACE_poke, getpid_runs_normally)
|
|||
#elif defined(__aarch64__)
|
||||
# define ARCH_REGS struct user_pt_regs
|
||||
# define SYSCALL_NUM(_regs) (_regs).regs[8]
|
||||
# ifndef NT_ARM_SYSTEM_CALL
|
||||
# define NT_ARM_SYSTEM_CALL 0x404
|
||||
# endif
|
||||
# define SYSCALL_NUM_SET(_regs, _nr) \
|
||||
do { \
|
||||
struct iovec __v; \
|
||||
typeof(_nr) __nr = (_nr); \
|
||||
__v.iov_base = &__nr; \
|
||||
__v.iov_len = sizeof(__nr); \
|
||||
EXPECT_EQ(0, ptrace(PTRACE_SETREGSET, tracee, \
|
||||
NT_ARM_SYSTEM_CALL, &__v)); \
|
||||
} while (0)
|
||||
# define SYSCALL_RET(_regs) (_regs).regs[0]
|
||||
#elif defined(__riscv) && __riscv_xlen == 64
|
||||
# define ARCH_REGS struct user_regs_struct
|
||||
|
@ -1852,23 +1864,10 @@ void change_syscall(struct __test_metadata *_metadata,
|
|||
#if defined(__x86_64__) || defined(__i386__) || defined(__powerpc__) || \
|
||||
defined(__s390__) || defined(__hppa__) || defined(__riscv) || \
|
||||
defined(__xtensa__) || defined(__csky__) || defined(__sh__) || \
|
||||
defined(__mips__) || defined(__arm__)
|
||||
defined(__mips__) || defined(__arm__) || defined(__aarch64__)
|
||||
{
|
||||
SYSCALL_NUM_SET(regs, syscall);
|
||||
}
|
||||
|
||||
#elif defined(__aarch64__)
|
||||
# ifndef NT_ARM_SYSTEM_CALL
|
||||
# define NT_ARM_SYSTEM_CALL 0x404
|
||||
# endif
|
||||
{
|
||||
iov.iov_base = &syscall;
|
||||
iov.iov_len = sizeof(syscall);
|
||||
ret = ptrace(PTRACE_SETREGSET, tracee, NT_ARM_SYSTEM_CALL,
|
||||
&iov);
|
||||
EXPECT_EQ(0, ret);
|
||||
}
|
||||
|
||||
#else
|
||||
ASSERT_EQ(1, 0) {
|
||||
TH_LOG("How is the syscall changed on this architecture?");
|
||||
|
|
Loading…
Reference in New Issue