Skip to content

Commit 78f2662

Browse files
committed
selftests/seccomp: Remove syscall setting #ifdefs
With all architectures now using the common SYSCALL_NUM_SET() macro, the arch-specific #ifdef can be removed from change_syscall() itself. Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/lkml/20200912110820.597135-8-keescook@chromium.org Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
1 parent 37989de commit 78f2662

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

tools/testing/selftests/seccomp/seccomp_bpf.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,20 +1865,9 @@ void change_syscall(struct __test_metadata *_metadata,
18651865
iov.iov_len = sizeof(regs);
18661866
ret = ptrace(PTRACE_GETREGSET, tracee, NT_PRSTATUS, &iov);
18671867
#endif
1868-
EXPECT_EQ(0, ret) {}
1868+
EXPECT_EQ(0, ret);
18691869

1870-
#if defined(__x86_64__) || defined(__i386__) || defined(__powerpc__) || \
1871-
defined(__s390__) || defined(__hppa__) || defined(__riscv) || \
1872-
defined(__xtensa__) || defined(__csky__) || defined(__sh__) || \
1873-
defined(__mips__) || defined(__arm__) || defined(__aarch64__)
1874-
{
1875-
SYSCALL_NUM_SET(regs, syscall);
1876-
}
1877-
#else
1878-
ASSERT_EQ(1, 0) {
1879-
TH_LOG("How is the syscall changed on this architecture?");
1880-
}
1881-
#endif
1870+
SYSCALL_NUM_SET(regs, syscall);
18821871

18831872
/* If syscall is skipped, change return value. */
18841873
if (syscall == -1)
@@ -1888,6 +1877,7 @@ void change_syscall(struct __test_metadata *_metadata,
18881877
SYSCALL_RET(regs) = result;
18891878
#endif
18901879

1880+
/* Flush any register changes made. */
18911881
#ifdef HAVE_GETREGS
18921882
ret = ptrace(PTRACE_SETREGS, tracee, 0, &regs);
18931883
#else

0 commit comments

Comments
 (0)