Re: [PATCH] ARM fix syscall trace return value
From: Russell King
Date: Tue Feb 17 2009 - 14:04:11 EST
On Tue, Feb 17, 2009 at 01:18:05PM -0500, Mathieu Desnoyers wrote:
> I am currently finding core bugs in the Linux kernel implementation of
> the ARM architecture. :-( e.g. return value not being sent to the
> syscall_trace function upon exit (upon which LTTng depends). (patch
> below)
Well then how can strace work? The fact of the matter is that strace
can and does work, and so I suspect that the problem is not in the
kernel but whatever "LTTng" is trying to do.
> BTW, the patch below applies to 2.6.29-rc4.
And is wrong.
> Index: linux-omap-2.6/arch/arm/kernel/entry-common.S
> ===================================================================
> --- linux-omap-2.6.orig/arch/arm/kernel/entry-common.S 2009-02-17 16:58:14.000000000 +0000
> +++ linux-omap-2.6/arch/arm/kernel/entry-common.S 2009-02-17 17:24:33.000000000 +0000
> @@ -89,6 +89,7 @@
> mov why, #1
> tst r1, #_TIF_SYSCALL_TRACE @ are we tracing syscalls?
> beq ret_slow_syscall
> + mov r2, #0 @ fork returns 0 to the child
This may be incorrect.
> mov r1, sp
> mov r0, #1 @ trace exit [IP = 1]
> bl syscall_trace
> @@ -292,7 +293,7 @@
>
> __sys_trace_return:
> str r0, [sp, #S_R0 + S_OFF]! @ save returned r0
> - mov r2, scno
> + mov r2, r0
This part is wrong. 'r2' *is* the syscall number.
The place to get the return value is by reading the registers, r0 to be
exact. No other method is supported.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/