On Thu, Aug 15, 2024 at 3:23 PM <devel-request@lists.crash-utility.osci.io> wrote:
Date: Wed, 14 Aug 2024 18:34:57 +1200
From: Tao Liu <ltao@redhat.com>
Subject: [Crash-utility] [PATCH] s390x: Fix "bt -f/-F" command fail
        with seek error
To: devel@lists.crash-utility.osci.io
Cc: Tao Liu <ltao@redhat.com>
Message-ID: <20240814063457.17633-1-ltao@redhat.com>
Content-Type: text/plain; charset="US-ASCII"; x-default=true

Previously a fail of cmd "bt -f/-F" observed:

crash> bt -f
PID: 3359     TASK: 28b01a09400       CPU: 0    COMMAND: "runtest.sh"
 LOWCORE INFO:
  ...
  -general registers:
     0x0000000034dd9140 0x0000039600000002
     0x00000396cad7dfa0 0x0000028b03ba5000
  ...
    0000028c6e9fffd8:  0000000000000000 0000000000000000
    0000028c6e9fffe8:  0000000000000000 0000000000000000
    0000028c6e9ffff8:  0000000000000000bt: seek error: kernel virtual
    address: 28c6ea00000  type: "readmem_ul"

The root cause is kernel commit ce3dc447493ff ("s390: add support for virtually
mapped kernel stacks") replaced "panic_task" by "nodat_stack", which
leading a wrong stack base/top calculation.

This patch fix the bug by checking if nodat_stack member is exist in struct
lowcore.


Thank you for the fix, Tao.

Looks good. Applied:
https://github.com/crash-utility/crash/commit/5218919ec108bac0132b20fe18cf4aae9e30a6c6

Thanks
Lianbo
 
Signed-off-by: Tao Liu <ltao@redhat.com>
---
 s390x.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/s390x.c b/s390x.c
index 794ae82..ad69184 100644
--- a/s390x.c
+++ b/s390x.c
@@ -1797,7 +1797,13 @@ static void s390x_back_trace_cmd(struct bt_info *bt)
                                      cpu, lowcore, &low, &high);
                        sp = show_trace(bt, cnt, sp, low, high);
                }
-               get_int_stack("panic_stack", cpu, lowcore, &low, &high);
+               if (MEMBER_EXISTS("lowcore", "nodat_stack")) {
+                       get_int_stack("nodat_stack",
+                                     cpu, lowcore, &low, &high);
+               } else {
+                       get_int_stack("panic_stack",
+                                     cpu, lowcore, &low, &high);
+               }
                sp = show_trace(bt, cnt, sp, low, high);
                get_int_stack("async_stack", cpu, lowcore, &low, &high);
                sp = show_trace(bt, cnt, sp, low, high);
--
2.40.1