Linux s390 Architecture development
 help / color / mirror / Atom feed
* [PATCH] s390/uprobes: Fix off-by-one bug in emulated PER handling
@ 2026-10-09 13:26 Heiko Carstens
  2026-10-09 13:33 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Heiko Carstens @ 2026-10-09 13:26 UTC (permalink / raw)
  To: Alexander Gordeev, Sven Schnelle, Vasily Gorbik,
	Christian Borntraeger
  Cc: linux-kernel, linux-s390

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@linux.ibm.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] s390/uprobes: Fix off-by-one bug in emulated PER handling
  2026-10-09 13:26 [PATCH] s390/uprobes: Fix off-by-one bug in emulated PER handling Heiko Carstens
@ 2026-10-09 13:33 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-10-09 13:33 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Heiko Carstens, linux-s390, Alexander Gordeev,
	Christian Borntraeger, Vasily Gorbik

> 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@linux.ibm.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009132604.2434271-1-hca@linux.ibm.com?part=1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-09 13:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-09 13:26 [PATCH] s390/uprobes: Fix off-by-one bug in emulated PER handling Heiko Carstens
2026-10-09 13:33 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox