linux/arch/s390
Heiko Carstens b9639b3155 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>
2021-07-08 15:37:27 +02:00
..
appldata s390/appldata: use struct_size() helper 2020-06-29 16:32:34 +02:00
boot s390/boot: replace magic string check with a bootdata flag 2021-07-05 12:44:23 +02:00
configs s390/configs: change CONFIG_VIRTIO_CONSOLE to "m" 2021-04-30 17:17:01 +02:00
crypto s390/archrandom: add parameter check for s390_arch_random_generate 2021-04-21 12:32:12 +02:00
hypfs s390/hypfs: use register pair instead of register asm 2021-06-28 11:18:28 +02:00
include s390/ap: get rid of register asm 2021-07-08 15:37:27 +02:00
kernel s390/traps: do not test MONITOR CALL without CONFIG_BUG 2021-07-08 15:37:27 +02:00
kvm s390 updates for the 5.14 merge window 2021-07-04 12:17:38 -07:00
lib s390/lib,string: fix strcat() inline asm constraint modifier 2021-07-05 12:44:23 +02:00
mm s390: mm: Fix secure storage access exception handling 2021-07-05 12:44:23 +02:00
net s390/bpf: Implement new atomic ops 2021-03-16 12:18:49 -07:00
pci s390/pci: add zpci_set_irq()/zpci_clear_irq() 2021-06-28 11:18:28 +02:00
purgatory s390: disable SSP when needed 2021-06-07 17:07:00 +02:00
tools KVM: s390: gen_facilities: allow facilities 165, 193, 194 and 196 2021-06-23 09:35:03 +02:00
Kbuild s390/numa: move code to arch/s390/kernel 2020-08-11 18:16:55 +02:00
Kconfig s390/irq: remove HAVE_IRQ_EXIT_ON_IRQ_STACK 2021-07-08 15:37:27 +02:00
Kconfig.debug s390/cio: add CRW inject functionality 2021-03-22 11:36:04 +01:00
Makefile s390: disable SSP when needed 2021-06-07 17:07:00 +02:00