Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package crash for openSUSE:Factory checked 
in at 2024-08-05 17:24:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/crash (Old)
 and      /work/SRC/openSUSE:Factory/.crash.new.7232 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "crash"

Mon Aug  5 17:24:06 2024 rev:195 rq:1191712 version:8.0.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/crash/crash.changes      2024-03-13 
22:20:29.076487043 +0100
+++ /work/SRC/openSUSE:Factory/.crash.new.7232/crash.changes    2024-08-05 
17:24:47.463773378 +0200
@@ -1,0 +2,16 @@
+Thu Aug  1 07:03:18 UTC 2024 - Jiri Slaby <[email protected]>
+
+- add (bsc#1228388):
+  * 0001-arm64-section_size_bits-compatible-with-macro-defini.patch
+  * 0002-Reflect-__-start-end-_init_task-kernel-symbols-renam.patch
+  * 0003-x86_64-fix-for-adding-top_of_kernel_stack_padding-fo.patch
+  * 0004-Fix-kmem-v-option-on-Linux-6.9-and-later-kernels.patch
+  * 0005-X86-64-fix-for-crash-session-loading-failure.patch
+  * 0006-Fix-for-failing-to-load-kernel-module.patch
+  * 0007-X86-64-fix-a-regression-issue-about-kernel-stack-pad.patch
+  * 0008-Fix-kmem-i-and-swap-commands-on-Linux-6.10-rc1-and-l.patch
+  * 0009-List-enable-LIST_HEAD_FORMAT-for-r-option.patch
+  * 0010-arm64-fix-a-potential-segfault-when-unwind-frame.patch
+  * 0011-arm64-Fix-bt-command-show-wrong-stacktrace-on-ramdum.patch
+
+-------------------------------------------------------------------

Old:
----
  crash-8.0.4.tar.gz

New:
----
  0001-arm64-section_size_bits-compatible-with-macro-defini.patch
  0002-Reflect-__-start-end-_init_task-kernel-symbols-renam.patch
  0003-x86_64-fix-for-adding-top_of_kernel_stack_padding-fo.patch
  0004-Fix-kmem-v-option-on-Linux-6.9-and-later-kernels.patch
  0005-X86-64-fix-for-crash-session-loading-failure.patch
  0006-Fix-for-failing-to-load-kernel-module.patch
  0007-X86-64-fix-a-regression-issue-about-kernel-stack-pad.patch
  0008-Fix-kmem-i-and-swap-commands-on-Linux-6.10-rc1-and-l.patch
  0009-List-enable-LIST_HEAD_FORMAT-for-r-option.patch
  0010-arm64-fix-a-potential-segfault-when-unwind-frame.patch
  0011-arm64-Fix-bt-command-show-wrong-stacktrace-on-ramdum.patch
  crash-8.0.5.tar.gz

BETA DEBUG BEGIN:
  New:- add (bsc#1228388):
  * 0001-arm64-section_size_bits-compatible-with-macro-defini.patch
  * 0002-Reflect-__-start-end-_init_task-kernel-symbols-renam.patch
  New:  * 0001-arm64-section_size_bits-compatible-with-macro-defini.patch
  * 0002-Reflect-__-start-end-_init_task-kernel-symbols-renam.patch
  * 0003-x86_64-fix-for-adding-top_of_kernel_stack_padding-fo.patch
  New:  * 0002-Reflect-__-start-end-_init_task-kernel-symbols-renam.patch
  * 0003-x86_64-fix-for-adding-top_of_kernel_stack_padding-fo.patch
  * 0004-Fix-kmem-v-option-on-Linux-6.9-and-later-kernels.patch
  New:  * 0003-x86_64-fix-for-adding-top_of_kernel_stack_padding-fo.patch
  * 0004-Fix-kmem-v-option-on-Linux-6.9-and-later-kernels.patch
  * 0005-X86-64-fix-for-crash-session-loading-failure.patch
  New:  * 0004-Fix-kmem-v-option-on-Linux-6.9-and-later-kernels.patch
  * 0005-X86-64-fix-for-crash-session-loading-failure.patch
  * 0006-Fix-for-failing-to-load-kernel-module.patch
  New:  * 0005-X86-64-fix-for-crash-session-loading-failure.patch
  * 0006-Fix-for-failing-to-load-kernel-module.patch
  * 0007-X86-64-fix-a-regression-issue-about-kernel-stack-pad.patch
  New:  * 0006-Fix-for-failing-to-load-kernel-module.patch
  * 0007-X86-64-fix-a-regression-issue-about-kernel-stack-pad.patch
  * 0008-Fix-kmem-i-and-swap-commands-on-Linux-6.10-rc1-and-l.patch
  New:  * 0007-X86-64-fix-a-regression-issue-about-kernel-stack-pad.patch
  * 0008-Fix-kmem-i-and-swap-commands-on-Linux-6.10-rc1-and-l.patch
  * 0009-List-enable-LIST_HEAD_FORMAT-for-r-option.patch
  New:  * 0008-Fix-kmem-i-and-swap-commands-on-Linux-6.10-rc1-and-l.patch
  * 0009-List-enable-LIST_HEAD_FORMAT-for-r-option.patch
  * 0010-arm64-fix-a-potential-segfault-when-unwind-frame.patch
  New:  * 0009-List-enable-LIST_HEAD_FORMAT-for-r-option.patch
  * 0010-arm64-fix-a-potential-segfault-when-unwind-frame.patch
  * 0011-arm64-Fix-bt-command-show-wrong-stacktrace-on-ramdum.patch
  New:  * 0010-arm64-fix-a-potential-segfault-when-unwind-frame.patch
  * 0011-arm64-Fix-bt-command-show-wrong-stacktrace-on-ramdum.patch
BETA DEBUG END:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ crash.spec ++++++
--- /var/tmp/diff_new_pack.ArYoeG/_old  2024-08-05 17:24:48.519817278 +0200
+++ /var/tmp/diff_new_pack.ArYoeG/_new  2024-08-05 17:24:48.519817278 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package crash
 #
-# Copyright (c) 2023 SUSE LLC
+# Copyright (c) 2024 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -61,7 +61,7 @@
 Summary:        Crash utility for live systems; netdump, diskdump, LKCD or 
mcore dumpfiles
 License:        GFDL-1.2-only AND GPL-3.0-or-later
 Group:          Development/Tools/Debuggers
-Version:        8.0.4
+Version:        8.0.5
 Release:        0
 Source:         
https://github.com/crash-utility/crash/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
 Source1:        https://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz
@@ -95,6 +95,17 @@
 Patch32:        %{name}-extensions-rule-for-defs.patch
 Patch90:        %{name}-sial-ps-2.6.29.diff
 Patch99:        %{name}-usrmerge.patch
+Patch100:       0001-arm64-section_size_bits-compatible-with-macro-defini.patch
+Patch101:       0002-Reflect-__-start-end-_init_task-kernel-symbols-renam.patch
+Patch102:       0003-x86_64-fix-for-adding-top_of_kernel_stack_padding-fo.patch
+Patch103:       0004-Fix-kmem-v-option-on-Linux-6.9-and-later-kernels.patch
+Patch104:       0005-X86-64-fix-for-crash-session-loading-failure.patch
+Patch105:       0006-Fix-for-failing-to-load-kernel-module.patch
+Patch106:       0007-X86-64-fix-a-regression-issue-about-kernel-stack-pad.patch
+Patch107:       0008-Fix-kmem-i-and-swap-commands-on-Linux-6.10-rc1-and-l.patch
+Patch108:       0009-List-enable-LIST_HEAD_FORMAT-for-r-option.patch
+Patch109:       0010-arm64-fix-a-potential-segfault-when-unwind-frame.patch
+Patch110:       0011-arm64-Fix-bt-command-show-wrong-stacktrace-on-ramdum.patch
 BuildRequires:  bison
 BuildRequires:  flex
 BuildRequires:  gcc-c++
@@ -258,6 +269,17 @@
 done
 
 %patch -P 32 -p1
+%patch -P 100 -p1
+%patch -P 101 -p1
+%patch -P 102 -p1
+%patch -P 103 -p1
+%patch -P 104 -p1
+%patch -P 105 -p1
+%patch -P 106 -p1
+%patch -P 107 -p1
+%patch -P 108 -p1
+%patch -P 109 -p1
+%patch -P 110 -p1
 
 ## SIAL patches
 cd sial-scripts-%{scripts_version}

++++++ 0001-arm64-section_size_bits-compatible-with-macro-defini.patch ++++++
From: Guanyou Chen <[email protected]>
Date: Wed, 17 Apr 2024 19:55:40 +0800
Subject: arm64: section_size_bits compatible with macro definitions
Git-repo: https://github.com/crash-utility/crash.git
Git-commit: 568c6f049ad4a20918afeb2db9bb7a15b17d9ff2
Patch-mainline: 8.0.6
References: bsc#1228388

Compatible with google android GKI changes,
SECTION_SIZE_BITS = 27 when defined 4K_PAGES or 16K_PAGES.
SECTION_SIZE_BITS = 29 when defined 64K_PAGES.

Before android-12-gki:
    crash> help -m | grep section_size_bits
       section_size_bits: 30

The first PFN error, the physical address should be 0x40000000.
    crash> kmem -p
          PAGE        PHYSICAL      MAPPING       INDEX CNT FLAGS
    ffffffff06e00000 200000000 ffffff80edf4fa12 ffffffff070f3640  1
4000000000002000 private

After android-12-gki:
    crash> help -m | grep section
       section_size_bits: 27

    crash> kmem -p
          PAGE        PHYSICAL      MAPPING       INDEX CNT FLAGS
    fffffffeffe00000  40000000                0        0  1 1000 reserved

Link: 
https://lore.kernel.org/lkml/15cf9a2359197fee0168f820c5c904650d07939e.1610146597.git.sudar...@codeaurora.org
Link: 
https://lore.kernel.org/all/43843c5e092bfe3ec4c41e3c8c78a7ee35b69bb0.1611206601.git.sudar...@codeaurora.org
Link: 
https://cs.android.com/android/_/android/kernel/common/+/673e9ab6b64f981159aeff3b65675bb7dbedecd8
Signed-off-by: chenguanyou <[email protected]>
Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
---
 arm64.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arm64.c b/arm64.c
index af0e0d7b9f68..b3040d757946 100644
--- a/arm64.c
+++ b/arm64.c
@@ -1628,7 +1628,14 @@ arm64_get_section_size_bits(void)
                if ((ret = get_kernel_config("CONFIG_MEMORY_HOTPLUG", NULL)) == 
IKCONFIG_Y) {
                        if ((ret = 
get_kernel_config("CONFIG_HOTPLUG_SIZE_BITS", &string)) == IKCONFIG_STR)
                                machdep->section_size_bits = atol(string);
-               } 
+               }
+
+               /* arm64: reduce section size for sparsemem */
+               if ((ret = get_kernel_config("CONFIG_ARM64_4K_PAGES", NULL)) == 
IKCONFIG_Y
+                       || (ret = get_kernel_config("CONFIG_ARM64_16K_PAGES", 
NULL)) == IKCONFIG_Y)
+                       machdep->section_size_bits = _SECTION_SIZE_BITS_5_12;
+               else if ((ret = get_kernel_config("CONFIG_ARM64_64K_PAGES", 
NULL)) == IKCONFIG_Y)
+                       machdep->section_size_bits = 
_SECTION_SIZE_BITS_5_12_64K;
        }
 
        if (CRASHDEBUG(1))
-- 
2.45.2


++++++ 0002-Reflect-__-start-end-_init_task-kernel-symbols-renam.patch ++++++
From: Alexander Gordeev <[email protected]>
Date: Wed, 10 Apr 2024 14:55:35 +0200
Subject: Reflect __{start,end}_init_task kernel symbols rename
Git-repo: https://github.com/crash-utility/crash.git
Git-commit: 3879e9104826d5ae14a0824ec47ab60056a249a7
Patch-mainline: 8.0.6
References: bsc#1228388

Kernel commit 8f69cba096b5 ("x86: Rename __{start,end}_init_task to
__{start,end}_init_stack") leads to failure when crash loading:

        crash: invalid count request: 0

Assume both __{start,end}_init_task and __{start,end}_init_stack
symbols could exist for backward compatibility.

Signed-off-by: Alexander Gordeev <[email protected]>
Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
---
 task.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/task.c b/task.c
index ebdb5be3786f..d52ce0becc74 100644
--- a/task.c
+++ b/task.c
@@ -496,10 +496,17 @@ task_init(void)
                ((len = SIZE(thread_union)) != STACKSIZE())) {
                machdep->stacksize = len;
        } else if (!VALID_SIZE(thread_union) && !VALID_SIZE(task_union)) {
-               if (kernel_symbol_exists("__start_init_task") &&
-                   kernel_symbol_exists("__end_init_task")) {
+               len = 0;
+               if (kernel_symbol_exists("__start_init_stack") &&
+                  kernel_symbol_exists("__end_init_stack")) {
+                       len = symbol_value("__end_init_stack");
+                       len -= symbol_value("__start_init_stack");
+               } else if (kernel_symbol_exists("__start_init_task") &&
+                       kernel_symbol_exists("__end_init_task")) {
                        len = symbol_value("__end_init_task");
                        len -= symbol_value("__start_init_task");
+               }
+               if (len) {
                        ASSIGN_SIZE(thread_union) = len;
                        machdep->stacksize = len;
                }
-- 
2.45.2


++++++ 0003-x86_64-fix-for-adding-top_of_kernel_stack_padding-fo.patch ++++++
From: Lianbo Jiang <[email protected]>
Date: Fri, 7 Jun 2024 15:29:23 +0800
Subject: x86_64: fix for adding top_of_kernel_stack_padding for kernel stack
Git-repo: https://github.com/crash-utility/crash.git
Git-commit: 48764a14bc5856f0b0bb30685336c68b832154fc
Patch-mainline: 8.0.6
References: bsc#1228388

With Kernel commit 65c9cc9e2c14 ("x86/fred: Reserve space for the FRED
stack frame") in Linux 6.9-rc1 and later, x86_64 will add extra padding
('TOP_OF_KERNEL_STACK_PADDING (2 * 8)', see: arch/x86/include/asm\
/thread_info.h,) for kernel stack when the CONFIG_X86_FRED is enabled.

As a result, the pt_regs will be moved downwards due to the offset of
padding, and the values of registers read from pt_regs will be incorrect
as below.

Without the patch:
  crash> bt
  PID: 2040     TASK: ffff969136fc4180  CPU: 16   COMMAND: "bash"
   #0 [ffffa996409aba38] machine_kexec at ffffffff9f881eb7
   #1 [ffffa996409aba90] __crash_kexec at ffffffff9fa1e49e
   #2 [ffffa996409abb48] panic at ffffffff9f91a6cd
   #3 [ffffa996409abbc8] sysrq_handle_crash at ffffffffa0015076
   #4 [ffffa996409abbd0] __handle_sysrq at ffffffffa0015640
   #5 [ffffa996409abc00] write_sysrq_trigger at ffffffffa0015ce5
   #6 [ffffa996409abc28] proc_reg_write at ffffffff9fd35bf5
   #7 [ffffa996409abc40] vfs_write at ffffffff9fc8d462
   #8 [ffffa996409abcd0] ksys_write at ffffffff9fc8dadf
   #9 [ffffa996409abd08] do_syscall_64 at ffffffffa0517429
  #10 [ffffa996409abf40] entry_SYSCALL_64_after_hwframe at ffffffffa060012b
      [exception RIP: unknown or invalid address]
      RIP: 0000000000000246  RSP: 0000000000000000  RFLAGS: 0000002b
      RAX: 0000000000000002  RBX: 00007f9b9f5b13e0  RCX: 000055cee7486fb0
      RDX: 0000000000000001  RSI: 0000000000000001  RDI: 00007f9b9f4fda57
      RBP: 0000000000000246   R8: 00007f9b9f4fda57   R9: ffffffffffffffda
      R10: 0000000000000000  R11: 00007f9b9f5b14e0  R12: 0000000000000002
      R13: 000055cee7486fb0  R14: 0000000000000002  R15: 00007f9b9f5fb780
      ORIG_RAX: 0000000000000033  CS: 7ffe65327978  SS: 0000
  bt: WARNING: possibly bogus exception frame
  crash>

With the patch:

  crash> bt
  PID: 2040     TASK: ffff969136fc4180  CPU: 16   COMMAND: "bash"
   #0 [ffffa996409aba38] machine_kexec at ffffffff9f881eb7
   #1 [ffffa996409aba90] __crash_kexec at ffffffff9fa1e49e
   #2 [ffffa996409abb48] panic at ffffffff9f91a6cd
   #3 [ffffa996409abbc8] sysrq_handle_crash at ffffffffa0015076
   #4 [ffffa996409abbd0] __handle_sysrq at ffffffffa0015640
   #5 [ffffa996409abc00] write_sysrq_trigger at ffffffffa0015ce5
   #6 [ffffa996409abc28] proc_reg_write at ffffffff9fd35bf5
   #7 [ffffa996409abc40] vfs_write at ffffffff9fc8d462
   #8 [ffffa996409abcd0] ksys_write at ffffffff9fc8dadf
   #9 [ffffa996409abd08] do_syscall_64 at ffffffffa0517429
  #10 [ffffa996409abf40] entry_SYSCALL_64_after_hwframe at ffffffffa060012b
      RIP: 00007f9b9f4fda57  RSP: 00007ffe65327978  RFLAGS: 00000246
      RAX: ffffffffffffffda  RBX: 0000000000000002  RCX: 00007f9b9f4fda57
      RDX: 0000000000000002  RSI: 000055cee7486fb0  RDI: 0000000000000001
      RBP: 000055cee7486fb0   R8: 0000000000000000   R9: 00007f9b9f5b14e0
      R10: 00007f9b9f5b13e0  R11: 0000000000000246  R12: 0000000000000002
      R13: 00007f9b9f5fb780  R14: 0000000000000002  R15: 00007f9b9f5f69e0
      ORIG_RAX: 0000000000000001  CS: 0033  SS: 002b
  crash>

Link: 
https://www.mail-archive.com/[email protected]/msg00754.html
Signed-off-by: Lianbo Jiang <[email protected]>
Signed-off-by: Tao Liu <[email protected]>
Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
---
 defs.h    | 1 +
 kernel.c  | 1 +
 symbols.c | 1 +
 x86_64.c  | 6 ++++--
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/defs.h b/defs.h
index 01f316e67dde..42d875965256 100644
--- a/defs.h
+++ b/defs.h
@@ -2414,6 +2414,7 @@ struct size_table {         /* stash of commonly-used 
sizes */
        long maple_tree;
        long maple_node;
        long module_memory;
+       long fred_frame;
 };
 
 struct array_table {
diff --git a/kernel.c b/kernel.c
index 1728b70c1b5c..cd3d6044cc9a 100644
--- a/kernel.c
+++ b/kernel.c
@@ -668,6 +668,7 @@ kernel_init()
        STRUCT_SIZE_INIT(softirq_state, "softirq_state");
        STRUCT_SIZE_INIT(softirq_action, "softirq_action");
        STRUCT_SIZE_INIT(desc_struct, "desc_struct");
+       STRUCT_SIZE_INIT(fred_frame, "fred_frame");
 
        STRUCT_SIZE_INIT(char_device_struct, "char_device_struct");
        if (VALID_STRUCT(char_device_struct)) {
diff --git a/symbols.c b/symbols.c
index b7627a83587a..301ce3533da9 100644
--- a/symbols.c
+++ b/symbols.c
@@ -11847,6 +11847,7 @@ dump_offset_table(char *spec, ulong makestruct)
         fprintf(fp, "             task_struct_flags: %ld\n", 
SIZE(task_struct_flags));
         fprintf(fp, "            task_struct_policy: %ld\n", 
SIZE(task_struct_policy));
         fprintf(fp, "                   thread_info: %ld\n", 
SIZE(thread_info));
+        fprintf(fp, "                    fred_frame: %ld\n", SIZE(fred_frame));
         fprintf(fp, "                 softirq_state: %ld\n", 
                SIZE(softirq_state));
         fprintf(fp, "                softirq_action: %ld\n", 
diff --git a/x86_64.c b/x86_64.c
index 0c21eb827e4a..6777c93e6b47 100644
--- a/x86_64.c
+++ b/x86_64.c
@@ -4086,10 +4086,11 @@ in_exception_stack:
 
         if (!irq_eframe && !is_kernel_thread(bt->tc->task) &&
             (GET_STACKBASE(bt->tc->task) == bt->stackbase)) {
+               long stack_padding_size = SIZE(fred_frame) > 0 ? (2*8) : 0;
                user_mode_eframe = bt->stacktop - SIZE(pt_regs);
                if (last_process_stack_eframe < user_mode_eframe)
                        x86_64_exception_frame(EFRAME_PRINT, 0, bt->stackbuf +
-                               (bt->stacktop - bt->stackbase) - SIZE(pt_regs),
+                               (bt->stacktop - stack_padding_size - 
bt->stackbase) - SIZE(pt_regs),
                                bt, ofp);
        }
 
@@ -4407,10 +4408,11 @@ in_exception_stack:
 
         if (!irq_eframe && !is_kernel_thread(bt->tc->task) &&
             (GET_STACKBASE(bt->tc->task) == bt->stackbase)) {
+               long stack_padding_size = SIZE(fred_frame) > 0 ? (2*8) : 0;
                user_mode_eframe = bt->stacktop - SIZE(pt_regs);
                if (last_process_stack_eframe < user_mode_eframe)
                        x86_64_exception_frame(EFRAME_PRINT, 0, bt->stackbuf +
-                               (bt->stacktop - bt->stackbase) - SIZE(pt_regs),
+                               (bt->stacktop - stack_padding_size - 
bt->stackbase) - SIZE(pt_regs),
                                bt, ofp);
        }
 
-- 
2.45.2


++++++ 0004-Fix-kmem-v-option-on-Linux-6.9-and-later-kernels.patch ++++++
From: =?UTF-8?q?HAGIO=20KAZUHITO=28=E8=90=A9=E5=B0=BE=E3=80=80=E4=B8=80?=
 =?UTF-8?q?=E4=BB=81=29?= <[email protected]>
Date: Wed, 5 Jun 2024 07:30:03 +0000
Subject: Fix "kmem -v" option on Linux 6.9 and later kernels
Git-repo: https://github.com/crash-utility/crash.git
Git-commit: 7c2c90d0b06a0dad00819b7f22be204664a698ff
Patch-mainline: 8.0.6
References: bsc#1228388

The following kernel commits removed vmap_area_list and vmap_area_root
rb-tree, and introduced vmap_nodes.

  55c49fee57af mm/vmalloc: remove vmap_area_list
  d093602919ad mm: vmalloc: remove global vmap_area_root rb-tree

Without the patch, the "kmem -v" option and functions that use
dump_vmlist() fail with or without an error:

  crash> kmem -v
     VM_STRUCT                 ADDRESS RANGE               SIZE
  kmem: invalid kernel virtual address: ccccccccccccccd4  type: "vmlist addr"

  crash> kmem -v
  crash>

Signed-off-by: Kazuhito Hagio <[email protected]>
Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
---
 defs.h    |   4 ++
 memory.c  | 135 +++++++++++++++++++++++++++++++++++++++++++++---------
 symbols.c |   3 ++
 3 files changed, 120 insertions(+), 22 deletions(-)

diff --git a/defs.h b/defs.h
index 42d875965256..da856c08f11a 100644
--- a/defs.h
+++ b/defs.h
@@ -2240,6 +2240,8 @@ struct offset_table {                    /* stash of 
commonly-used offsets */
        long mnt_namespace_nr_mounts;
        long mount_mnt_node;
        long log_caller_id;
+       long vmap_node_busy;
+       long rb_list_head;
 };
 
 struct size_table {         /* stash of commonly-used sizes */
@@ -2415,6 +2417,7 @@ struct size_table {         /* stash of commonly-used 
sizes */
        long maple_node;
        long module_memory;
        long fred_frame;
+       long vmap_node;
 };
 
 struct array_table {
@@ -2679,6 +2682,7 @@ struct vm_table {                /* kernel VM-related 
data */
 #define SLAB_OVERLOAD_PAGE    (0x8000000)
 #define SLAB_CPU_CACHE       (0x10000000)
 #define SLAB_ROOT_CACHES     (0x20000000)
+#define USE_VMAP_NODES       (0x40000000)
 
 #define IS_FLATMEM()           (vt->flags & FLATMEM)
 #define IS_DISCONTIGMEM()      (vt->flags & DISCONTIGMEM)
diff --git a/memory.c b/memory.c
index 34ed646b5d1e..acb8507cfb75 100644
--- a/memory.c
+++ b/memory.c
@@ -235,6 +235,7 @@ static void dump_slab_objects(struct meminfo *);
 static void dump_slab_objects_percpu(struct meminfo *);
 static void dump_vmlist(struct meminfo *);
 static void dump_vmap_area(struct meminfo *);
+static int get_vmap_area_list_from_nodes(ulong **);
 static int dump_page_lists(struct meminfo *);
 static void dump_kmeminfo(void);
 static int page_to_phys(ulong, physaddr_t *); 
@@ -433,9 +434,15 @@ vm_init(void)
        if (VALID_MEMBER(vmap_area_va_start) &&
            VALID_MEMBER(vmap_area_va_end) &&
            VALID_MEMBER(vmap_area_list) &&
-           VALID_MEMBER(vmap_area_vm) &&
-           kernel_symbol_exists("vmap_area_list"))
-               vt->flags |= USE_VMAP_AREA;
+           VALID_MEMBER(vmap_area_vm)) {
+               if (kernel_symbol_exists("vmap_nodes")) {
+                       STRUCT_SIZE_INIT(vmap_node, "vmap_node");
+                       MEMBER_OFFSET_INIT(vmap_node_busy, "vmap_node", "busy");
+                       MEMBER_OFFSET_INIT(rb_list_head, "rb_list", "head");
+                       vt->flags |= USE_VMAP_NODES;
+               } else if (kernel_symbol_exists("vmap_area_list"))
+                       vt->flags |= USE_VMAP_AREA;
+       }
 
        if (kernel_symbol_exists("hstates")) {
                STRUCT_SIZE_INIT(hstate, "hstate");
@@ -8957,7 +8964,7 @@ dump_vmlist(struct meminfo *vi)
        physaddr_t paddr;
        int mod_vmlist;
 
-       if (vt->flags & USE_VMAP_AREA) {
+       if (vt->flags & (USE_VMAP_AREA|USE_VMAP_NODES)) {
                dump_vmap_area(vi);
                return;
        }
@@ -9067,6 +9074,77 @@ next_entry:
                vi->retval = verified;
 }
 
+static int
+sort_by_va_start(const void *arg1, const void *arg2)
+{
+       ulong va_start1, va_start2;
+
+       readmem(*(ulong *)arg1 + OFFSET(vmap_area_va_start), KVADDR, &va_start1,
+               sizeof(void *), "vmap_area.va_start", FAULT_ON_ERROR);
+       readmem(*(ulong *)arg2 + OFFSET(vmap_area_va_start), KVADDR, &va_start2,
+               sizeof(void *), "vmap_area.va_start", FAULT_ON_ERROR);
+
+       return va_start1 < va_start2 ? -1 : (va_start1 == va_start2 ? 0 : 1);
+}
+
+/* Linux 6.9 and later kernels use "vmap_nodes". */
+static int
+get_vmap_area_list_from_nodes(ulong **list_ptr)
+{
+       int i, cnt, c;
+       struct list_data list_data, *ld = &list_data;
+       uint nr_vmap_nodes;
+       ulong vmap_nodes, list_head;
+       ulong *list, *ptr;
+
+       get_symbol_data("nr_vmap_nodes", sizeof(uint), &nr_vmap_nodes);
+       get_symbol_data("vmap_nodes", sizeof(ulong), &vmap_nodes);
+
+       /* count up all vmap_areas. */
+       cnt = 0;
+       for (i = 0; i < nr_vmap_nodes; i++) {
+               BZERO(ld, sizeof(struct list_data));
+               list_head = vmap_nodes + SIZE(vmap_node) * i +
+                               OFFSET(vmap_node_busy) + OFFSET(rb_list_head);
+               readmem(list_head, KVADDR, &ld->start, sizeof(void *),
+                               "rb_list.head", FAULT_ON_ERROR);
+               ld->list_head_offset = OFFSET(vmap_area_list);
+               ld->end = list_head;
+               c = do_list(ld);
+               if (c < 0)
+                       return -1;
+
+               cnt += c;
+       }
+
+       list = ptr = (ulong *)GETBUF(sizeof(void *) * cnt);
+
+       /* gather all vmap_areas into a list. */
+       for (i = 0; i < nr_vmap_nodes; i++) {
+               BZERO(ld, sizeof(struct list_data));
+               ld->flags = LIST_ALLOCATE;
+               list_head = vmap_nodes + SIZE(vmap_node) * i +
+                               OFFSET(vmap_node_busy) + OFFSET(rb_list_head);
+               readmem(list_head, KVADDR, &ld->start, sizeof(void *),
+                               "rb_list.head", FAULT_ON_ERROR);
+               ld->list_head_offset = OFFSET(vmap_area_list);
+               ld->end = list_head;
+               c = do_list(ld);
+               if (c < 0)
+                       return -1;
+
+               memcpy(ptr, ld->list_ptr, sizeof(void *) * c);
+               ptr += c;
+
+               FREEBUF(ld->list_ptr);
+       }
+
+       qsort(list, cnt, sizeof(void *), sort_by_va_start);
+
+       *list_ptr = list;
+       return cnt;
+}
+
 static void
 dump_vmap_area(struct meminfo *vi)
 {
@@ -9080,26 +9158,37 @@ dump_vmap_area(struct meminfo *vi)
        char buf2[BUFSIZE];
        char buf3[BUFSIZE];
        char buf4[BUFSIZE];
+       ulong *list_ptr;
 
 #define VM_VM_AREA 0x4   /* mm/vmalloc.c */
 
-       vmap_area_buf = GETBUF(SIZE(vmap_area));
        start = count = verified = size = 0;
 
-       ld = &list_data;
-       BZERO(ld, sizeof(struct list_data));
-       ld->flags = LIST_HEAD_FORMAT|LIST_HEAD_POINTER|LIST_ALLOCATE;
-       get_symbol_data("vmap_area_list", sizeof(void *), &ld->start);
-       ld->list_head_offset = OFFSET(vmap_area_list);
-       ld->end = symbol_value("vmap_area_list");
-       cnt = do_list(ld);
-       if (cnt < 0) {
-               FREEBUF(vmap_area_buf);
-               error(WARNING, "invalid/corrupt vmap_area_list\n"); 
-               vi->retval = 0;
-               return;
+       if (vt->flags & USE_VMAP_NODES) {
+               cnt = get_vmap_area_list_from_nodes(&list_ptr);
+               if (cnt < 0) {
+                       error(WARNING, "invalid/corrupt vmap_nodes.busy 
list\n");
+                       vi->retval = 0;
+                       return;
+               }
+       } else {
+               ld = &list_data;
+               BZERO(ld, sizeof(struct list_data));
+               ld->flags = LIST_HEAD_FORMAT|LIST_HEAD_POINTER|LIST_ALLOCATE;
+               get_symbol_data("vmap_area_list", sizeof(void *), &ld->start);
+               ld->list_head_offset = OFFSET(vmap_area_list);
+               ld->end = symbol_value("vmap_area_list");
+               cnt = do_list(ld);
+               if (cnt < 0) {
+                       error(WARNING, "invalid/corrupt vmap_area_list\n");
+                       vi->retval = 0;
+                       return;
+               }
+               list_ptr = ld->list_ptr;
        }
 
+       vmap_area_buf = GETBUF(SIZE(vmap_area));
+
        for (i = 0; i < cnt; i++) {
                if (!(pc->curcmd_flags & HEADER_PRINTED) && (i == 0) && 
                    !(vi->flags & (GET_HIGHEST|GET_PHYS_TO_VMALLOC|
@@ -9116,7 +9205,7 @@ dump_vmap_area(struct meminfo *vi)
                        pc->curcmd_flags |= HEADER_PRINTED;
                }
 
-               readmem(ld->list_ptr[i], KVADDR, vmap_area_buf,
+               readmem(list_ptr[i], KVADDR, vmap_area_buf,
                         SIZE(vmap_area), "vmap_area struct", FAULT_ON_ERROR); 
 
                if (VALID_MEMBER(vmap_area_flags) &&
@@ -9158,7 +9247,7 @@ dump_vmap_area(struct meminfo *vi)
                        }       
                        fprintf(fp, "%s%s  %s%s  %s - %s  %7ld\n",
                                mkstring(buf1,VADDR_PRLEN, 
LONG_HEX|CENTER|LJUST,
-                               MKSTR(ld->list_ptr[i])), space(MINSPACE-1),
+                               MKSTR(list_ptr[i])), space(MINSPACE-1),
                                mkstring(buf2,VADDR_PRLEN, 
LONG_HEX|CENTER|LJUST,
                                MKSTR(vm_struct)), space(MINSPACE-1),
                                mkstring(buf3, VADDR_PRLEN, LONG_HEX|RJUST,
@@ -9179,14 +9268,14 @@ dump_vmap_area(struct meminfo *vi)
                                        if (vi->flags & GET_PHYS_TO_VMALLOC) {
                                                vi->retval = pcheck +
                                                    PAGEOFFSET(vi->spec_addr);
-                                               FREEBUF(ld->list_ptr);
+                                               FREEBUF(list_ptr);
                                                return;
                                        } else
                                                fprintf(fp,
                                                "%s%s  %s%s  %s - %s  %7ld\n",
                                                mkstring(buf1,VADDR_PRLEN, 
                                                LONG_HEX|CENTER|LJUST,
-                                               MKSTR(ld->list_ptr[i])), 
+                                               MKSTR(list_ptr[i])),
                                                space(MINSPACE-1),
                                                mkstring(buf2, VADDR_PRLEN,
                                                LONG_HEX|CENTER|LJUST,
@@ -9204,7 +9293,7 @@ dump_vmap_area(struct meminfo *vi)
        }
 
        FREEBUF(vmap_area_buf);
-       FREEBUF(ld->list_ptr);
+       FREEBUF(list_ptr);
 
        if (vi->flags & GET_HIGHEST)
                vi->retval = start+size;
@@ -14001,6 +14090,8 @@ dump_vm_table(int verbose)
                fprintf(fp, "%sSLAB_ROOT_CACHES", others++ ? "|" : "");\
        if (vt->flags & USE_VMAP_AREA)
                fprintf(fp, "%sUSE_VMAP_AREA", others++ ? "|" : "");\
+       if (vt->flags & USE_VMAP_NODES)
+               fprintf(fp, "%sUSE_VMAP_NODES", others++ ? "|" : "");\
        if (vt->flags & CONFIG_NUMA)
                fprintf(fp, "%sCONFIG_NUMA", others++ ? "|" : "");\
        if (vt->flags & VM_EVENT)
diff --git a/symbols.c b/symbols.c
index 301ce3533da9..107920f0eb32 100644
--- a/symbols.c
+++ b/symbols.c
@@ -10167,6 +10167,8 @@ dump_offset_table(char *spec, ulong makestruct)
        fprintf(fp, "               vmap_area_flags: %ld\n", 
                OFFSET(vmap_area_flags));
        fprintf(fp, "          vmap_area_purge_list: %ld\n", 
OFFSET(vmap_area_purge_list));
+       fprintf(fp, "                vmap_node_busy: %ld\n", 
OFFSET(vmap_node_busy));
+       fprintf(fp, "                  rb_list_head: %ld\n", 
OFFSET(rb_list_head));
 
        fprintf(fp, "         module_size_of_struct: %ld\n", 
                OFFSET(module_size_of_struct));
@@ -12041,6 +12043,7 @@ dump_offset_table(char *spec, ulong makestruct)
                SIZE(task_group));
        fprintf(fp, "                     vmap_area: %ld\n",
                SIZE(vmap_area));
+       fprintf(fp, "                     vmap_node: %ld\n", SIZE(vmap_node));
        fprintf(fp, "            hrtimer_clock_base: %ld\n",
                SIZE(hrtimer_clock_base));
        fprintf(fp, "                  hrtimer_base: %ld\n",
-- 
2.45.2


++++++ 0005-X86-64-fix-for-crash-session-loading-failure.patch ++++++
From: Lianbo Jiang <[email protected]>
Date: Wed, 5 Jun 2024 16:28:58 +0800
Subject: X86 64: fix for crash session loading failure
Git-repo: https://github.com/crash-utility/crash.git
Git-commit: 6752571d8d782d07537a258a1ec8919ebd1308ad
Patch-mainline: 8.0.6
References: bsc#1228388

Kernel commit 223b5e57d0d5 ("mm/execmem, arch: convert remaining
overrides of module_alloc to execmem") makes crash session loading
failure as below:

  # ./crash -s
  crash: seek error: kernel virtual address: ffffffff826bb418  type: 
"page_offset_base"

For X86 64 architecture, currently crash will search for symbol
"module_load_offset" to determine if the KASLR is enabled, and go
into the relevant code block. But the symbols "module_load_offset"
has been removed since Linux v6.10-rc1, which caused the current
failure.

And this issue can occur with live debugging and core dump file
debugging.

Let's check the symbol "kaslr_regions" instead of "module_load_offset"
to fix it.

Signed-off-by: Lianbo Jiang <[email protected]>
Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
---
 symbols.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/symbols.c b/symbols.c
index 107920f0eb32..f3c94b0a8588 100644
--- a/symbols.c
+++ b/symbols.c
@@ -619,9 +619,9 @@ strip_symbol_end(const char *name, char *buf)
  *  or in /proc/kallsyms on a live system.
  *
  *  Setting KASLR_CHECK will trigger a search for "module_load_offset"
- *  during the initial symbol sort operation, and if found, will
- *  set (RELOC_AUTO|KASLR).  On live systems, the search is done
- *  here by checking /proc/kallsyms.
+ *  or "kaslr_regions" during the initial symbol sort operation, and
+ *  if found, will set (RELOC_AUTO|KASLR).  On live systems, the search
+ *  is done here by checking /proc/kallsyms.
  */
 static void
 kaslr_init(void)
@@ -646,7 +646,8 @@ kaslr_init(void)
                st->_stext_vmlinux = UNINITIALIZED;
 
        if (ACTIVE() &&   /* Linux 3.15 */
-           (symbol_value_from_proc_kallsyms("module_load_offset") != BADVAL)) {
+           ((symbol_value_from_proc_kallsyms("kaslr_regions") != BADVAL) ||
+           (symbol_value_from_proc_kallsyms("module_load_offset") != BADVAL))) 
{
                kt->flags2 |= (RELOC_AUTO|KASLR);
                st->_stext_vmlinux = UNINITIALIZED;
        }
@@ -14251,7 +14252,9 @@ numeric_forward(const void *P_x, const void *P_y)
                        st->_stext_vmlinux = valueof(y);
        }
        if (kt->flags2 & KASLR_CHECK) {
-               if (STREQ(x->name, "module_load_offset") || 
+               if (STREQ(x->name, "kaslr_regions") ||
+                   STREQ(y->name, "kaslr_regions") ||
+                   STREQ(x->name, "module_load_offset") ||
                    STREQ(y->name, "module_load_offset")) {
                        kt->flags2 &= ~KASLR_CHECK;
                        kt->flags2 |= (RELOC_AUTO|KASLR);
-- 
2.45.2


++++++ 0006-Fix-for-failing-to-load-kernel-module.patch ++++++
From: Lianbo Jiang <[email protected]>
Date: Wed, 5 Jun 2024 17:30:33 +0800
Subject: Fix for failing to load kernel module
Git-repo: https://github.com/crash-utility/crash.git
Git-commit: a20eb05de3c1cab954d49eb8bb9dc7fe5224caa0
Patch-mainline: 8.0.6
References: bsc#1228388

In some kernel modules such as libie.ko, the mem[MOD_TEXT].size
may be zero, currently crash will only check its value to determine
if the module is valid, otherwise it fails to load kernel module with
the following warning and error:

  WARNING: invalid kernel module size: 0
        KERNEL: /lib/modules/6.10.0-rc1+/build/vmlinux
      DUMPFILE: /proc/kcore
          CPUS: 64
          DATE: Wed Jun  5 12:49:02 IDT 2024
        UPTIME: 5 days, 05:57:21
  LOAD AVERAGE: 0.28, 0.06, 0.02
         TASKS: 806
      NODENAME: xxxx
       RELEASE: 6.10.0-rc1+
       VERSION: #1 SMP PREEMPT_DYNAMIC Fri May 31 04:56:59 IDT 2024
       MACHINE: x86_64  (2100 Mhz)
        MEMORY: 1.6 GB
           PID: 203686
       COMMAND: "crash"
          TASK: ffff9f9bf66d0000  [THREAD_INFO: ffff9f9bf66d0000]
           CPU: 52
         STATE: TASK_RUNNING (ACTIVE)

  crash> mod
  mod: cannot access vmalloc'd module memory
  crash>

Lets count the module size to check if the module is valid, that will
avoid the current failure.

Signed-off-by: Lianbo Jiang <[email protected]>
Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
---
 kernel.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/kernel.c b/kernel.c
index cd3d6044cc9a..8a9d498760bc 100644
--- a/kernel.c
+++ b/kernel.c
@@ -3822,9 +3822,21 @@ module_init(void)
                case KALLSYMS_V2:
                        if (THIS_KERNEL_VERSION >= LINUX(2,6,27)) {
                                numksyms = UINT(modbuf + 
OFFSET(module_num_symtab));
-                               if (MODULE_MEMORY())
-                                       /* check mem[MOD_TEXT].size only */
-                                       size = UINT(modbuf + OFFSET(module_mem) 
+ OFFSET(module_memory_size));
+                               if (MODULE_MEMORY()) {
+                                       /*
+                                        * The mem[MOD_TEXT].size may be zero, 
lets count
+                                        * the module size as below.
+                                       */
+                                       int t;
+                                       size = 0;
+                                       for_each_mod_mem_type(t) {
+                                               if (t == MOD_INIT_TEXT)
+                                                       break;
+                                               size += UINT(modbuf + 
OFFSET(module_mem) +
+                                                               
SIZE(module_memory) * t +
+                                                               
OFFSET(module_memory_size));
+                                       }
+                               }
                                else
                                        size = UINT(modbuf + 
MODULE_OFFSET2(module_core_size, rx));
                        } else {
@@ -3927,7 +3939,7 @@ verify_modules(void)
 
                 for (i = 0, found = FALSE; i < kt->mods_installed; i++) {
                         lm = &st->load_modules[i];
-                       if (!kvtop(NULL, lm->mod_base, &paddr, 0)) {
+                       if (lm->mod_base && !kvtop(NULL, lm->mod_base, &paddr, 
0)) {
                                irregularities++;
                                 break;
                        }
-- 
2.45.2


++++++ 0007-X86-64-fix-a-regression-issue-about-kernel-stack-pad.patch ++++++
From: Lianbo Jiang <[email protected]>
Date: Wed, 12 Jun 2024 11:00:00 +0800
Subject: X86 64: fix a regression issue about kernel stack padding
Git-repo: https://github.com/crash-utility/crash.git
Git-commit: 196c4b79c13d1c0e6d7b21c8321eca07d3838d6a
Patch-mainline: 8.0.6
References: bsc#1228388

The commit 48764a14bc58 may cause a regression issue when the CONFIG_X86_FRED
is not enabled, this is because the SIZE(fred_frame) will call the
SIZE_verify() to determine if the fred_frame is valid, otherwise it will
emit an error:

  crash> bt 1

  bt: invalid structure size: fred_frame
        FILE: x86_64.c  LINE: 4089  FUNCTION: x86_64_low_budget_back_trace_cmd()

  [/home/k-hagio/bin/crash] error trace: 588df3 => 5cbc72 => 5eb3e1 => 5eb366
  PID: 1        TASK: ffff9f94c024b980  CPU: 2    COMMAND: "systemd"
     #0 [ffffade44001bca8] __schedule at ffffffffb948ebbb
     #1 [ffffade44001bd10] schedule at ffffffffb948f04d
     #2 [ffffade44001bd20] schedule_hrtimeout_range_clock at ffffffffb9494fef
     #3 [ffffade44001bda8] ep_poll at ffffffffb8c91be8
     #4 [ffffade44001be48] do_epoll_wait at ffffffffb8c91d11
     #5 [ffffade44001be80] __x64_sys_epoll_wait at ffffffffb8c92590
     #6 [ffffade44001bed0] do_syscall_64 at ffffffffb947f459
     #7 [ffffade44001bf50] entry_SYSCALL_64_after_hwframe at ffffffffb96000ea

      5eb366: SIZE_verify.part.42+70
      5eb3e1: SIZE_verify+49
      5cbc72: x86_64_low_budget_back_trace_cmd+3010
      588df3: back_trace+1523

  bt: invalid structure size: fred_frame
        FILE: x86_64.c  LINE: 4089  FUNCTION: x86_64_low_budget_back_trace_cmd()

Let's replace the SIZE(fred_frame) with the VALID_SIZE(fred_frame) to
fix it.

Fixes: 48764a14bc58 ("x86_64: fix for adding top_of_kernel_stack_padding for 
kernel stack")
Reported-by: Kazuhito Hagio <[email protected]>
Signed-off-by: Lianbo Jiang <[email protected]>
Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
---
 x86_64.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/x86_64.c b/x86_64.c
index 6777c93e6b47..469d26b05e24 100644
--- a/x86_64.c
+++ b/x86_64.c
@@ -4086,7 +4086,7 @@ in_exception_stack:
 
         if (!irq_eframe && !is_kernel_thread(bt->tc->task) &&
             (GET_STACKBASE(bt->tc->task) == bt->stackbase)) {
-               long stack_padding_size = SIZE(fred_frame) > 0 ? (2*8) : 0;
+               long stack_padding_size = VALID_SIZE(fred_frame) ? (2*8) : 0;
                user_mode_eframe = bt->stacktop - SIZE(pt_regs);
                if (last_process_stack_eframe < user_mode_eframe)
                        x86_64_exception_frame(EFRAME_PRINT, 0, bt->stackbuf +
@@ -4408,7 +4408,7 @@ in_exception_stack:
 
         if (!irq_eframe && !is_kernel_thread(bt->tc->task) &&
             (GET_STACKBASE(bt->tc->task) == bt->stackbase)) {
-               long stack_padding_size = SIZE(fred_frame) > 0 ? (2*8) : 0;
+               long stack_padding_size = VALID_SIZE(fred_frame) ? (2*8) : 0;
                user_mode_eframe = bt->stacktop - SIZE(pt_regs);
                if (last_process_stack_eframe < user_mode_eframe)
                        x86_64_exception_frame(EFRAME_PRINT, 0, bt->stackbuf +
-- 
2.45.2


++++++ 0008-Fix-kmem-i-and-swap-commands-on-Linux-6.10-rc1-and-l.patch ++++++
From: =?UTF-8?q?HAGIO=20KAZUHITO=28=E8=90=A9=E5=B0=BE=E3=80=80=E4=B8=80?=
 =?UTF-8?q?=E4=BB=81=29?= <[email protected]>
Date: Tue, 11 Jun 2024 02:40:55 +0000
Subject: Fix "kmem -i" and "swap" commands on Linux 6.10-rc1 and later kernels
Git-repo: https://github.com/crash-utility/crash.git
Git-commit: 3452fe802bf94d15879b3c5fd17c793a2b67a231
Patch-mainline: 8.0.6
References: bsc#1228388

Kernel commit 798cb7f9aec3 ("swapon(2)/swapoff(2): don't bother with
block size") removed swap_info_struct.old_block_size member at Linux
6.10-rc1.  The crash-utility has used this to determine whether a swap
is a partition or file and to determine the way to get the swap path.

Withtout the patch, the "kmem -i" and "swap" commands fail with the
following error messsage:

  crash> kmem -i
  ...
     TOTAL HUGE  13179392      50.3 GB         ----
      HUGE FREE  13179392      50.3 GB  100% of TOTAL HUGE

  swap: invalid (optional) structure member offsets: 
swap_info_struct_swap_device or swap_info_struct_old_block_size
        FILE: memory.c  LINE: 16032  FUNCTION: dump_swap_info()

The swap_file member of recent swap_info_struct is a pointer to a
struct file (once upon a time it was dentry), use this fact directly.

Tested-by: Li Zhijian <[email protected]>
Signed-off-by: Kazuhito Hagio <[email protected]>
Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
---
 defs.h    |  1 +
 filesys.c |  1 +
 memory.c  | 28 +++++++++++++++++++++++-----
 symbols.c |  1 +
 4 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/defs.h b/defs.h
index da856c08f11a..49e6923ede54 100644
--- a/defs.h
+++ b/defs.h
@@ -2242,6 +2242,7 @@ struct offset_table {                    /* stash of 
commonly-used offsets */
        long log_caller_id;
        long vmap_node_busy;
        long rb_list_head;
+       long file_f_inode;
 };
 
 struct size_table {         /* stash of commonly-used sizes */
diff --git a/filesys.c b/filesys.c
index 81fe856699e1..406ebb299780 100644
--- a/filesys.c
+++ b/filesys.c
@@ -2038,6 +2038,7 @@ vfs_init(void)
        MEMBER_OFFSET_INIT(file_f_dentry, "file", "f_dentry");
        MEMBER_OFFSET_INIT(file_f_vfsmnt, "file", "f_vfsmnt");
        MEMBER_OFFSET_INIT(file_f_count, "file", "f_count");
+       MEMBER_OFFSET_INIT(file_f_inode, "file", "f_inode");
        MEMBER_OFFSET_INIT(path_mnt, "path", "mnt");
        MEMBER_OFFSET_INIT(path_dentry, "path", "dentry");
        if (INVALID_MEMBER(file_f_dentry)) {
diff --git a/memory.c b/memory.c
index acb8507cfb75..a74ebafe0ab5 100644
--- a/memory.c
+++ b/memory.c
@@ -16075,6 +16075,8 @@ dump_swap_info(ulong swapflags, ulong *totalswap_pages, 
ulong *totalused_pages)
        char buf3[BUFSIZE];
        char buf4[BUFSIZE];
        char buf5[BUFSIZE];
+       int swap_file_is_file =
+               STREQ(MEMBER_TYPE_NAME("swap_info_struct", "swap_file"), 
"file");
 
        if (!symbol_exists("nr_swapfiles"))
                error(FATAL, "nr_swapfiles doesn't exist in this kernel!\n");
@@ -16118,9 +16120,21 @@ dump_swap_info(ulong swapflags, ulong 
*totalswap_pages, ulong *totalused_pages)
                swap_file = ULONG(vt->swap_info_struct + 
                        OFFSET(swap_info_struct_swap_file));
 
-                swap_device = INT(vt->swap_info_struct +
-                        OFFSET_OPTION(swap_info_struct_swap_device, 
-                       swap_info_struct_old_block_size));
+               /* Linux 6.10 and later */
+               if (INVALID_MEMBER(swap_info_struct_swap_device) &&
+                   INVALID_MEMBER(swap_info_struct_old_block_size) &&
+                   swap_file_is_file) {
+                       ulong inode;
+                       ushort mode;
+                       readmem(swap_file + OFFSET(file_f_inode), KVADDR, 
&inode,
+                               sizeof(ulong), "swap_file.f_inode", 
FAULT_ON_ERROR);
+                       readmem(inode + OFFSET(inode_i_mode), KVADDR, &mode,
+                               sizeof(ushort), "inode.i_mode", FAULT_ON_ERROR);
+                       swap_device = S_ISBLK(mode);
+               } else
+                       swap_device = INT(vt->swap_info_struct +
+                               OFFSET_OPTION(swap_info_struct_swap_device,
+                               swap_info_struct_old_block_size));
 
                 pages = INT(vt->swap_info_struct +
                         OFFSET(swap_info_struct_pages));
@@ -16161,8 +16175,12 @@ dump_swap_info(ulong swapflags, ulong 
*totalswap_pages, ulong *totalused_pages)
                                        OFFSET(swap_info_struct_swap_vfsmnt));
                                get_pathname(swap_file, buf, BUFSIZE, 
                                        1, vfsmnt);
-                       } else if (VALID_MEMBER
-                               (swap_info_struct_old_block_size)) {
+                       } else if 
(VALID_MEMBER(swap_info_struct_old_block_size) ||
+                                   swap_file_is_file) {
+                               /*
+                                * Linux 6.10 and later kernels do not have 
old_block_size,
+                                * but this still should work, if swap_file is 
file.
+                                */
                                devname = 
vfsmount_devname(file_to_vfsmnt(swap_file), 
                                        buf1, BUFSIZE);
                                get_pathname(file_to_dentry(swap_file), 
diff --git a/symbols.c b/symbols.c
index f3c94b0a8588..69a1fbb2f071 100644
--- a/symbols.c
+++ b/symbols.c
@@ -10522,6 +10522,7 @@ dump_offset_table(char *spec, ulong makestruct)
                OFFSET(file_f_count));
         fprintf(fp, "                   file_f_path: %ld\n", 
                OFFSET(file_f_path));
+        fprintf(fp, "                  file_f_inode: %ld\n", 
OFFSET(file_f_inode));
         fprintf(fp, "                      path_mnt: %ld\n", 
                OFFSET(path_mnt));
         fprintf(fp, "                   path_dentry: %ld\n", 
-- 
2.45.2


++++++ 0009-List-enable-LIST_HEAD_FORMAT-for-r-option.patch ++++++
From: Li Zhijian <[email protected]>
Date: Tue, 2 Jul 2024 14:31:30 +0800
Subject: List: enable LIST_HEAD_FORMAT for -r option
Git-repo: https://github.com/crash-utility/crash.git
Git-commit: ce4ddc742fbdde2fc966e79a19d6aa962e79448a
Patch-mainline: 8.0.6
References: bsc#1228388

Currently, the LIST_HEAD_FORMAT is not set, 'list -r' will list the
traversal results in order, not in the reverse order. This is not
the expected behavior.

Let's enable the LIST_HEAD_FORMAT for -r option by default.

Signed-off-by: Li Zhijian <[email protected]>
Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
---
 tools.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools.c b/tools.c
index 0f2db108838a..1022d579071a 100644
--- a/tools.c
+++ b/tools.c
@@ -3370,6 +3370,7 @@ cmd_list(void)
                        break;
 
                case 'r':
+                       ld->flags |= LIST_HEAD_FORMAT;
                        ld->flags |= LIST_HEAD_REVERSE;
                        break;
 
-- 
2.45.2


++++++ 0010-arm64-fix-a-potential-segfault-when-unwind-frame.patch ++++++
From: "qiwu.chen" <[email protected]>
Date: Wed, 24 Jul 2024 01:36:09 +0000
Subject: arm64: fix a potential segfault when unwind frame
Git-repo: https://github.com/crash-utility/crash.git
Git-commit: af895b219876b293d551e6dec825aba3905c0588
Patch-mainline: 8.0.6
References: bsc#1228388

The range of frame->fp is checked insufficiently, which may lead to a wrong
next fp. As a result, bt->stackbuf will be accessed out of range, and segfault.

  crash> bt
  [Detaching after fork from child process 11409]
  PID: 7661     TASK: ffffff81858aa500  CPU: 4    COMMAND: "sh"
   #0 [ffffffc008003f50] local_cpu_stop at ffffffdd7669444c

  Thread 1 "crash" received signal SIGSEGV, Segmentation fault.
  0x00005555558266cc in arm64_unwind_frame (bt=0x7fffffffd8f0, 
frame=0x7fffffffd080) at
  arm64.c:2821
  2821            frame->fp = GET_STACK_ULONG(fp);
  (gdb) bt
  arm64.c:2821
  out>) at main.c:1338
  gdb_interface.c:81
  (gdb) p /x *(struct bt_info*) 0x7fffffffd8f0
  $3 = {task = 0xffffff81858aa500, flags = 0x0, instptr = 0xffffffdd76694450, 
stkptr =
  0xffffffc008003f40, bptr = 0x0, stackbase = 0xffffffc027288000,
    stacktop = 0xffffffc02728c000, stackbuf = 0x555556115a40, tc = 
0x55559d16fdc0, hp = 0x0,
  textlist = 0x0, ref = 0x0, frameptr = 0xffffffc008003f50,
    call_target = 0x0, machdep = 0x0, debug = 0x0, eframe_ip = 0x0, radix = 
0x0, cpumask =
  0x0}
  (gdb) p /x *(struct arm64_stackframe*) 0x7fffffffd080
  $4 = {fp = 0xffffffc008003f50, sp = 0xffffffc008003f60, pc = 
0xffffffdd76694450}
  crash> bt -S 0xffffffc008003f50
  PID: 7661     TASK: ffffff81858aa500  CPU: 4    COMMAND: "sh"
  bt: non-process stack address for this task: ffffffc008003f50
      (valid range: ffffffc027288000 - ffffffc02728c000)

Check frame->fp value sufficiently before access it. Only frame->fp within
the range of bt->stackbase and bt->stacktop will be regarded as valid.

Signed-off-by: qiwu.chen <[email protected]>
Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
---
 arm64.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arm64.c b/arm64.c
index b3040d757946..624dba2368d7 100644
--- a/arm64.c
+++ b/arm64.c
@@ -2814,7 +2814,7 @@ arm64_unwind_frame(struct bt_info *bt, struct 
arm64_stackframe *frame)
        low  = frame->sp;
        high = (low + stack_mask) & ~(stack_mask);
 
-       if (fp < low || fp > high || fp & 0xf)
+       if (fp < low || fp > high || fp & 0xf || !INSTACK(fp, bt))
                return FALSE;
 
        frame->sp = fp + 0x10;
@@ -3024,7 +3024,7 @@ arm64_unwind_frame_v2(struct bt_info *bt, struct 
arm64_stackframe *frame,
        low  = frame->sp;
        high = (low + stack_mask) & ~(stack_mask);
 
-       if (fp < low || fp > high || fp & 0xf)
+       if (fp < low || fp > high || fp & 0xf || !INSTACK(fp, bt))
                return FALSE;
 
        if (CRASHDEBUG(1))
-- 
2.45.2


++++++ 0011-arm64-Fix-bt-command-show-wrong-stacktrace-on-ramdum.patch ++++++
From: bevis_chen <[email protected]>
Date: Thu, 25 Jul 2024 09:38:59 +0800
Subject: arm64: Fix bt command show wrong stacktrace on ramdump source
Git-repo: https://github.com/crash-utility/crash.git
Git-commit: 1c6da3eaff820708d4286324051d153a01766b02
Patch-mainline: 8.0.6
References: bsc#1228388

For ramdump(Qcom phone device) case with the kernel option
CONFIG_ARM64_PTR_AUTH_KERNEL enabled, the bt command may print
incorrect stacktrace as below:

  crash> bt 16930
  PID: 16930    TASK: ffffff89b3eada00  CPU: 2    COMMAND: "Firebase Backgr"
   #0 [ffffffc034c437f0] __switch_to at ffffffe0036832d4
   #1 [ffffffc034c43850] __kvm_nvhe_$d.2314 at 6be732e004cf05a0
   #2 [ffffffc034c438b0] __kvm_nvhe_$d.2314 at 86c54c6004ceff80
   #3 [ffffffc034c43950] __kvm_nvhe_$d.2314 at 55d6f96003a7b120
  ...
       PC: 00000073f5294840   LR: 00000070d8f39ba4   SP: 00000070d4afd5d0
      X29: 00000070d4afd600  X28: b4000071efcda7f0  X27: 00000070d4afe000
      X26: 0000000000000000  X25: 00000070d9616000  X24: 0000000000000000
      X23: 0000000000000000  X22: 0000000000000000  X21: 0000000000000000
      X20: b40000728fd27520  X19: b40000728fd27550  X18: 000000702daba000
      X17: 00000073f5294820  X16: 00000070d940f9d8  X15: 00000000000000bf
      X14: 0000000000000000  X13: 00000070d8ad2fac  X12: b40000718fce5040
      X11: 0000000000000000  X10: 0000000000000070   X9: 0000000000000001
       X8: 0000000000000062   X7: 0000000000000020   X6: 0000000000000000
       X5: 0000000000000000   X4: 0000000000000000   X3: 0000000000000000
       X2: 0000000000000002   X1: 0000000000000080   X0: b40000728fd27550
      ORIG_X0: b40000728fd27550  SYSCALLNO: ffffffff  PSTATE: 40001000

Crash tool can not get the KERNELPACMASK value from the vmcoreinfo, need
to calculate its value based on the vabits.

With the patch:

  crash> bt 16930
  PID: 16930    TASK: ffffff89b3eada00  CPU: 2    COMMAND: "Firebase Backgr"
   #0 [ffffffc034c437f0] __switch_to at ffffffe0036832d4
   #1 [ffffffc034c43850] __schedule at ffffffe004cf05a0
   #2 [ffffffc034c438b0] preempt_schedule_common at ffffffe004ceff80
   #3 [ffffffc034c43950] unmap_page_range at ffffffe003a7b120
   #4 [ffffffc034c439f0] unmap_vmas at ffffffe003a80a64
   #5 [ffffffc034c43ac0] exit_mmap at ffffffe003a945c4
   #6 [ffffffc034c43b10] __mmput at ffffffe00372c818
   #7 [ffffffc034c43b40] mmput at ffffffe00372c0d0
   #8 [ffffffc034c43b90] exit_mm at ffffffe00373d0ac
   #9 [ffffffc034c43c00] do_exit at ffffffe00373bedc
       PC: 00000073f5294840   LR: 00000070d8f39ba4   SP: 00000070d4afd5d0
      X29: 00000070d4afd600  X28: b4000071efcda7f0  X27: 00000070d4afe000
      X26: 0000000000000000  X25: 00000070d9616000  X24: 0000000000000000
      X23: 0000000000000000  X22: 0000000000000000  X21: 0000000000000000
      X20: b40000728fd27520  X19: b40000728fd27550  X18: 000000702daba000
      X17: 00000073f5294820  X16: 00000070d940f9d8  X15: 00000000000000bf
      X14: 0000000000000000  X13: 00000070d8ad2fac  X12: b40000718fce5040
      X11: 0000000000000000  X10: 0000000000000070   X9: 0000000000000001
       X8: 0000000000000062   X7: 0000000000000020   X6: 0000000000000000
       X5: 0000000000000000   X4: 0000000000000000   X3: 0000000000000000
       X2: 0000000000000002   X1: 0000000000000080   X0: b40000728fd27550
      ORIG_X0: b40000728fd27550  SYSCALLNO: ffffffff  PSTATE: 40001000

Related kernel commits:
689eae42afd7 ("arm64: mask PAC bits of __builtin_return_address")
de1702f65feb ("arm64: move PAC masks to <asm/pointer_auth.h>")

Signed-off-by: bevis_chen <[email protected]>
Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
---
 arm64.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/arm64.c b/arm64.c
index 624dba2368d7..78e6609e3722 100644
--- a/arm64.c
+++ b/arm64.c
@@ -92,6 +92,7 @@ static void arm64_get_crash_notes(void);
 static void arm64_calc_VA_BITS(void);
 static int arm64_is_uvaddr(ulong, struct task_context *);
 static void arm64_calc_KERNELPACMASK(void);
+static void arm64_recalc_KERNELPACMASK(void);
 static int arm64_get_vmcoreinfo(unsigned long *vaddr, const char *label, int 
base);
 
 struct kernel_range {
@@ -581,6 +582,16 @@ arm64_init(int when)
                if (!machdep->hz)
                        machdep->hz = 100;
 
+
+               /*
+                * Let's calculate the KERNELPACMASK value based on the
+                * vabits, see:
+                * arch/arm64/kernel/vmcore_info.c
+                * arch/arm64/include/asm/pointer_auth.h
+                */
+               if(!machdep->machspec->CONFIG_ARM64_KERNELPACMASK)
+                       arm64_recalc_KERNELPACMASK();
+
                arm64_irq_stack_init();
                arm64_overflow_stack_init();
                arm64_stackframe_init();
@@ -4921,6 +4932,24 @@ static void arm64_calc_KERNELPACMASK(void)
        }
 }
 
+#define GENMASK_UL(h, l) \
+    (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
+
+static void arm64_recalc_KERNELPACMASK(void){
+       /*
+        * Check if PAC is enabled according to the existence of
+        * kernel symbol 'ptrauth_keys_kernel'.
+        */
+       if (STRUCT_EXISTS("ptrauth_keys_kernel") &&
+                       machdep->machspec->VA_BITS_ACTUAL){
+               machdep->machspec->CONFIG_ARM64_KERNELPACMASK =
+                       GENMASK_UL(63, machdep->machspec->VA_BITS_ACTUAL);
+               if (CRASHDEBUG(1))
+                       fprintf(fp, "CONFIG_ARM64_KERNELPACMASK: %lx\n",
+                               machdep->machspec->CONFIG_ARM64_KERNELPACMASK);
+       }
+}
+
 #endif  /* ARM64 */
 
 
-- 
2.45.2


++++++ crash-8.0.4.tar.gz -> crash-8.0.5.tar.gz ++++++
++++ 17439 lines of diff (skipped)

Reply via email to