]> git.itanic.dy.fi Git - linux-stable/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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 11 Jul 2021 10:52:07 +0000 (12:52 +0200)
commit58356f448b61c9c532af863a981243c47ce4b9e5
treee94d7f8654b651316e14f98d03aa594311bcba2c
parentabbd42939db646f7210e1473e9cb17c6bc6f184c
s390/stack: fix possible register corruption with stack switch helper

commit 67147e96a332b56c7206238162771d82467f86c0 upstream.

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: ff340d2472ec ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/s390/include/asm/stacktrace.h