]> granicus.if.org Git - strace/commitdiff
arm: fix v4.10-25-g8497b62 fallout
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 23 Mar 2015 23:00:37 +0000 (23:00 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 24 Mar 2015 01:41:51 +0000 (01:41 +0000)
Starting with commit v4.10-25-g8497b62,

arm$ ./strace true
pid 1234 stray syscall exit
Segmentation fault

Fix this by updating ARM syscall sanity check.
In particular, get_scno() should not set TCB_INSYSCALL flag because
other code assumes that s_ent is properly initialized when this flag
is set.

* linux/arm/get_scno.c: Check syscall number after fetching.
Do not apply the check to SCNO_IN_RANGE syscalls.
Do not set TCB_INSYSCALL flag.
Extend diagnostics and move it to debug level.

linux/arm/get_scno.c

index 6122d3988578ca2cfae14a9a21356cf7bcfc2642..f9dcd651f9a4eb9a1718786a7758b8b69f595b00 100644 (file)
@@ -1,10 +1,3 @@
-if (arm_regs.ARM_ip != 0) {
-       /* It is not a syscall entry */
-       fprintf(stderr, "pid %d stray syscall exit\n", tcp->pid);
-       tcp->flags |= TCB_INSYSCALL;
-       return 0;
-}
-
 /* Note: we support only 32-bit CPUs, not 26-bit */
 
 #if !defined(__ARM_EABI__) || ENABLE_ARM_OABI
@@ -39,3 +32,15 @@ scno = arm_regs.ARM_r7;
 #endif
 
 scno = shuffle_scno(scno);
+
+/*
+ * Do some sanity checks to figure out
+ * whether it's really a syscall entry.
+ */
+if (arm_regs.ARM_ip && !SCNO_IN_RANGE(scno)) {
+       if (debug_flag)
+               fprintf(stderr,
+                       "pid %d stray syscall exit: ARM_ip = %ld, scno = %ld\n",
+                       tcp->pid, arm_regs.ARM_ip, shuffle_scno(scno));
+       return 0;
+}