]> git.itanic.dy.fi Git - linux-stable/commit
s390/ptrace: fix setting syscall number
authorSven Schnelle <svens@linux.ibm.com>
Mon, 9 Mar 2020 15:44:50 +0000 (16:44 +0100)
committerSasha Levin <sashal@kernel.org>
Tue, 30 Jun 2020 19:38:43 +0000 (15:38 -0400)
commit31a2029da4543a33beafd0795d441124e58ac33a
tree97e13d6ed924b30c3e2fb6c3eafee130250ce1be
parent70a5b8b3abf5ac2c3abfd3f21929586c7ca6bf8d
s390/ptrace: fix setting syscall number

[ Upstream commit 873e5a763d604c32988c4a78913a8dab3862d2f9 ]

When strace wants to update the syscall number, it sets GPR2
to the desired number and updates the GPR via PTRACE_SETREGSET.
It doesn't update regs->int_code which would cause the old syscall
executed on syscall restart. As we cannot change the ptrace ABI and
don't have a field for the interruption code, check whether the tracee
is in a syscall and the last instruction was svc. In that case assume
that the tracer wants to update the syscall number and copy the GPR2
value to regs->int_code.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/s390/kernel/ptrace.c