[PATCH] s390/uprobes: Fix off-by-one bug in emulated PER handling

From: Heiko Carstens

Date: Fri Oct 09 2026 - 09:54:51 EST


The uprobes code emulates some instructions, and with that also
PER storage-alteration handling, in case a debugger is attached.

The PER storage-alteration handling contains an off-by-one bug, which
may lead to PER traps which should not happen. Adjust the comparison
in sim_stor_event() to fix that.

Fixes: 8d1a2427d8fc ("s390/uprobes: fix user space PER events")
Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
---
arch/s390/kernel/uprobes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/kernel/uprobes.c b/arch/s390/kernel/uprobes.c
index c624f3361e43..b2b8a377ced6 100644
--- a/arch/s390/kernel/uprobes.c
+++ b/arch/s390/kernel/uprobes.c
@@ -241,7 +241,7 @@ static void sim_stor_event(struct pt_regs *regs, void *addr, int len)
return;
if (!(current->thread.per_user.control & PER_EVENT_STORE))
return;
- if ((void *)current->thread.per_user.start > (addr + len))
+ if ((void *)current->thread.per_user.start > (addr + len - 1))
return;
if ((void *)current->thread.per_user.end < addr)
return;
--
2.53.0