s390/ptrace: fix storage key handling
authorHeiko Carstens <hca@linux.ibm.com>
Wed, 12 Aug 2020 16:56:28 +0000 (18:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Aug 2020 09:49:12 +0000 (11:49 +0200)
commitca79907768d37193ce7353a1cf2a9ac38c9c6ab1
treee1675515a30f1db26e8bc5aa1be2fd7a5b61d742
parent87a297a5a835d63eba67ce8c1884d6e4f69a6731
s390/ptrace: fix storage key handling

[ Upstream commit fd78c59446b8d050ecf3e0897c5a486c7de7c595 ]

The key member of the runtime instrumentation control block contains
only the access key, not the complete storage key. Therefore the value
must be shifted by four bits. Since existing user space does not
necessarily query and set the access key correctly, just ignore the
user space provided key and use the correct one.
Note: this is only relevant for debugging purposes in case somebody
compiles a kernel with a default storage access key set to a value not
equal to zero.

Fixes: 262832bc5acd ("s390/ptrace: add runtime instrumention register get/set")
Reported-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/s390/kernel/ptrace.c