arm: fix v4.10-25-g8497b62 fallout

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.
diff --git a/linux/arm/get_scno.c b/linux/arm/get_scno.c
index 6122d39..f9dcd65 100644
--- a/linux/arm/get_scno.c
+++ b/linux/arm/get_scno.c
@@ -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 @@
 #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;
+}