BACKPORT: ARM: 8087/1: ptrace: reload syscall number after secure_computing() check

On the syscall tracing path, we call out to secure_computing() to allow
seccomp to check the syscall number being attempted. As part of this, a
SIGTRAP may be sent to the tracer and the syscall could be re-written by
a subsequent SET_SYSCALL ptrace request. Unfortunately, this new syscall
is ignored by the current code unless TIF_SYSCALL_TRACE is also set on
the current thread.

This patch slightly reworks the enter path of the syscall tracing code
so that we always reload the syscall number from
current_thread_info()->syscall after the potential ptrace traps.

Acked-by: Kees Cook <>
Tested-by: Kees Cook <>
Signed-off-by: Will Deacon <>
Signed-off-by: Russell King <>

Bug: 28020023
Patchset: seccomp

(cherry picked from kernel/msm commit 553f58ae6466757db2a9ea2d51100d481df211e2)
Signed-off-by: Kees Cook <>
Change-Id: I024d3ae40587db43028b2a20176baf22f1e0347e
1 file changed