]> 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)
commite8c87be57fff3871db14e493288e269c9a52cc8e
tree8641c17c4af3f413489ec76c23a1cd4b32892f1a
parentb888da203c892ca4e2a80677bacc88f85c4480da
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: c7738ce80b5c ("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