diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2021-07-05 12:06:55 +0200 |
---|---|---|
committer | Vasily Gorbik <gor@linux.ibm.com> | 2021-07-08 15:37:27 +0200 |
commit | b9639b3155d9fac737742324443d3f36ff7abc7c (patch) | |
tree | c49bf29ad1d5ef5a3dfa5f6707d0868bac56be41 /arch/riscv/errata | |
parent | 0aa4ff7688632a86bdb133fa106f2ccd514b91a7 (diff) | |
download | linux-stable-b9639b3155d9fac737742324443d3f36ff7abc7c.tar.gz linux-stable-b9639b3155d9fac737742324443d3f36ff7abc7c.tar.bz2 linux-stable-b9639b3155d9fac737742324443d3f36ff7abc7c.zip |
s390/ap: get rid of register asm
Using register asm statements has been proven to be very error prone,
especially when using code instrumentation where gcc may add function
calls, which clobbers register contents in an unexpected way.
Therefore get rid of register asm statements in ap code. There are also
potential bugs, depending on inline decisions of the compiler.
E.g. for:
static inline struct ap_queue_status ap_tapq(ap_qid_t qid, unsigned long *info)
{
register unsigned long reg0 asm ("0") = qid;
register struct ap_queue_status reg1 asm ("1");
register unsigned long reg2 asm ("2");
asm volatile(".long 0xb2af0000" /* PQAP(TAPQ) */
: "=d" (reg1), "=d" (reg2)
: "d" (reg0)
: "cc");
if (info)
*info = reg2;
return reg1;
}
In case of KCOV the "if (info)" line could cause a generated function
call, which could clobber the contents of both reg2, and reg1.
Similar can happen in case of KASAN for the "*info = reg2" line.
Even though compilers will likely inline the function and optimize
things away, this is not guaranteed.
To get rid of this bug class, simply get rid of register asm constructs.
Note: The inline function ap_dqap() will be handled in a
separate patch because this one requires an addressing of the
odd register of a register pair (which is done with %N[xxx] in
the assembler code) and that's currently not supported by clang.
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch/riscv/errata')
0 files changed, 0 insertions, 0 deletions