ARM: 7411/1: audit: fix treatment of saved ip register during syscall tracing
authorWill Deacon <will.deacon@arm.com>
Fri, 4 May 2012 16:52:02 +0000 (17:52 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 5 May 2012 12:54:01 +0000 (13:54 +0100)
commit6a68b6f574c8ad2c1d90f0db8fd95b8abe8a0a73
tree0d279c6835622d461a35ee1a55ad62275d7e0520
parente787ec1376e862fcea1bfd523feb7c5fb43ecdb9
ARM: 7411/1: audit: fix treatment of saved ip register during syscall tracing

The ARM audit code incorrectly uses the saved application ip register
value to infer syscall entry or exit. Additionally, the saved value will
be clobbered if the current task is not being traced, which can lead to
libc corruption if ip is live (apparently glibc uses it for the TLS
pointer).

This patch fixes the syscall tracing code so that the why parameter is
used to infer the syscall direction and the saved ip is only updated if
we know that we will be signalling a ptrace trap.

Reported-and-Tested-by: Jon Masters <jcm@jonmasters.org>

Cc: stable@vger.kernel.org
Cc: Eric Paris <eparis@redhat.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/kernel/ptrace.c