Re: [PATCH 07/32] s390/traps: Handle nullifying program checks in get_trap_ip()
From: Ilya Leoshkevich
Date: Mon Oct 12 2026 - 09:15:06 EST
On 10/1/26 12:32, Heiko Carstens wrote:
get_trap_ip() always rewinds the PSW address by the instruction length
from the interruption code. For nullifying program checks the PSW
already points at the faulting instruction, so rewinding is wrong.
Add a nullified[] bitmap and return the unchanged PSW address for
nullifying cases, or if PIF_PSW_ADDR_ADJUSTED is set.
No functional change for existing callers, which only deal with
suppressing, terminating, or completing program checks.
Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
---
arch/s390/kernel/traps.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index bfcab4592299..5e63032a56db 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -26,6 +26,7 @@
#include <linux/entry-common.h>
#include <linux/kmsan.h>
#include <linux/bug.h>
+#include <asm/pgmcheck-defs.h>
#include <asm/entry-percpu.h>
#include <asm/asm-extable.h>
#include <asm/irqflags.h>
@@ -41,15 +42,19 @@ struct pgm_stat {
static DEFINE_PER_CPU_SHARED_ALIGNED(struct pgm_stat, pgm_stat);
-static inline void __user *get_trap_ip(struct pt_regs *regs)
+static inline unsigned long get_trap_ip(struct pt_regs *regs)
{
- unsigned long address;
+ static const unsigned long nullified[2] = { PGM_CHECKS_NULLIFIED };
Maybe just [], to deal with the possibility of expansion in the future?
[...]
@@ -152,7 +157,7 @@ static void illegal_op(struct pt_regs *regs)
int signal = 0;
u16 opcode;
- location = get_trap_ip(regs);
+ location = (void __user *)get_trap_ip(regs);
Should location be moved inside the "if"? Now it reads weirdly: we cast
the pointer to __user before checking for user mode.
if (user_mode(regs)) {
if (get_user(opcode, location))
return;
Regardless:
Reviewed-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx>