]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
s390/fault: Print unmodified PSW address on protection exception
authorHeiko Carstens <hca@linux.ibm.com>
Tue, 4 Nov 2025 10:48:57 +0000 (11:48 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Fri, 14 Nov 2025 10:34:28 +0000 (11:34 +0100)
commit52a1f73d1733e6d5bf2cbfa93296207e542cdea7
treee02fd96db847e7355d7360d78416ddca12088abc
parenta603a0039965ee66d7e521bacf8161d3109bfd75
s390/fault: Print unmodified PSW address on protection exception

In case of a kernel crash caused by a protection exception, print the
unmodified PSW address as reported by the CPU. The protection exception
handler modifies the PSW address in order to keep fault handling easy,
however that leads to misleading call traces.

Therefore restore the original PSW address before printing it.

Before this change the output in case of a protection exception looks like
this:

 Oops: 0004 ilc:2 [#1]SMP
 Krnl PSW : 0704c00180000000 000003ffe0b40d78 (sysrq_handle_crash+0x28/0x40)
            R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 RI:0 EA:3
...
 Krnl Code: 000003ffe0b40d66e3e0f0980024        stg     %r14,152(%r15)
            000003ffe0b40d6cc010fffffff2        larl    %r1,000003ffe0b40d50
           #000003ffe0b40d72c0200046b6bc        larl    %r2,000003ffe1417aea
           >000003ffe0b40d7892021000            mvi     0(%r1),2
            000003ffe0b40d7cc0e5ffae03d6        brasl   %r14,000003ffe0101528

With this change it looks like this:

 Oops: 0004 ilc:2 [#1]SMP
 Krnl PSW : 0704c00180000000 000003ffe0b40dfc (sysrq_handle_crash+0x2c/0x40)
            R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 RI:0 EA:3
...
 Krnl Code: 000003ffe0b40decc010fffffff2        larl    %r1,000003ffe0b40dd0
            000003ffe0b40df2c0200046b67c        larl    %r2,000003ffe1417aea
           *000003ffe0b40df892021000            mvi     0(%r1),2
           >000003ffe0b40dfcc0e5ffae03b6        brasl   %r14,000003ffe0101568
            000003ffe0b40e02: 0707                bcr     0,%r7

Note that with this change the PSW address points to the instruction behind
the instruction which caused the exception like it is expected for
protection exceptions.

This also replaces the '#' marker in the disassembly with '*', which allows
to distinguish between new and old behavior.

Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/ptrace.h
arch/s390/kernel/dis.c
arch/s390/kernel/dumpstack.c
arch/s390/mm/fault.c