]> git.baikalelectronics.ru Git - kernel.git/commit
s390/stack: fix possible register corruption with stack switch helper
authorHeiko Carstens <hca@linux.ibm.com>
Fri, 18 Jun 2021 14:58:47 +0000 (16:58 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Mon, 21 Jun 2021 09:19:18 +0000 (11:19 +0200)
commit1e5630f75680b6dd15f0935e4e6d9007efd6326e
tree8641c17c4af3f413489ec76c23a1cd4b32892f1a
parent87d34068dc23ddc88ec102f16542d62a45ec38f3
s390/stack: fix possible register corruption with stack switch helper

The CALL_ON_STACK macro is used to call a C function from inline
assembly, and therefore must consider the C ABI, which says that only
registers 6-13, and 15 are non-volatile (restored by the called
function).

The inline assembly incorrectly marks all registers used to pass
parameters to the called function as read-only input operands, instead
of operands that are read and written to. This might result in
register corruption depending on usage, compiler, and compile options.

Fix this by marking all operands used to pass parameters as read/write
operands. To keep the code simple even register 6, if used, is marked
as read-write operand.

Fixes: 952575cdd865 ("s390: add stack switch helper")
Cc: <stable@kernel.org> # 4.20
Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/include/asm/stacktrace.h