summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2020-04-15 13:39:57 +0000
committerDmitry V. Levin <ldv@altlinux.org>2020-04-15 13:39:57 +0000
commit66bb12b7b9904e2c193ae7c786305cfa3cfe0035 (patch)
tree4e27bdec51b05d1b8ec7e8cab3f546f9da25a548
parentfe744fac0d0ee1b9a00df4c9b8945c0d7b94fff5 (diff)
downloadstrace-66bb12b7b9904e2c193ae7c786305cfa3cfe0035.tar.gz
x86_64: provide a fallback definition of __X32_SYSCALL_BIT
Make sure __X32_SYSCALL_BIT is defined on __x86_64__, move fallback definitions from various files to x86_64/arch_defs_.h. * linux/x86_64/arch_defs_.h [!__X32_SYSCALL_BIT] (__X32_SYSCALL_BIT): Define. * linux/x86_64/arch_get_personality.c [!__X32_SYSCALL_BIT] (__X32_SYSCALL_BIT): Remove. * linux/x86_64/get_scno.c: Likewise. * tests/filter_seccomp-flag.c [__x86_64__]: Likewise. Complements: v5.3~7 "Introduce seccomp-assisted syscall filtering"
-rw-r--r--linux/x86_64/arch_defs_.h3
-rw-r--r--linux/x86_64/arch_get_personality.c4
-rw-r--r--linux/x86_64/get_scno.c4
-rw-r--r--tests/filter_seccomp-flag.c6
4 files changed, 3 insertions, 14 deletions
diff --git a/linux/x86_64/arch_defs_.h b/linux/x86_64/arch_defs_.h
index c2407d53e..a4daf8727 100644
--- a/linux/x86_64/arch_defs_.h
+++ b/linux/x86_64/arch_defs_.h
@@ -13,3 +13,6 @@
#define PERSONALITY0_AUDIT_ARCH { AUDIT_ARCH_X86_64, 0 }
#define PERSONALITY1_AUDIT_ARCH { AUDIT_ARCH_I386, 0 }
#define PERSONALITY2_AUDIT_ARCH { AUDIT_ARCH_X86_64, __X32_SYSCALL_BIT }
+#ifndef __X32_SYSCALL_BIT
+# define __X32_SYSCALL_BIT 0x40000000UL
+#endif
diff --git a/linux/x86_64/arch_get_personality.c b/linux/x86_64/arch_get_personality.c
index 0f06d8d9b..0e5a3b4b7 100644
--- a/linux/x86_64/arch_get_personality.c
+++ b/linux/x86_64/arch_get_personality.c
@@ -21,10 +21,6 @@ get_personality_from_syscall_info(const struct_ptrace_syscall_info *sci)
kernel_ulong_t scno = sci->entry.nr;
-# ifndef __X32_SYSCALL_BIT
-# define __X32_SYSCALL_BIT 0x40000000
-# endif
-
if (pers == 0 && (scno & __X32_SYSCALL_BIT)) {
/*
* Syscall number -1 requires special treatment:
diff --git a/linux/x86_64/get_scno.c b/linux/x86_64/get_scno.c
index 0a274888a..533b106ee 100644
--- a/linux/x86_64/get_scno.c
+++ b/linux/x86_64/get_scno.c
@@ -18,10 +18,6 @@ arch_get_scno(struct tcb *tcp)
kernel_ulong_t scno = 0;
unsigned int currpers;
-#ifndef __X32_SYSCALL_BIT
-# define __X32_SYSCALL_BIT 0x40000000
-#endif
-
/*
* GETREGSET of NT_PRSTATUS tells us regset size,
* which unambiguously detects i386.
diff --git a/tests/filter_seccomp-flag.c b/tests/filter_seccomp-flag.c
index c5b8acb86..480db8942 100644
--- a/tests/filter_seccomp-flag.c
+++ b/tests/filter_seccomp-flag.c
@@ -22,12 +22,6 @@
# undef XLAT_MACROS_ONLY
#endif
-#ifdef __x86_64__
-# ifndef __X32_SYSCALL_BIT
-# define __X32_SYSCALL_BIT 0x40000000
-# endif
-#endif
-
/* Define these shorthand notations to simplify the syscallent files. */
#include "sysent_shorthand_defs.h"