]> granicus.if.org Git - strace/commitdiff
syscall_name: clear __X32_SYSCALL_BIT from syscall number on x32
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 1 Dec 2016 01:01:02 +0000 (01:01 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 1 Dec 2016 01:05:13 +0000 (01:05 +0000)
* linux/x86_64/get_scno.c (X32_PERSONALITY_NUMBER): New macro.
* syscall.c (syscall_name) [X32_PERSONALITY_NUMBER && __X32_SYSCALL_BIT]:
Clear __X32_SYSCALL_BIT from scno on x32 personality.

linux/x86_64/get_scno.c
syscall.c

index af3329a10523a4240dab9fd0db923f8d1841dbd8..a87987e1d9b4f18f3da3e071a3eb9c5d65ad7ea9 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef X86_64
+# define X32_PERSONALITY_NUMBER 2
+#else
+# define X32_PERSONALITY_NUMBER 0
+#endif
+
 /* Return codes: 1 - ok, 0 - ignore, other - error. */
 static int
 arch_get_scno(struct tcb *tcp)
index 36f32799868edc9629f623ca620fb3f7c2c2e725..fed5d7cdf06d379a97295202ec8d847f1361e656 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -987,12 +987,6 @@ shuffle_scno(unsigned long scno)
 # define shuffle_scno(scno) ((long)(scno))
 #endif
 
-const char *
-syscall_name(long scno)
-{
-       return SCNO_IS_VALID(scno) ? sysent[scno].sys_name: NULL;
-}
-
 const char *
 err_name(unsigned long err)
 {
@@ -1740,3 +1734,13 @@ get_syscall_result(struct tcb *tcp)
 #ifdef HAVE_GETREGS_OLD
 # include "getregs_old.c"
 #endif
+
+const char *
+syscall_name(long scno)
+{
+#if defined X32_PERSONALITY_NUMBER && defined __X32_SYSCALL_BIT
+       if (current_personality == X32_PERSONALITY_NUMBER)
+               scno &= ~__X32_SYSCALL_BIT;
+#endif
+       return SCNO_IS_VALID(scno) ? sysent[scno].sys_name: NULL;
+}