Fix decoding of arm syscall numbers by aarch64 strace.

If an aarch64 strace is tracing a process using the arm personality, it also
needs to call the shuffle_scno function for the ARM-specific syscalls.

Before:

  syscall_983045(0xfffffffff74c21b8, 0xfffffffff74c21b8, 0xfffffffff74c23e8,
                 0, 0xfffffffff74c1f7c, 0x800000) = 0

After:

  set_tls(0xfffffffff71101b8, 0xfffffffff71101b8, 0xfffffffff71103e8,
          0, 0xfffffffff710ff7c) = 0

Signed-off-by: Elliott Hughes <[email protected]>
diff --git a/syscall.c b/syscall.c
index a0cc312..5c4b42e 100644
--- a/syscall.c
+++ b/syscall.c
@@ -926,7 +926,7 @@ print_pc(struct tcb *tcp)
 /* Shuffle syscall numbers so that we don't have huge gaps in syscall table.
  * The shuffling should be reversible: shuffle_scno(shuffle_scno(n)) == n.
  */
-#if defined(ARM) /* So far only ARM needs this */
+#if defined(ARM) || defined(AARCH64) /* So far only 32-bit ARM needs this */
 static long
 shuffle_scno(unsigned long scno)
 {
@@ -1347,6 +1347,7 @@ get_scno(struct tcb *tcp)
                        /* We are in 32-bit mode */
                        /* Note: we don't support OABI, unlike 32-bit ARM build 
*/
                        scno = arm_regs.ARM_r7;
+                       scno = shuffle_scno(scno);
                        update_personality(tcp, 0);
                        break;
        }
------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to