Skip to contentSkip to conversation

s390/entry: Fix last breaking event handling in case of stack corruption

PATCH In review Heiko Carstens 2 participants 2 messages Jun 23, 2025 – Jun 25, 2025 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390/entry: Fix last breaking event handling in case of stack corruption

commit ae952eea6f4a7e2193f8721a5366049946e012e7 upstream.

Note: the GET_LC macro and all the infrastructe that comes with this does not exist for this kernel release. Therefore the patch is slightly different to the upstream variant.

In case of stack corruption stack_invalid() is called and the expectation is that register r10 contains the last breaking event address. This dependency is quite subtle and broke a couple of years ago without that anybody noticed.

Fix this by getting rid of the dependency and read the last breaking event address from lowcore.

Fixes 56e62a737028 ("s390: convert to generic entry")
---
 arch/s390/kernel/entry.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kernel/entry.S +1 -1
index ebad8c8b8c57..0476ce7700df 100644
@@ -639,7 +639,7 @@ SYM_CODE_START(stack_overflow)
 	stmg	%r0,%r7,__PT_R0(%r11)
 	stmg	%r8,%r9,__PT_PSW(%r11)
 	mvc	__PT_R8(64,%r11),0(%r14)
-	stg	%r10,__PT_ORIG_GPR2(%r11) # store last break to orig_gpr2
+	mvc	__PT_ORIG_GPR2(8,%r11),__LC_PGM_LAST_BREAK
 	xc	__SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
 	lgr	%r2,%r11		# pass pointer to pt_regs
 	jg	kernel_stack_overflow
Signature · 1 line
2.48.1
maintainer
#1 lore raw

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: ae952eea6f4a7e2193f8721a5366049946e012e7

Status in newer kernel trees:
6.15.y | Present (exact SHA1)
6.12.y | Present (different SHA1: 5c3b8f05756b)

Note: The patch differs from the upstream commit:
---

1:  ae952eea6f4a7 < -:  ------------- s390/entry: Fix last breaking event handling in case of stack corruption
-:  ------------- > 1:  5d8199e6ab3c2 s390/entry: Fix last breaking event handling in case of stack corruption

---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.6.y        |  Success    |  Success   |