]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390/entry: Fix last breaking event handling in case of stack corruption
authorHeiko Carstens <hca@linux.ibm.com>
Thu, 24 Apr 2025 15:07:01 +0000 (17:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jul 2025 13:57:41 +0000 (15:57 +0200)
commit ae952eea6f4a7e2193f8721a5366049946e012e7 upstream.

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")
Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/s390/kernel/entry.S

index 160290049e8cd05a143029d0fa77634d77903c2b..14a5eff4d027d5f13622d0c14aaa5ef69e8d3da4 100644 (file)
@@ -676,7 +676,7 @@ ENTRY(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_LAST_BREAK
        xc      __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
        lgr     %r2,%r11                # pass pointer to pt_regs
        jg      kernel_stack_overflow