linux-stable/arch
Nico Boehr 2951229ee7 KVM: s390: pv: fix external interruption loop not always detected
[ Upstream commit 21f27df854 ]

To determine whether the guest has caused an external interruption loop
upon code 20 (external interrupt) intercepts, the ext_new_psw needs to
be inspected to see whether external interrupts are enabled.

Under non-PV, ext_new_psw can simply be taken from guest lowcore. Under
PV, KVM can only access the encrypted guest lowcore and hence the
ext_new_psw must not be taken from guest lowcore.

handle_external_interrupt() incorrectly did that and hence was not able
to reliably tell whether an external interruption loop is happening or
not. False negatives cause spurious failures of my kvm-unit-test
for extint loops[1] under PV.

Since code 20 is only caused under PV if and only if the guest's
ext_new_psw is enabled for external interrupts, false positive detection
of a external interruption loop can not happen.

Fix this issue by instead looking at the guest PSW in the state
description. Since the PSW swap for external interrupt is done by the
ultravisor before the intercept is caused, this reliably tells whether
the guest is enabled for external interrupts in the ext_new_psw.

Also update the comments to explain better what is happening.

[1] https://lore.kernel.org/kvm/20220812062151.1980937-4-nrb@linux.ibm.com/

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Fixes: 201ae986ea ("KVM: s390: protvirt: Implement interrupt injection")
Link: https://lore.kernel.org/r/20230213085520.100756-2-nrb@linux.ibm.com
Message-Id: <20230213085520.100756-2-nrb@linux.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-20 12:10:21 +02:00
..
alpha alpha: fix R_ALPHA_LITERAL reloc for large modules 2023-03-17 08:45:14 +01:00
arc
arm ARM: dts: imx6sl: tolino-shine2hd: fix usbotg1 pinctrl 2023-04-05 11:23:32 +02:00
arm64 arm64: efi: Make efi_rt_lock a raw_spinlock 2023-03-17 08:45:08 +01:00
c6x
csky csky: Fix function name in csky_alignment() and die() 2023-02-01 08:23:20 +01:00
h8300 h8300: Fix build errors from do_exit() to make_task_dead() transition 2023-02-01 08:23:19 +01:00
hexagon hexagon: Fix function name in die() 2023-02-01 08:23:19 +01:00
ia64 ia64: make IA64_MCA_RECOVERY bool instead of tristate 2023-02-01 08:23:20 +01:00
m68k m68k: Only force 030 bus error if PC not in exception table 2023-04-05 11:23:38 +02:00
microblaze exit: Add and use make_task_dead. 2023-02-01 08:23:19 +01:00
mips mips: bmips: BCM6358: disable RAC flush for TP1 2023-04-05 11:23:46 +02:00
nds32 exit: Add and use make_task_dead. 2023-02-01 08:23:19 +01:00
nios2 exit: Add and use make_task_dead. 2023-02-01 08:23:19 +01:00
openrisc exit: Add and use make_task_dead. 2023-02-01 08:23:19 +01:00
parisc parisc: Wire up PTRACE_GETREGS/PTRACE_SETREGS for compat case 2023-02-15 17:22:19 +01:00
powerpc powerpc: Don't try to copy PPR for task with NULL pt_regs 2023-04-05 11:23:50 +02:00
riscv riscv: Bump COMMAND_LINE_SIZE value to 1024 2023-04-05 11:23:37 +02:00
s390 KVM: s390: pv: fix external interruption loop not always detected 2023-04-20 12:10:21 +02:00
sh sh: sanitize the flags on sigreturn 2023-04-05 11:23:39 +02:00
sparc sparc: allow PM configs for sparc32 COMPILE_TEST 2023-03-11 16:39:40 +01:00
um UML: define RUNTIME_DISCARD_EXIT 2023-03-17 08:45:17 +01:00
x86 x86/mm: Fix use of uninitialized buffer in sme_enable() 2023-03-22 13:30:05 +01:00
xtensa xtensa: fix KASAN report for show_stack 2023-04-05 11:23:51 +02:00
.gitignore
Kconfig