]> git.baikalelectronics.ru Git - kernel.git/commit
s390: fix syscall_get_error for compat processes
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 2 Jun 2020 18:00:51 +0000 (21:00 +0300)
committerVasily Gorbik <gor@linux.ibm.com>
Wed, 17 Jun 2020 21:05:05 +0000 (23:05 +0200)
commite0c3e059c578a8ed65f4ed9a0af7b70ec9698e96
treeef9096a292898761281983a0755af0e06ad75349
parent098f87ed5b5bd32d4fa1f4711e70eee50fafdbce
s390: fix syscall_get_error for compat processes

If both the tracer and the tracee are compat processes, and gprs[2]
is assigned a value by __poke_user_compat, then the higher 32 bits
of gprs[2] are cleared, IS_ERR_VALUE() always returns false, and
syscall_get_error() always returns 0.

Fix the implementation by sign-extending the value for compat processes
the same way as x86 implementation does.

The bug was exposed to user space by commit 581c64a5d518f ("ptrace: add
PTRACE_GET_SYSCALL_INFO request") and detected by strace test suite.

This change fixes strace syscall tampering on s390.

Link: https://lkml.kernel.org/r/20200602180051.GA2427@altlinux.org
Fixes: 5b8d16f518bd0 ("[S390] ptrace changes")
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: stable@vger.kernel.org # v2.6.28+
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/include/asm/syscall.h