From: Dmitry V. Levin Date: Mon, 23 Mar 2015 23:00:37 +0000 (+0000) Subject: arm: fix v4.10-25-g8497b62 fallout X-Git-Tag: v4.11~545 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9945ec97c60897c79d982ca3b194cb98cd5beda9;p=strace 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 6122d398..f9dcd651 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 @@ 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; +}