Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package crash for openSUSE:Factory checked 
in at 2021-11-20 02:38:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/crash (Old)
 and      /work/SRC/openSUSE:Factory/.crash.new.1895 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "crash"

Sat Nov 20 02:38:45 2021 rev:179 rq:932245 version:7.3.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/crash/crash.changes      2021-10-15 
23:05:08.590147921 +0200
+++ /work/SRC/openSUSE:Factory/.crash.new.1895/crash.changes    2021-11-20 
02:39:48.460648002 +0100
@@ -1,0 +2,45 @@
+Wed Nov 10 12:52:42 UTC 2021 - Michal Suchanek <msucha...@suse.com>
+
+- Update to 7.3.0 (jsc#SLE-17360).
+  - Refresh
+    * eppic-switch-to-system-lib.patch
+  - Remove upstreamed patches
+    - crash-xen-increase-__physical_mask_shift_xen-to-52.patch
+    - crash-arm64-update-mapping-symbol-filter-in-arm64_verify_s.patch
+    - crash-Fix-segmentation-fault-when-ikconfig-passed-nonstand.patch
+    - crash-printk-add-support-for-lockless-ringbuffer.patch
+    - crash-printk-use-committed-finalized-state-values.patch
+    - crash-x86_64-VC-exception-stack-support.patch
+  - Refresh to upstream version
+    * crash-xen-pvops.patch
+    * crash-handle-by-kernel-task_struct-state-member-changes.patch
+      => 0006-Handle-task_struct-state-member-changes-for-kernels-.patch
+  - Removed trace extension moved to different project upstream.
+- Enable Linux 5.14 and pull fixes since 7.3.0
+  + 0001-Fix-for-kmem-s-S-option-on-Linux-5.7-and-later-kerne.patch
+  + 0002-memory-Add-support-for-SECTION_TAINT_ZONE_DEVICE-fla.patch
+  + 0003-memory-Fix-for-kmem-n-option-to-display-NID-correctl.patch
+  + 0004-defs.h-Fix-the-value-of-TIF_SIGPENDING-macro.patch
+  + 0005-Fix-waitq-command-for-Linux-4.13-and-later-kernels.patch
+  + 0007-arm64-rename-ARM64_PAGE_OFFSET_ACTUAL-to-ARM64_FLIP_.patch
+  + 0008-arm64-assign-page_offset-with-VA_BITS-kernel-configu.patch
+  + 0009-arm64-use-dedicated-bits-to-record-the-VA-space-layo.patch
+  + 0010-arm64-implement-switchable-PTOV-VTOP-for-kernels-5.1.patch
+  + 0011-diskdump-Fail-readmem-early-if-dump-is-incomplete.patch
+  + 0012-netdump-Permit-zero_excluded-for-incomplete-ELF-dump.patch
+  + 0013-diskdump-Print-total-number-of-dumpable-pages.patch
+  + 0014-diskdump-Introduce-read_pd.patch
+  + 0015-x86_64-Fix-check-for-__per_cpu_offset-initialization.patch
+  + 0016-arm64-Get-CPU-registers-from-ELF-notes-even-without-.patch
+  + 0017-ppc64-Add-MMU-type-info-in-machdep-command.patch
+  + 0018-diskdump-Add-support-for-reading-dumpfiles-compresse.patch
+  + 0019-Add-kernel-version-dependent-check-for-getting-lengt.patch
+  + 0020-arm64-Use-VA_BITS-for-page_offset-calculation.patch
+
+-------------------------------------------------------------------
+Wed Nov 10 11:32:29 UTC 2021 - Martin Wilck <mwi...@suse.com>
+
+- enable zstd support
+  + add crash-enable-zstd-support.patch
+
+-------------------------------------------------------------------

Old:
----
  crash-7.2.9.tar.gz
  crash-Fix-segmentation-fault-when-ikconfig-passed-nonstand.patch
  crash-arm64-update-mapping-symbol-filter-in-arm64_verify_s.patch
  crash-handle-by-kernel-task_struct-state-member-changes.patch
  crash-printk-add-support-for-lockless-ringbuffer.patch
  crash-printk-use-committed-finalized-state-values.patch
  crash-x86_64-VC-exception-stack-support.patch
  crash-xen-increase-__physical_mask_shift_xen-to-52.patch

New:
----
  0001-Fix-for-kmem-s-S-option-on-Linux-5.7-and-later-kerne.patch
  0002-memory-Add-support-for-SECTION_TAINT_ZONE_DEVICE-fla.patch
  0003-memory-Fix-for-kmem-n-option-to-display-NID-correctl.patch
  0004-defs.h-Fix-the-value-of-TIF_SIGPENDING-macro.patch
  0005-Fix-waitq-command-for-Linux-4.13-and-later-kernels.patch
  0006-Handle-task_struct-state-member-changes-for-kernels-.patch
  0007-arm64-rename-ARM64_PAGE_OFFSET_ACTUAL-to-ARM64_FLIP_.patch
  0008-arm64-assign-page_offset-with-VA_BITS-kernel-configu.patch
  0009-arm64-use-dedicated-bits-to-record-the-VA-space-layo.patch
  0010-arm64-implement-switchable-PTOV-VTOP-for-kernels-5.1.patch
  0011-diskdump-Fail-readmem-early-if-dump-is-incomplete.patch
  0012-netdump-Permit-zero_excluded-for-incomplete-ELF-dump.patch
  0013-diskdump-Print-total-number-of-dumpable-pages.patch
  0014-diskdump-Introduce-read_pd.patch
  0015-x86_64-Fix-check-for-__per_cpu_offset-initialization.patch
  0016-arm64-Get-CPU-registers-from-ELF-notes-even-without-.patch
  0017-ppc64-Add-MMU-type-info-in-machdep-command.patch
  0018-diskdump-Add-support-for-reading-dumpfiles-compresse.patch
  0019-Add-kernel-version-dependent-check-for-getting-lengt.patch
  0020-arm64-Use-VA_BITS-for-page_offset-calculation.patch
  crash-7.3.0.tar.gz
  crash-enable-zstd-support.patch
  gdb-7.6.tar.gz
  gdb-7.6.tar.gz.sig
  gnu.keyring

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

Other differences:
------------------
++++++ crash.spec ++++++
--- /var/tmp/diff_new_pack.XXzcXn/_old  2021-11-20 02:39:49.956643066 +0100
+++ /var/tmp/diff_new_pack.XXzcXn/_new  2021-11-20 02:39:49.960643052 +0100
@@ -29,6 +29,15 @@
 %endif
 %endif
 
+%if 0%{!?have_zstd:1}
+%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150200
+# the zstd patch depends on the snappy patch
+%define have_zstd %{have_snappy}
+%else
+%define have_zstd 0
+%endif
+%endif
+
 Name:           crash
 %ifarch ppc
 %define build_sial 0
@@ -53,21 +62,23 @@
 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:        7.2.9
+Version:        7.3.0
 Release:        0
-Source:         %{name}-%{version}.tar.gz
+Source:         
https://github.com/crash-utility/crash/archive/7.3.0.tar.gz#/%{name}-%{version}.tar.gz
+Source1:        http://ftp.gnu.org/gnu/gdb/gdb-7.6.tar.gz
 Source2:        crash_whitepaper-%{whitepaper_version}.tar.bz2
 Source3:        README.SUSE
 Source4:        sial-scripts-%{scripts_version}.tar.bz2
 Source5:        gcore-%{gcore_version}.tar.bz2
 Source6:        Module.supported
+Source7:        http://ftp.gnu.org/gnu/gdb/gdb-7.6.tar.gz.sig
+Source8:        gnu.keyring
 Source95:       get-kernel-flavors.sh
 Source96:       depmod.sh
 Source97:       mkinitrd.sh
 Source98:       %{name}-kmp-preamble
 Source99:       crash-rpmlintrc
 Source100:      %{name}-gdb-7.6.series
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Patch1:         %{name}-make-emacs-default.diff
 Patch2:         %{name}-sles9-quirk.patch
 Patch4:         %{name}-sles9-time.patch
@@ -85,23 +96,31 @@
 Patch24:        
%{name}-SLE15-SP1-Fix-for-PPC64-kernel-virtual-address-translation-in.patch
 Patch27:        %{name}-Define-fallback-PN_XNUM.patch
 Patch29:        eppic-remove-duplicate-symbols.patch
-# PATCH-FIX-UPSTREAM - 
https://github.com/crash-utility/crash/commit/fdb41f0b6fa42a692e5fa39da3801f6ca18e8a6b.patch
-Patch34:        %{name}-xen-increase-__physical_mask_shift_xen-to-52.patch
-# PATCH-FIX-UPSTREAM - 
https://github.com/crash-utility/crash/commit/9080711bd1c0645c272e74c25724ad2969d64674.patch
-Patch41:        
%{name}-arm64-update-mapping-symbol-filter-in-arm64_verify_s.patch
-# PATCH-FIX-UPSTREAM - 
https://github.com/crash-utility/crash/commit/5a0488049917ba2790d59108f3def16825528974.patch
-Patch42:        
%{name}-Fix-segmentation-fault-when-ikconfig-passed-nonstand.patch
-# PATCH-FIX-UPSTREAM - 
https://github.com/crash-utility/crash/commit/a5531b24750e7949c35640d996ea14c0587938bc.patch
-Patch43:        %{name}-printk-add-support-for-lockless-ringbuffer.patch
-# PATCH-FIX-UPSTREAM - 
https://github.com/crash-utility/crash/commit/71e159c64000467e94e08aefc144f5e1cdaa4aa0.patch
-Patch44:        %{name}-printk-use-committed-finalized-state-values.patch
-# PATCH-FIX-UPSTREAM - 
https://github.com/crash-utility/crash/commit/9c881ab372010b46655dfed0a3c5cd78b3ff8fa0.patch
-Patch45:        %{name}-x86_64-VC-exception-stack-support.patch
+Patch30:        %{name}-enable-zstd-support.patch
+# PATCH-FIX-UPSTREAM - 
https://github.com/crash-utility/crash/commit/4badc6229c69f5cd9da7eb7bdf400a53ec6db01a.patch
 Patch46:        %{name}-xen-pvops.patch
 # PATCH-FIX-UPSTREAM - 
https://github.com/crash-utility/crash/commit/cf0c8d10e1870d89b39f40382634db51aa8fcf2c.patch
 Patch47:        %{name}-mod-fix-module-object-file-lookup.patch
-# PATCH-FIX-UPSTREAM - 
https://github.com/crash-utility/crash/commit/d6b4f36d6b22b70fb14e692f36d20910ef5563c1.patch
-Patch48:        %{name}-handle-by-kernel-task_struct-state-member-changes.patch
+Patch48:        0001-Fix-for-kmem-s-S-option-on-Linux-5.7-and-later-kerne.patch
+Patch49:        0002-memory-Add-support-for-SECTION_TAINT_ZONE_DEVICE-fla.patch
+Patch50:        0003-memory-Fix-for-kmem-n-option-to-display-NID-correctl.patch
+Patch51:        0004-defs.h-Fix-the-value-of-TIF_SIGPENDING-macro.patch
+Patch52:        0005-Fix-waitq-command-for-Linux-4.13-and-later-kernels.patch
+Patch53:        0006-Handle-task_struct-state-member-changes-for-kernels-.patch
+Patch54:        0007-arm64-rename-ARM64_PAGE_OFFSET_ACTUAL-to-ARM64_FLIP_.patch
+Patch55:        0008-arm64-assign-page_offset-with-VA_BITS-kernel-configu.patch
+Patch56:        0009-arm64-use-dedicated-bits-to-record-the-VA-space-layo.patch
+Patch57:        0010-arm64-implement-switchable-PTOV-VTOP-for-kernels-5.1.patch
+Patch58:        0011-diskdump-Fail-readmem-early-if-dump-is-incomplete.patch
+Patch59:        0012-netdump-Permit-zero_excluded-for-incomplete-ELF-dump.patch
+Patch60:        0013-diskdump-Print-total-number-of-dumpable-pages.patch
+Patch61:        0014-diskdump-Introduce-read_pd.patch
+Patch62:        0015-x86_64-Fix-check-for-__per_cpu_offset-initialization.patch
+Patch63:        0016-arm64-Get-CPU-registers-from-ELF-notes-even-without-.patch
+Patch64:        0017-ppc64-Add-MMU-type-info-in-machdep-command.patch
+Patch65:        0018-diskdump-Add-support-for-reading-dumpfiles-compresse.patch
+Patch66:        0019-Add-kernel-version-dependent-check-for-getting-lengt.patch
+Patch67:        0020-arm64-Use-VA_BITS-for-page_offset-calculation.patch
 Patch90:        %{name}-sial-ps-2.6.29.diff
 BuildRequires:  bison
 BuildRequires:  flex
@@ -111,6 +130,9 @@
 %if %{have_snappy}
 BuildRequires:  snappy-devel
 %endif
+%if %{have_zstd}
+BuildRequires:  libzstd-devel
+%endif
 BuildRequires:  libelf-devel
 BuildRequires:  zlib-devel
 Requires:       /usr/bin/nm
@@ -281,6 +303,7 @@
 
 %prep
 %setup -q -a 2 -a 4
+ln -s %{SOURCE1} .
 %patch1 -p1
 %patch2 -p1
 %patch4 -p1
@@ -298,18 +321,34 @@
 %patch24 -p1
 %endif
 %patch27 -p1
-%patch34 -p1
-%patch41 -p1
-%patch42 -p1
-%patch43 -p1
-%patch44 -p1
-%patch45 -p1
 %patch46 -p1
 %patch47 -p1
 %patch48 -p1
+%patch49 -p1
+%patch50 -p1
+%patch51 -p1
+%patch52 -p1
+%patch53 -p1
+%patch54 -p1
+%patch55 -p1
+%patch56 -p1
+%patch57 -p1
+%patch58 -p1
+%patch59 -p1
+%patch60 -p1
+%patch61 -p1
+%patch62 -p1
+%patch63 -p1
+%patch64 -p1
+%patch65 -p1
+%patch66 -p1
+%patch67 -p1
 %if %{have_snappy}
 %patch15 -p1
 %endif
+%if %{have_zstd}
+%patch30 -p1
+%endif
 ## GDB patches
 #for f in %{S:XXX} ; do
 #    base=`basename "$f"`
@@ -364,7 +403,7 @@
 chmod 644 COPYING3
 # extensions
 mkdir -p $RPM_BUILD_ROOT/%{_libdir}/crash/extensions
-install -m 0644 extensions/dminfo.so extensions/snap.so extensions/trace.so \
+install -m 0644 extensions/dminfo.so extensions/snap.so \
     $RPM_BUILD_ROOT/%{_libdir}/crash/extensions
 %if %build_gcore
 install -m 0644 extensions/gcore.so $RPM_BUILD_ROOT/%{_libdir}/crash/extensions
@@ -404,7 +443,6 @@
 %dir %{_libdir}/crash/extensions
 %{_libdir}/crash/extensions/dminfo.so
 %{_libdir}/crash/extensions/snap.so
-%{_libdir}/crash/extensions/trace.so
 
 %files devel
 %defattr(-,root,root)

++++++ 0001-Fix-for-kmem-s-S-option-on-Linux-5.7-and-later-kerne.patch ++++++
>From 647a5c33e1c94054d7b63168cd6c12901591cb77 Mon Sep 17 00:00:00 2001
From: Lianbo Jiang <liji...@redhat.com>
Date: Thu, 27 May 2021 18:02:11 +0800
Subject: [PATCH] Fix for "kmem -s|-S" option on Linux 5.7 and later kernels

Linux 5.7 and later kernels that contain kernel commit 1ad53d9fa3f6
("slub: improve bit diffusion for freelist ptr obfuscation") changed
the calculation formula in the freelist_ptr(), which added a swab()
call to mix bits a little more.  When kernel is configured with the
"CONFIG_SLAB_FREELIST_HARDENED=y", without the patch, the "kmem -s|-S"
options display wrong statistics and state whether slab objects are
in use or free and can print the following errors:

  crash> kmem -s
  CACHE             OBJSIZE  ALLOCATED     TOTAL  SLABS  SSIZE  NAME
  87201e00              528          0         0      0     8k  xfs_dqtrx
  87201f00              496          0         0      0     8k  xfs_dquot
  kmem: xfs_buf: slab: 37202e6e900 invalid freepointer: b844bab900001d70
  kmem: xfs_buf: slab: 3720250fd80 invalid freepointer: b8603f9400001370
  ...

Signed-off-by: Lianbo Jiang <liji...@redhat.com>
---
 memory.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/memory.c b/memory.c
index 8c6bbe4..a3cf8a8 100644
--- a/memory.c
+++ b/memory.c
@@ -20,6 +20,7 @@
 #include <sys/mman.h>
 #include <ctype.h>
 #include <netinet/in.h>
+#include <byteswap.h>
 
 struct meminfo {           /* general purpose memory information structure */
         ulong cache;       /* used by the various memory searching/dumping */
@@ -19336,10 +19337,14 @@ count_free_objects(struct meminfo *si, ulong freelist)
 static ulong
 freelist_ptr(struct meminfo *si, ulong ptr, ulong ptr_addr)
 {
-       if (VALID_MEMBER(kmem_cache_random))
+       if (VALID_MEMBER(kmem_cache_random)) {
                /* CONFIG_SLAB_FREELIST_HARDENED */
+
+               if (THIS_KERNEL_VERSION >= LINUX(5,7,0))
+                       ptr_addr = (sizeof(long) == 8) ? bswap_64(ptr_addr)
+                                                      : bswap_32(ptr_addr);
                return (ptr ^ si->random ^ ptr_addr);
-       else
+       } else
                return ptr;
 }
 
-- 
2.33.1

++++++ 0002-memory-Add-support-for-SECTION_TAINT_ZONE_DEVICE-fla.patch ++++++
>From 0b5435e10161345cf713ed447a155a611a1b408b Mon Sep 17 00:00:00 2001
From: Kazuhito Hagio <k-hagio...@nec.com>
Date: Wed, 26 May 2021 17:33:13 +0900
Subject: [PATCH] memory: Add support for SECTION_TAINT_ZONE_DEVICE flag

Fix for "kmem -n|-p" options on Linux 5.12-rc1 and later kernels
that contain commit 1f90a3477df3f ("mm: teach pfn_to_online_page()
about ZONE_DEVICE section collisions").  Without the patch, the
"kmem -n" option incorrectly shows mem_map addresses containing the
flag in bit 5 as part of the virtual address, and also the "kmem -p"
option shows page structures at wrong position.  With the patch,
the "kmem -n" option displays the new "D" state flag.

Without the patch:
  crash> kmem -n
  ...
  NR      SECTION        CODED_MEM_MAP        MEM_MAP       STATE PFN
  1040  ffff9edf3ffd4100  ffffe2bcc0000010  ffffe2bd42000010  PMOE  34078720
                                        ^                 ^
  crash> kmem -p
      PAGE         PHYSICAL      MAPPING       INDEX CNT FLAGS
  ffffe2bd42000010 2080000000           400040 1ffffffff 9961471 
dead000000000122 referenced,active,error
  ffffe2bd42000050 2080001000           800080 1ffffffff 9961471 
dead000000000122 referenced,active,error
  ffffe2bd42000090 2080002000                0 1ffffffff 9961471 
dead000000000122 referenced,active,error
                ^^
With the patch:
  crash> kmem -n
  ...
  NR      SECTION        CODED_MEM_MAP        MEM_MAP       STATE PFN
  1040  ffff9edf3ffd4100  ffffe2bcc0000000  ffffe2bd42000000  PMOED 34078720

  crash> kmem -p
      PAGE         PHYSICAL      MAPPING       INDEX CNT FLAGS
  ffffe2bd42000000 2080000000 ffff9ebfc0044100        0  1 97ffffc0000200 slab
  ffffe2bd42000040 2080001000 ffff9ebfc0044400        0  1 97ffffc0000200 slab
  ffffe2bd42000080 2080002000                0        0  1 97ffffc0000000

Signed-off-by: Kazuhito Hagio <k-hagio...@nec.com>
---
 help.c   | 11 +++++++----
 memory.c | 15 +++++++++------
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/help.c b/help.c
index e0c8408..9649cc8 100644
--- a/help.c
+++ b/help.c
@@ -6584,10 +6584,13 @@ char *help_kmem[] = {
 "            kernels, the vm_zone_stat, vm_node_stat and vm_numa_stat tables,",
 "            the cumulative page_states counter values if they exist, and/or ",
 "            the cumulative, vm_event_states counter values if they exist.",
-"        -n  display memory node, memory section, and memory block data",
-"            and state; the state of each memory section state is encoded",
-"            as \"P\", \"M\", \"O\" and/or \"E\", meaning 
SECTION_MARKED_PRESENT,",
-"            SECTION_HAS_MEM_MAP, SECTION_IS_ONLINE and SECTION_IS_EARLY.",
+"        -n  display memory node, memory section, memory block data and 
state;",
+"            the state of each memory section is shown as the following 
flags:",
+"              \"P\": SECTION_MARKED_PRESENT",
+"              \"M\": SECTION_HAS_MEM_MAP",
+"              \"O\": SECTION_IS_ONLINE",
+"              \"E\": SECTION_IS_EARLY",
+"              \"D\": SECTION_TAINT_ZONE_DEVICE",
 "        -z  displays per-zone memory statistics.",
 "        -o  displays each cpu's offset value that is added to per-cpu symbol",
 "            values to translate them into kernel virtual addresses.",
diff --git a/memory.c b/memory.c
index a3cf8a8..2c4f979 100644
--- a/memory.c
+++ b/memory.c
@@ -17270,12 +17270,13 @@ nr_to_section(ulong nr)
  *      which results in PFN_SECTION_SHIFT equal 6.
  * To sum it up, at least 6 bits are available.
  */
-#define SECTION_MARKED_PRESENT (1UL<<0)
-#define SECTION_HAS_MEM_MAP    (1UL<<1)
-#define SECTION_IS_ONLINE      (1UL<<2)
-#define SECTION_IS_EARLY       (1UL<<3)
-#define SECTION_MAP_LAST_BIT   (1UL<<4)
-#define SECTION_MAP_MASK       (~(SECTION_MAP_LAST_BIT-1))
+#define SECTION_MARKED_PRESENT         (1UL<<0)
+#define SECTION_HAS_MEM_MAP            (1UL<<1)
+#define SECTION_IS_ONLINE              (1UL<<2)
+#define SECTION_IS_EARLY               (1UL<<3)
+#define SECTION_TAINT_ZONE_DEVICE      (1UL<<4)
+#define SECTION_MAP_LAST_BIT           (1UL<<5)
+#define SECTION_MAP_MASK               (~(SECTION_MAP_LAST_BIT-1))
 
 
 int 
@@ -17373,6 +17374,8 @@ fill_mem_section_state(ulong state, char *buf)
                bufidx += sprintf(buf + bufidx, "%s", "O");
        if (state & SECTION_IS_EARLY)
                bufidx += sprintf(buf + bufidx, "%s", "E");
+       if (state & SECTION_TAINT_ZONE_DEVICE)
+               bufidx += sprintf(buf + bufidx, "%s", "D");
 }
 
 void 
-- 
2.33.1

++++++ 0003-memory-Fix-for-kmem-n-option-to-display-NID-correctl.patch ++++++
>From ec44b902d3467e7b86ee39e2d7d472b9cb202148 Mon Sep 17 00:00:00 2001
From: Kazuhito Hagio <k-hagio...@nec.com>
Date: Mon, 31 May 2021 14:08:28 +0900
Subject: [PATCH] memory: Fix for "kmem -n" option to display NID correctly

The nid member of struct memory_block is a 4-byte integer, but read
and printed as a 8-byte integer on 64-bit machines.  Without the
patch, the option displays wrong NIDs.

  crash> kmem -n
  ...
     MEM_BLOCK        NAME          PHYSICAL RANGE       NODE  STATE   
START_SECTION_NO
   ffff9edeff2b9400   memory0             0 -   7fffffff 14195095130662240256  
ONLINE  0
   ffff9edeff2bb400   memory2     100000000 -  17fffffff 14195094718345379840  
ONLINE  32

The issue seems to appear on Linux 5.12 and later kernels that contain
commit e9a2e48e8704c ("drivers/base/memory: don't store phys_device
in memory blocks"), which changed the arrangement of the members of
struct memory_block.

Signed-off-by: Kazuhito Hagio <k-hagio...@nec.com>
---
 memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/memory.c b/memory.c
index 2c4f979..cbe90ee 100644
--- a/memory.c
+++ b/memory.c
@@ -17568,13 +17568,13 @@ print_memory_block(ulong memory_block)
 
        if (MEMBER_EXISTS("memory_block", "nid")) {
                readmem(memory_block + OFFSET(memory_block_nid), KVADDR, &nid,
-                       sizeof(void *), "memory_block nid", FAULT_ON_ERROR);
+                       sizeof(int), "memory_block nid", FAULT_ON_ERROR);
                fprintf(fp, " %s %s %s %s  %s %s\n",
                        mkstring(buf1, VADDR_PRLEN, LJUST|LONG_HEX,
                        MKSTR(memory_block)),
                        mkstring(buf2, 12, CENTER, name),
                        parangebuf,
-                       mkstring(buf5, strlen("NODE"), CENTER|LONG_DEC,
+                       mkstring(buf5, strlen("NODE"), CENTER|INT_DEC,
                        MKSTR(nid)),
                        mkstring(buf6, strlen("OFFLINE"), LJUST,
                        statebuf),
-- 
2.33.1

++++++ 0004-defs.h-Fix-the-value-of-TIF_SIGPENDING-macro.patch ++++++
>From 704623dfde43da98ffb354b3d7f450cd012a8215 Mon Sep 17 00:00:00 2001
From: Youling Tang <tangyoul...@loongson.cn>
Date: Thu, 3 Jun 2021 16:07:41 +0800
Subject: [PATCH] defs.h: Fix the value of TIF_SIGPENDING macro

Correct the change of the value of TIF_SIGPENDING macro between
different kernel versions.

TIF_SIGPENDING changes with the kernel version as follows:
  ARM     2 -> 0 at v2.6.23
  MIPS    2 -> 1 at v2.6.23
  MIPS64  2 -> 1 at v2.6.23
  PPC     2 -> 1 at v2.6.23
  IA64    1 -> 0 at v2.6.23
  PPC64   2 -> 1 at v2.6.23
  S390    2 -> 1 at v3.16
  S390X   2 -> 1 at v3.16

Signed-off-by: Youling Tang <tangyoul...@loongson.cn>
---
 defs.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/defs.h b/defs.h
index 396d61a..3502c6d 100644
--- a/defs.h
+++ b/defs.h
@@ -2997,7 +2997,7 @@ typedef struct QEMUCPUState QEMUCPUState;
 #define __swp_type(entry)      SWP_TYPE(entry)
 #define __swp_offset(entry)    SWP_OFFSET(entry)
 
-#define TIF_SIGPENDING         (2)
+#define TIF_SIGPENDING         (THIS_KERNEL_VERSION >= LINUX(2,6,23) ? 0 : 2)
 
 #define _SECTION_SIZE_BITS     28
 #define _MAX_PHYSMEM_BITS      32
@@ -3377,7 +3377,7 @@ struct arm64_stackframe {
 #define __swp_type(entry)      SWP_TYPE(entry)
 #define __swp_offset(entry)    SWP_OFFSET(entry)
 
-#define TIF_SIGPENDING         (2)
+#define TIF_SIGPENDING         (THIS_KERNEL_VERSION >= LINUX(2,6,23) ? 1 : 2)
 
 #define _SECTION_SIZE_BITS     26
 #define _MAX_PHYSMEM_BITS      32
@@ -3416,7 +3416,7 @@ struct arm64_stackframe {
 #define __swp_type(entry)       SWP_TYPE(entry)
 #define __swp_offset(entry)     SWP_OFFSET(entry)
 
-#define TIF_SIGPENDING          (2)
+#define TIF_SIGPENDING          (THIS_KERNEL_VERSION >= LINUX(2,6,23) ? 1 : 2)
 
 #define _SECTION_SIZE_BITS      28
 #define _MAX_PHYSMEM_BITS       48
@@ -3884,7 +3884,7 @@ struct machine_specific {
 #define __swp_type(entry)   SWP_TYPE(entry)
 #define __swp_offset(entry) SWP_OFFSET(entry)
 
-#define TIF_SIGPENDING (2)
+#define TIF_SIGPENDING (THIS_KERNEL_VERSION >= LINUX(2,6,23) ? 1 : 2)
 
 #define _SECTION_SIZE_BITS     24
 #define _MAX_PHYSMEM_BITS      44
@@ -4079,7 +4079,7 @@ struct efi_memory_desc_t {
 #define __swp_type(entry)    ((entry >> 2) & 0x7f)
 #define __swp_offset(entry)  ((entry << 1) >> 10)
 
-#define TIF_SIGPENDING (1)
+#define TIF_SIGPENDING (THIS_KERNEL_VERSION >= LINUX(2,6,23) ? 0 : 1)
 
 #define KERNEL_TR_PAGE_SIZE (1 << _PAGE_SIZE_64M)
 #define KERNEL_TR_PAGE_MASK (~(KERNEL_TR_PAGE_SIZE - 1))
@@ -4219,7 +4219,7 @@ struct efi_memory_desc_t {
 #define PTE_RPN_MASK    (machdep->machspec->pte_rpn_mask)
 #define PTE_RPN_SHIFT   (machdep->machspec->pte_rpn_shift)
 
-#define TIF_SIGPENDING (2)
+#define TIF_SIGPENDING (THIS_KERNEL_VERSION >= LINUX(2,6,23) ? 1 : 2)
 
 #define SWP_TYPE(entry) (((entry) >> 1) & 0x7f)
 #define SWP_OFFSET(entry) ((entry) >> 8)
@@ -4259,7 +4259,7 @@ struct efi_memory_desc_t {
 #define __swp_type(entry)   SWP_TYPE(entry)
 #define __swp_offset(entry) SWP_OFFSET(entry)
 
-#define TIF_SIGPENDING (2)
+#define TIF_SIGPENDING (THIS_KERNEL_VERSION >= LINUX(3,16,0) ? 1 : 2)
 
 #define _SECTION_SIZE_BITS     25
 #define _MAX_PHYSMEM_BITS      31
@@ -4284,7 +4284,7 @@ struct efi_memory_desc_t {
 #define __swp_type(entry)  SWP_TYPE(entry)
 #define __swp_offset(entry) SWP_OFFSET(entry)
 
-#define TIF_SIGPENDING (2)
+#define TIF_SIGPENDING (THIS_KERNEL_VERSION >= LINUX(3,16,0) ? 1 : 2)
 
 #define _SECTION_SIZE_BITS     28
 #define _MAX_PHYSMEM_BITS_OLD  42
-- 
2.33.1

++++++ 0005-Fix-waitq-command-for-Linux-4.13-and-later-kernels.patch ++++++
>From eaf14f852ae79f7745934e213661f1c6abac711e Mon Sep 17 00:00:00 2001
From: Greg Edwards <gedwa...@ddn.com>
Date: Wed, 23 Jun 2021 13:50:47 -0600
Subject: [PATCH] Fix 'waitq' command for Linux 4.13 and later kernels

The wait queue structs and members were renamed in 4.13 in commits:

  ac6424b981bc ("sched/wait: Rename wait_queue_t => wait_queue_entry_t")
  9d9d676f595b ("sched/wait: Standardize internal naming of wait-queue heads")
  2055da97389a ("sched/wait: Disambiguate wq_entry->task_list and 
wq_head->task_list naming")

Add support to the 'waitq' command for these more recent kernels.

[ kh: suppressed compilation warnings ]

Signed-off-by: Greg Edwards <gedwa...@ddn.com>
Signed-off-by: Kazuhito Hagio <k-hagio...@nec.com>
---
 defs.h    |  4 ++++
 kernel.c  | 27 +++++++++++++++++++++++----
 symbols.c | 10 +++++++++-
 3 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/defs.h b/defs.h
index 42c8074..6bb00e2 100644
--- a/defs.h
+++ b/defs.h
@@ -2138,6 +2138,9 @@ struct offset_table {                    /* stash of 
commonly-used offsets */
        long atomic_long_t_counter;
        long block_device_bd_device;
        long block_device_bd_stats;
+       long wait_queue_entry_private;
+       long wait_queue_head_head;
+       long wait_queue_entry_entry;
 };
 
 struct size_table {         /* stash of commonly-used sizes */
@@ -2300,6 +2303,7 @@ struct size_table {         /* stash of commonly-used 
sizes */
        long printk_info;
        long printk_ringbuffer;
        long prb_desc;
+       long wait_queue_entry;
 };
 
 struct array_table {
diff --git a/kernel.c b/kernel.c
index 528f6ee..e123f76 100644
--- a/kernel.c
+++ b/kernel.c
@@ -615,7 +615,15 @@ kernel_init()
                kt->flags |= TVEC_BASES_V1;
 
         STRUCT_SIZE_INIT(__wait_queue, "__wait_queue");
-        if (VALID_STRUCT(__wait_queue)) {
+       STRUCT_SIZE_INIT(wait_queue_entry, "wait_queue_entry");
+       if (VALID_STRUCT(wait_queue_entry)) {
+               MEMBER_OFFSET_INIT(wait_queue_entry_private,
+                       "wait_queue_entry", "private");
+               MEMBER_OFFSET_INIT(wait_queue_head_head,
+                       "wait_queue_head", "head");
+               MEMBER_OFFSET_INIT(wait_queue_entry_entry,
+                       "wait_queue_entry", "entry");
+       } else if (VALID_STRUCT(__wait_queue)) {
                if (MEMBER_EXISTS("__wait_queue", "task"))
                        MEMBER_OFFSET_INIT(__wait_queue_task,
                                "__wait_queue", "task");
@@ -9367,9 +9375,9 @@ dump_waitq(ulong wq, char *wq_name)
        struct list_data list_data, *ld;
        ulong *wq_list;                 /* addr of wait queue element */
        ulong next_offset;              /* next pointer of wq element */
-       ulong task_offset;              /* offset of task in wq element */
+       ulong task_offset = 0;          /* offset of task in wq element */
        int cnt;                        /* # elems on Queue */
-       int start_index;                /* where to start in wq array */
+       int start_index = -1;           /* where to start in wq array */
        int i;
 
        ld = &list_data;
@@ -9397,9 +9405,20 @@ dump_waitq(ulong wq, char *wq_name)
                 ld->list_head_offset = OFFSET(__wait_queue_task_list);
                 ld->member_offset = next_offset;
 
+               start_index = 1;
+       } else if (VALID_STRUCT(wait_queue_entry)) {
+               ulong head_offset;
+
+               next_offset = OFFSET(list_head_next);
+               task_offset = OFFSET(wait_queue_entry_private);
+               head_offset = OFFSET(wait_queue_head_head);
+               ld->end = ld->start = wq + head_offset + next_offset;
+               ld->list_head_offset = OFFSET(wait_queue_entry_entry);
+               ld->member_offset = next_offset;
+
                start_index = 1;
        } else {
-               return;
+               error(FATAL, "cannot determine wait queue structures\n");
        }
 
        hq_open();
diff --git a/symbols.c b/symbols.c
index 370d4c3..67c135f 100644
--- a/symbols.c
+++ b/symbols.c
@@ -9817,7 +9817,13 @@ dump_offset_table(char *spec, ulong makestruct)
                OFFSET(__wait_queue_head_task_list));
         fprintf(fp, "        __wait_queue_task_list: %ld\n", 
                OFFSET(__wait_queue_task_list));
- 
+       fprintf(fp, "      wait_queue_entry_private: %ld\n",
+               OFFSET(wait_queue_entry_private));
+       fprintf(fp, "          wait_queue_head_head: %ld\n",
+               OFFSET(wait_queue_head_head));
+       fprintf(fp, "        wait_queue_entry_entry: %ld\n",
+               OFFSET(wait_queue_entry_entry));
+
        fprintf(fp, "        pglist_data_node_zones: %ld\n",
                OFFSET(pglist_data_node_zones));
        fprintf(fp, "      pglist_data_node_mem_map: %ld\n",
@@ -10717,6 +10723,8 @@ dump_offset_table(char *spec, ulong makestruct)
        fprintf(fp, "                    wait_queue: %ld\n", SIZE(wait_queue));
        fprintf(fp, "                  __wait_queue: %ld\n", 
                SIZE(__wait_queue));
+       fprintf(fp, "              wait_queue_entry: %ld\n",
+               SIZE(wait_queue_entry));
        fprintf(fp, "                        device: %ld\n", SIZE(device));
        fprintf(fp, "                    net_device: %ld\n", SIZE(net_device));
 
-- 
2.33.1

++++++ 0006-Handle-task_struct-state-member-changes-for-kernels-.patch ++++++
>From d6b4f36d6b22b70fb14e692f36d20910ef5563c1 Mon Sep 17 00:00:00 2001
From: Alexander Egorenkov <egore...@linux.ibm.com>
Date: Tue, 29 Jun 2021 08:39:00 +0200
Subject: [PATCH] Handle task_struct state member changes for kernels >=
 5.14-rc1

Kernel commit 2f064a59a11ff9bc22e52e9678bc601404c7cb34 ("sched: Change
task_struct::state") renamed the member state of task_struct to __state
and its type changed from long to unsigned int.  Without the patch,
crash fails to start up with the following error:

  crash: invalid structure member offset: task_struct_state
         FILE: task.c  LINE: 5929  FUNCTION: task_state()

Signed-off-by: Alexander Egorenkov <egore...@linux.ibm.com>
---
 defs.h    |  1 +
 symbols.c |  1 +
 task.c    | 10 +++++++++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/defs.h b/defs.h
index 6bb00e2..5d32954 100644
--- a/defs.h
+++ b/defs.h
@@ -2304,6 +2304,7 @@ struct size_table {         /* stash of commonly-used 
sizes */
        long printk_ringbuffer;
        long prb_desc;
        long wait_queue_entry;
+       long task_struct_state;
 };
 
 struct array_table {
diff --git a/symbols.c b/symbols.c
index 67c135f..bf6d94d 100644
--- a/symbols.c
+++ b/symbols.c
@@ -10678,6 +10678,7 @@ dump_offset_table(char *spec, ulong makestruct)
                SIZE(page_cache_bucket));
         fprintf(fp, "                       pt_regs: %ld\n", SIZE(pt_regs));
         fprintf(fp, "                   task_struct: %ld\n", 
SIZE(task_struct));
+       fprintf(fp, "             task_struct_state: %ld\n", 
SIZE(task_struct_state));
         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));
diff --git a/task.c b/task.c
index 36cf259..672b416 100644
--- a/task.c
+++ b/task.c
@@ -297,6 +297,11 @@ task_init(void)
        }
 
         MEMBER_OFFSET_INIT(task_struct_state, "task_struct", "state");
+       MEMBER_SIZE_INIT(task_struct_state, "task_struct", "state");
+       if (INVALID_MEMBER(task_struct_state)) {
+               MEMBER_OFFSET_INIT(task_struct_state, "task_struct", "__state");
+               MEMBER_SIZE_INIT(task_struct_state, "task_struct", "__state");
+       }
         MEMBER_OFFSET_INIT(task_struct_exit_state, "task_struct", 
"exit_state");
         MEMBER_OFFSET_INIT(task_struct_pid, "task_struct", "pid");
         MEMBER_OFFSET_INIT(task_struct_comm, "task_struct", "comm");
@@ -5926,7 +5931,10 @@ task_state(ulong task)
        if (!tt->last_task_read)
                return 0;
 
-       state = ULONG(tt->task_struct + OFFSET(task_struct_state));
+       if (SIZE(task_struct_state) == sizeof(ulong))
+               state = ULONG(tt->task_struct + OFFSET(task_struct_state));
+       else
+               state = UINT(tt->task_struct + OFFSET(task_struct_state));
        exit_state = VALID_MEMBER(task_struct_exit_state) ?
                ULONG(tt->task_struct + OFFSET(task_struct_exit_state)) : 0;
 
-- 
2.33.1

++++++ 0007-arm64-rename-ARM64_PAGE_OFFSET_ACTUAL-to-ARM64_FLIP_.patch ++++++
>From 5719afc7a40868418405a87a2711088556e68a3b Mon Sep 17 00:00:00 2001
From: Pingfan Liu <pi...@redhat.com>
Date: Fri, 2 Jul 2021 10:14:21 +0800
Subject: [PATCH] arm64: rename ARM64_PAGE_OFFSET_ACTUAL to
 ARM64_FLIP_PAGE_OFFSET_ACTUAL

Reflect the flipped layout of kernel VA, which is introduced by
kernel commit 14c127c957c1 ("arm64: mm: Flip kernel VA space").

Signed-off-by: Pingfan Liu <pi...@redhat.com>
---
 arm64.c | 10 ++++++----
 defs.h  |  3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/arm64.c b/arm64.c
index 8934961..9fe1a4a 100644
--- a/arm64.c
+++ b/arm64.c
@@ -217,10 +217,12 @@ arm64_init(int when)
                arm64_calc_VA_BITS();
                arm64_calc_KERNELPACMASK();
                ms = machdep->machspec;
+
+               /* vabits_actual introduced after mm flip, so it should be 
flipped layout */
                if (ms->VA_BITS_ACTUAL) {
-                       ms->page_offset = ARM64_PAGE_OFFSET_ACTUAL;
-                       machdep->identity_map_base = ARM64_PAGE_OFFSET_ACTUAL;
-                       machdep->kvbase = ARM64_PAGE_OFFSET_ACTUAL;
+                       ms->page_offset = ARM64_FLIP_PAGE_OFFSET_ACTUAL;
+                       machdep->identity_map_base = 
ARM64_FLIP_PAGE_OFFSET_ACTUAL;
+                       machdep->kvbase = ARM64_FLIP_PAGE_OFFSET_ACTUAL;
                        ms->userspace_top = ARM64_USERSPACE_TOP_ACTUAL;
                } else {
                        ms->page_offset = ARM64_PAGE_OFFSET;
@@ -401,7 +403,7 @@ arm64_init(int when)
                                fprintf(fp, "CONFIG_ARM64_VA_BITS: %ld\n", 
ms->CONFIG_ARM64_VA_BITS);
                                fprintf(fp, "      VA_BITS_ACTUAL: %ld\n", 
ms->VA_BITS_ACTUAL);
                                fprintf(fp, "(calculated) VA_BITS: %ld\n", 
ms->VA_BITS);
-                               fprintf(fp, " PAGE_OFFSET: %lx\n", 
ARM64_PAGE_OFFSET_ACTUAL);
+                               fprintf(fp, " PAGE_OFFSET: %lx\n", 
ARM64_FLIP_PAGE_OFFSET_ACTUAL);
                                fprintf(fp, "    VA_START: %lx\n", 
ms->VA_START);
                                fprintf(fp, "     modules: %lx - %lx\n", 
ms->modules_vaddr, ms->modules_end);
                                fprintf(fp, "     vmalloc: %lx - %lx\n", 
ms->vmalloc_start_addr, ms->vmalloc_end);
diff --git a/defs.h b/defs.h
index 5d32954..eb7ce6a 100644
--- a/defs.h
+++ b/defs.h
@@ -3233,7 +3233,8 @@ typedef signed int s32;
 
 #define ARM64_PAGE_OFFSET    ((0xffffffffffffffffUL) \
                                        << (machdep->machspec->VA_BITS - 1))
-#define ARM64_PAGE_OFFSET_ACTUAL ((0xffffffffffffffffUL) \
+/* kernels >= v5.4 the kernel VA space is flipped */
+#define ARM64_FLIP_PAGE_OFFSET_ACTUAL ((0xffffffffffffffffUL) \
                                        - ((1UL) << 
machdep->machspec->VA_BITS_ACTUAL) + 1)
 
 #define ARM64_USERSPACE_TOP  ((1UL) << machdep->machspec->VA_BITS)
-- 
2.33.1

++++++ 0008-arm64-assign-page_offset-with-VA_BITS-kernel-configu.patch ++++++
>From 167d37e347fe35c6f7db826e8539e192c4375564 Mon Sep 17 00:00:00 2001
From: Pingfan Liu <pi...@redhat.com>
Date: Fri, 2 Jul 2021 10:14:22 +0800
Subject: [PATCH] arm64: assign page_offset with VA_BITS kernel configuration
 value

On RHEL9, crash hits a bug when executing "crash /proc/kcore":
seek error: kernel virtual address: ffff6a0f3fff0000 type: "pmd page"

The kernel virtual address does not vary with vabits_actual, instead,
is determined by configuration value. But crash does not observe this
fact.

Since vabits_actual related kernel commit is introduced after arm64
mm layout flip commit, so changes are safe under the condition if
(ms->VA_BITS_ACTUAL), and keep the else branch untouched.

Signed-off-by: Pingfan Liu <pi...@redhat.com>
---
 arm64.c | 7 ++++---
 defs.h  | 1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arm64.c b/arm64.c
index 9fe1a4a..149db36 100644
--- a/arm64.c
+++ b/arm64.c
@@ -220,9 +220,10 @@ arm64_init(int when)
 
                /* vabits_actual introduced after mm flip, so it should be 
flipped layout */
                if (ms->VA_BITS_ACTUAL) {
-                       ms->page_offset = ARM64_FLIP_PAGE_OFFSET_ACTUAL;
-                       machdep->identity_map_base = 
ARM64_FLIP_PAGE_OFFSET_ACTUAL;
-                       machdep->kvbase = ARM64_FLIP_PAGE_OFFSET_ACTUAL;
+                       ms->page_offset = ARM64_FLIP_PAGE_OFFSET;
+                       /* useless on arm64 */
+                       machdep->identity_map_base = ARM64_FLIP_PAGE_OFFSET;
+                       machdep->kvbase = ARM64_FLIP_PAGE_OFFSET;
                        ms->userspace_top = ARM64_USERSPACE_TOP_ACTUAL;
                } else {
                        ms->page_offset = ARM64_PAGE_OFFSET;
diff --git a/defs.h b/defs.h
index eb7ce6a..b7b20af 100644
--- a/defs.h
+++ b/defs.h
@@ -3234,6 +3234,7 @@ typedef signed int s32;
 #define ARM64_PAGE_OFFSET    ((0xffffffffffffffffUL) \
                                        << (machdep->machspec->VA_BITS - 1))
 /* kernels >= v5.4 the kernel VA space is flipped */
+#define ARM64_FLIP_PAGE_OFFSET (-(1UL) << 
machdep->machspec->CONFIG_ARM64_VA_BITS)
 #define ARM64_FLIP_PAGE_OFFSET_ACTUAL ((0xffffffffffffffffUL) \
                                        - ((1UL) << 
machdep->machspec->VA_BITS_ACTUAL) + 1)
 
-- 
2.33.1

++++++ 0009-arm64-use-dedicated-bits-to-record-the-VA-space-layo.patch ++++++
>From bf1379a8b6ff8d6a8fa12978f7194f15f85c4380 Mon Sep 17 00:00:00 2001
From: Pingfan Liu <pi...@redhat.com>
Date: Fri, 2 Jul 2021 10:14:23 +0800
Subject: [PATCH] arm64: use dedicated bits to record the VA space layout
 changes

arm64 memory layout experiences big changes due to the following kernel
commits in date descending order:
  5. 7bc1a0f9e176 arm64: mm: use single quantity to represent the PA to VA 
translation
  4. b6d00d47e81a arm64: mm: Introduce 52-bit Kernel VAs
  3. 5383cc6efed1 arm64: mm: Introduce vabits_actual
  2. 14c127c957c1 arm64: mm: Flip kernel VA space
  1. f80fb3a3d508 arm64: add support for kernel ASLR

For 1, crash has already used NEW_VMEMMAP to trace it.
For 2, crash lacks a flag to tag it and handle it differently.
For 3, two important kernel variables vabits_actual and physvirt_offset
are introduced.
For 4, since it comes immediately after 3, crash-utility does not need
to distinguish it.
For 5, kernel variable phyvirt_offset is removed

These changes have effects on PTOV()/VTOP() formula. So introducing
two bits HAS_PHYSVIRT_OFFSET and FLIPPED_VM as hint to apply different
formula.

Signed-off-by: Pingfan Liu <pi...@redhat.com>
---
 arm64.c | 10 ++++++++++
 defs.h  |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/arm64.c b/arm64.c
index 149db36..b04369f 100644
--- a/arm64.c
+++ b/arm64.c
@@ -563,6 +563,10 @@ arm64_dump_machdep_table(ulong arg)
                fprintf(fp, "%sMACHDEP_BT_TEXT", others++ ? "|" : "");
        if (machdep->flags & NEW_VMEMMAP)
                fprintf(fp, "%sNEW_VMEMMAP", others++ ? "|" : "");
+       if (machdep->flags & FLIPPED_VM)
+               fprintf(fp, "%sFLIPPED_VM", others++ ? "|" : "");
+       if (machdep->flags & HAS_PHYSVIRT_OFFSET)
+               fprintf(fp, "%sHAS_PHYSVIRT_OFFSET", others++ ? "|" : "");
        fprintf(fp, ")\n");
 
        fprintf(fp, "              kvbase: %lx\n", machdep->kvbase);
@@ -997,6 +1001,7 @@ arm64_calc_physvirt_offset(void)
                if (READMEM(pc->mfd, &physvirt_offset, sizeof(physvirt_offset),
                        sp->value, sp->value -
                        machdep->machspec->kimage_voffset) > 0) {
+                               machdep->flags |= HAS_PHYSVIRT_OFFSET;
                                ms->physvirt_offset = physvirt_offset;
                }
        }
@@ -3963,6 +3968,11 @@ arm64_calc_VA_BITS(void)
                                error(FATAL, "cannot determine 
VA_BITS_ACTUAL\n");
                }
 
+               /*
+                * The mm flip commit is introduced before 52-bits VA, which is 
before the
+                * commit to export NUMBER(TCR_EL1_T1SZ)
+                */
+               machdep->flags |= FLIPPED_VM;
                return;
        }
 
diff --git a/defs.h b/defs.h
index b7b20af..eca145c 100644
--- a/defs.h
+++ b/defs.h
@@ -3214,6 +3214,8 @@ typedef signed int s32;
 #define NEW_VMEMMAP   (0x80)
 #define VM_L4_4K      (0x100)
 #define UNW_4_14      (0x200)
+#define FLIPPED_VM    (0x400)
+#define HAS_PHYSVIRT_OFFSET (0x800)
 
 /*
  * Get kimage_voffset from /dev/crash
-- 
2.33.1

++++++ 0010-arm64-implement-switchable-PTOV-VTOP-for-kernels-5.1.patch ++++++
>From f53b73e8380bca054cebd2b61ff118c46609429b Mon Sep 17 00:00:00 2001
From: Pingfan Liu <pi...@redhat.com>
Date: Fri, 2 Jul 2021 10:14:24 +0800
Subject: [PATCH] arm64: implement switchable PTOV()/VTOP() for kernels >= 5.10

Crash encounters a bug like the following:
    ...
    SECTION_SIZE_BITS: 30
    CONFIG_ARM64_VA_BITS: 52
          VA_BITS_ACTUAL: 48
    (calculated) VA_BITS: 48
     PAGE_OFFSET: ffff000000000000
        VA_START: ffff800000000000
         modules: ffff800008000000 - ffff80000fffffff
         vmalloc: ffff800010000000 - ffffffdfdffeffff
    kernel image: ffff800010000000 - ffff800012750000
         vmemmap: ffffffdfffe00000 - ffffffffffffffff

    <readmem: ffff800011c53bc8, KVADDR, "nr_irqs", 4, (FOE), b47bdc>
    <read_kdump: addr: ffff800011c53bc8 paddr: eb453bc8 cnt: 4>
    read_netdump: addr: ffff800011c53bc8 paddr: eb453bc8 cnt: 4 offset: 1c73bc8
    irq_stack_ptr:
      type: 1, TYPE_CODE_PTR
      target_typecode: 8, TYPE_CODE_INT
      target_length: 8
      length: 8
    GNU_GET_DATATYPE[thread_union]: returned via gdb_error_hook
    <readmem: ffff000b779c0050, KVADDR, "IRQ stack pointer", 8, (ROE), 3a37bea0>
    <read_kdump: addr: ffff000b779c0050 paddr: fff1000bf79c0050 cnt: 8>
    read_netdump: READ_ERROR: offset not found for paddr: fff1000bf79c0050
    crash: read error: kernel virtual address: ffff000b779c0050  type: "IRQ 
stack pointer"
    ...

Apparently, for a normal system, the 'paddr: fff1000bf79c0050' is
unreasonable.

This bug connects with kernel commit 7bc1a0f9e176 ("arm64: mm: use
single quantity to represent the PA to VA translation"), which removed
physvirt_offset kernel variable and changed the PTOV()/VTOP() formulas.

Implement switchable PTOV()/VTOP() to cope with different kernel
version.

Signed-off-by: Pingfan Liu <pi...@redhat.com>
---
 arm64.c | 37 +++++++++++++++++++++++++++++++++----
 defs.h  |  9 ++++-----
 2 files changed, 37 insertions(+), 9 deletions(-)

diff --git a/arm64.c b/arm64.c
index b04369f..d73d5c5 100644
--- a/arm64.c
+++ b/arm64.c
@@ -994,8 +994,6 @@ arm64_calc_physvirt_offset(void)
        ulong physvirt_offset;
        struct syment *sp;
 
-       ms->physvirt_offset = ms->phys_offset - ms->page_offset;
-
        if ((sp = kernel_symbol_search("physvirt_offset")) &&
                        machdep->machspec->kimage_voffset) {
                if (READMEM(pc->mfd, &physvirt_offset, sizeof(physvirt_offset),
@@ -1003,8 +1001,13 @@ arm64_calc_physvirt_offset(void)
                        machdep->machspec->kimage_voffset) > 0) {
                                machdep->flags |= HAS_PHYSVIRT_OFFSET;
                                ms->physvirt_offset = physvirt_offset;
+                               return;
                }
        }
+
+       /* Useless if no symbol 'physvirt_offset', just keep semantics */
+       ms->physvirt_offset = ms->phys_offset - ms->page_offset;
+
 }
 
 static void
@@ -1051,6 +1054,7 @@ arm64_calc_phys_offset(void)
                        if (READMEM(pc->mfd, &phys_offset, sizeof(phys_offset),
                            vaddr, paddr) > 0) {
                                ms->phys_offset = phys_offset;
+
                                return;
                        }
                }
@@ -1178,6 +1182,21 @@ arm64_init_kernel_pgd(void)
                 vt->kernel_pgd[i] = value;
 }
 
+ulong arm64_PTOV(ulong paddr)
+{
+       struct machine_specific *ms = machdep->machspec;
+
+       /*
+        * Either older kernel before kernel has 'physvirt_offset' or newer
+        * kernel which removes 'physvirt_offset' has the same formula:
+        * #define __phys_to_virt(x)   ((unsigned long)((x) - PHYS_OFFSET) | 
PAGE_OFFSET)
+        */
+       if (!(machdep->flags & HAS_PHYSVIRT_OFFSET))
+               return (paddr - ms->phys_offset) | PAGE_OFFSET;
+       else
+               return paddr - ms->physvirt_offset;
+}
+
 ulong
 arm64_VTOP(ulong addr)
 {
@@ -1188,8 +1207,18 @@ arm64_VTOP(ulong addr)
                        return addr - machdep->machspec->kimage_voffset;
                }
 
-               if (addr >= machdep->machspec->page_offset)
-                       return addr + machdep->machspec->physvirt_offset;
+               if (addr >= machdep->machspec->page_offset) {
+                       if (machdep->flags & HAS_PHYSVIRT_OFFSET) {
+                               return addr + 
machdep->machspec->physvirt_offset;
+                       } else {
+                               /*
+                                * Either older kernel before kernel has 
'physvirt_offset' or newer
+                                * kernel which removes 'physvirt_offset' has 
the same formula:
+                                * #define __lm_to_phys(addr)   (((addr) & 
~PAGE_OFFSET) + PHYS_OFFSET)
+                                */
+                               return (addr & ~PAGE_OFFSET) + 
machdep->machspec->phys_offset;
+                       }
+               }
                else if (machdep->machspec->kimage_voffset)
                        return addr - machdep->machspec->kimage_voffset;
                else /* no randomness */
diff --git a/defs.h b/defs.h
index eca145c..c91177a 100644
--- a/defs.h
+++ b/defs.h
@@ -3092,11 +3092,6 @@ typedef u64 pte_t;
 #define _64BIT_
 #define MACHINE_TYPE       "ARM64"    
 
-#define PTOV(X) \
-       ((unsigned long)(X) - (machdep->machspec->physvirt_offset))
-
-#define VTOP(X)               arm64_VTOP((ulong)(X))
-
 #define USERSPACE_TOP   (machdep->machspec->userspace_top)
 #define PAGE_OFFSET     (machdep->machspec->page_offset)
 #define VMALLOC_START   (machdep->machspec->vmalloc_start_addr)
@@ -3106,6 +3101,9 @@ typedef u64 pte_t;
 #define MODULES_VADDR   (machdep->machspec->modules_vaddr)
 #define MODULES_END     (machdep->machspec->modules_end)
 
+#define PTOV(X)        arm64_PTOV((ulong)(X))
+#define VTOP(X)        arm64_VTOP((ulong)(X))
+
 #define IS_VMALLOC_ADDR(X)    arm64_IS_VMALLOC_ADDR((ulong)(X))
 
 #define PAGEBASE(X)     (((ulong)(X)) & (ulong)machdep->pagemask)
@@ -5910,6 +5908,7 @@ void unwind_backtrace(struct bt_info *);
 void arm64_init(int);
 void arm64_dump_machdep_table(ulong);
 ulong arm64_VTOP(ulong);
+ulong arm64_PTOV(ulong);
 int arm64_IS_VMALLOC_ADDR(ulong);
 ulong arm64_swp_type(ulong);
 ulong arm64_swp_offset(ulong);
-- 
2.33.1

++++++ 0011-diskdump-Fail-readmem-early-if-dump-is-incomplete.patch ++++++
>From 4631320e96f8a63c897fbbce4e87e3c47af40bc9 Mon Sep 17 00:00:00 2001
From: Roman Bolshakov <r.bolsha...@yadro.com>
Date: Thu, 17 Jun 2021 02:27:32 +0300
Subject: [PATCH] diskdump: Fail readmem() early if dump is incomplete

kdump format description [1] says:

   [...] zero page has its own offset not equal 0. So when reading page
   from incomplete core, only the page lost by ENOSPACE errors has 0 in its
   corresponding page descriptor's member offset.

crash has special treatment for page descriptors with zero offset only if
DUMP_DH_COMPRESSED_INCOMPLETE is set in dump header. However,
makedumpfile places the flag after ENOSPC is hit and only if dump header
modification went without errors.

In case if crashkernel environment was terminated early (e.g. by BMC) or
some other reason, DUMP_DH_COMPRESSED_INCOMPLETE won't be set on the
dump header. Then cache_page() would be performed on pages with
pd.offset == 0 and due to pd.size == 0 it'll skip read into
compressed_page and then non related pre-existing contents of
compressed_page will copied into page cache for the non-present page.

Ultimately, it'll lead to a cryptic failure, like:

  crash: invalid kernel virtual address: 72288cacacf427f8 [...]

The failure would be a bit cleaner if crash explicitly fails on the page
that is an outcome of incomplete dump:

  crash: page incomplete: kernel virtual address: c000003fff9d17e8 [...]

Debugging level 8 would also produce exact offset from data_offset to
print descriptor value with ease:

  read_diskdump/cache_page: descriptor with zero offset found at paddr/pfn/pos: 
3fff9d0000/3fff9d/743dd

That helps in inspecting broken descriptor with hexdump or similar tools:

  hexdump -s (data_offset + pos * 0x18) -n 0x18

[1] https://github.com/makedumpfile/makedumpfile/blob/master/IMPLEMENTATION

Signed-off-by: Roman Bolshakov <r.bolsha...@yadro.com>
---
 defs.h     |  1 +
 diskdump.c | 16 +++++++++++-----
 memory.c   |  7 +++++++
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/defs.h b/defs.h
index c91177a..eb1c71b 100644
--- a/defs.h
+++ b/defs.h
@@ -361,6 +361,7 @@ struct number_option {
 #define READ_ERROR       (-2)
 #define WRITE_ERROR      (-3)
 #define PAGE_EXCLUDED    (-4)
+#define PAGE_INCOMPLETE  (-5)
 
 #define RESTART()         (longjmp(pc->main_loop_env, 1))
 #define RESUME_FOREACH()  (longjmp(pc->foreach_loop_env, 1))
diff --git a/diskdump.c b/diskdump.c
index 6680695..59b79e1 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -1146,10 +1146,9 @@ cache_page(physaddr_t paddr)
        if (FLAT_FORMAT()) {
                if (!read_flattened_format(dd->dfd, pd.offset, 
dd->compressed_page, pd.size))
                        return READ_ERROR;
-       } else if (is_incomplete_dump() && (0 == pd.offset)) {
+       } else if (0 == pd.offset) {
                /*
-                *  If the incomplete flag has been set in the header, 
-                *  first check whether zero_excluded has been set.
+                *  First check whether zero_excluded has been set.
                 */
                if (*diskdump_flags & ZERO_EXCLUDED) {
                        if (CRASHDEBUG(8))
@@ -1158,8 +1157,15 @@ cache_page(physaddr_t paddr)
                                    "paddr/pfn: %llx/%lx\n", 
                                        (ulonglong)paddr, pfn);
                        memset(dd->compressed_page, 0, dd->block_size);
-               } else
-                       return READ_ERROR;
+               } else {
+                       if (CRASHDEBUG(8))
+                               fprintf(fp,
+                                       "read_diskdump/cache_page: "
+                                       "descriptor with zero offset found at "
+                                       "paddr/pfn/pos: %llx/%lx/%lx\n",
+                                       (ulonglong)paddr, pfn, desc_pos);
+                       return PAGE_INCOMPLETE;
+               }
        } else {
                if (lseek(dd->dfd, pd.offset, SEEK_SET) == failed)
                        return SEEK_ERROR;
diff --git a/memory.c b/memory.c
index ca4c633..86c02c1 100644
--- a/memory.c
+++ b/memory.c
@@ -2213,6 +2213,7 @@ accessible(ulong kva)
 #define READ_ERRMSG      "read error: %s address: %llx  type: \"%s\"\n"
 #define WRITE_ERRMSG     "write error: %s address: %llx  type: \"%s\"\n"
 #define PAGE_EXCLUDED_ERRMSG  "page excluded: %s address: %llx  type: \"%s\"\n"
+#define PAGE_INCOMPLETE_ERRMSG  "page incomplete: %s address: %llx  type: 
\"%s\"\n"
 
 #define RETURN_ON_PARTIAL_READ() \
        if ((error_handle & RETURN_PARTIAL) && (size < orig_size)) {            
\
@@ -2378,6 +2379,12 @@ readmem(ulonglong addr, int memtype, void *buffer, long 
size,
                                error(INFO, PAGE_EXCLUDED_ERRMSG, 
memtype_string(memtype, 0), addr, type);
                         goto readmem_error;
 
+               case PAGE_INCOMPLETE:
+                       RETURN_ON_PARTIAL_READ();
+                       if (PRINT_ERROR_MESSAGE)
+                               error(INFO, PAGE_INCOMPLETE_ERRMSG, 
memtype_string(memtype, 0), addr, type);
+                       goto readmem_error;
+
                default:
                        break;
                }
-- 
2.33.1

++++++ 0012-netdump-Permit-zero_excluded-for-incomplete-ELF-dump.patch ++++++
>From 41cda195c6421fbde72ed67b32b8c1ab3eb0c56f Mon Sep 17 00:00:00 2001
From: Roman Bolshakov <r.bolsha...@yadro.com>
Date: Thu, 17 Jun 2021 02:27:33 +0300
Subject: [PATCH] netdump: Permit --zero_excluded for incomplete ELF dumps

DUMP_ELF_INCOMPLETE is set very late after ENOSPC error is hit by
makedumpfile. Any following error that prevents modification of ELF
header would result in effectively incomplete core that doesn't have the
flag. zero_excluded flag doesn't work for such kind of incomplete core.

Signed-off-by: Roman Bolshakov <r.bolsha...@yadro.com>
---
 netdump.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/netdump.c b/netdump.c
index aaea945..e8721d8 100644
--- a/netdump.c
+++ b/netdump.c
@@ -819,10 +819,9 @@ read_netdump(int fd, void *bufptr, int cnt, ulong addr, 
physaddr_t paddr)
                read_ret = read(nd->ndfd, bufptr, cnt);
                if (read_ret != cnt) {
                        /*
-                        *  If the incomplete flag has been set in the header, 
-                        *  first check whether zero_excluded has been set.
+                        *  First check whether zero_excluded has been set.
                         */
-                       if (is_incomplete_dump() && (read_ret >= 0) &&
+                       if ((read_ret >= 0) &&
                            (*diskdump_flags & ZERO_EXCLUDED)) {
                                if (CRASHDEBUG(8))
                                        fprintf(fp, "read_netdump: zero-fill: "
-- 
2.33.1

++++++ 0013-diskdump-Print-total-number-of-dumpable-pages.patch ++++++
>From 1425b0504b1e79d88a2d188d7e4c0e7fceba4501 Mon Sep 17 00:00:00 2001
From: Roman Bolshakov <r.bolsha...@yadro.com>
Date: Thu, 17 Jun 2021 02:27:34 +0300
Subject: [PATCH] diskdump: Print total number of dumpable pages

It's not clear how broken an incomplete dump from the existing debugging
prints. Aggregate number of valid pages helps to figure out approximate
size of the dump. Size of a complete dump is roughly:

  EXPECTED_CORE_SIZE = a few pages (kdump headers + bitmaps + descriptors) +
                       (total_valid_pages * block_size) * compression rate

An incomplete core would be significantly smaller than:

        total_valid_pages * block_size

Signed-off-by: Roman Bolshakov <r.bolsha...@yadro.com>
---
 diskdump.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/diskdump.c b/diskdump.c
index 59b79e1..0f94022 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -74,6 +74,7 @@ struct diskdump_data {
        ulong   evictions;              /* total evictions done */
        ulong   cached_reads;
        ulong  *valid_pages;
+       int     max_sect_len;           /* highest bucket of valid_pages */
        ulong   accesses;
        ulong   snapshot_task;
 };
@@ -877,6 +878,7 @@ restart:
        }
 
        dd->valid_pages = calloc(sizeof(ulong), max_sect_len + 1);
+       dd->max_sect_len = max_sect_len;
        for (i = 1; i < max_sect_len + 1; i++) {
                dd->valid_pages[i] = dd->valid_pages[i - 1];
                for (j = 0; j < BITMAP_SECT_LEN; j++, pfn++)
@@ -2089,6 +2091,7 @@ __diskdump_memory_dump(FILE *fp)
        else
                fprintf(fp, "\n");
        fprintf(fp, "       valid_pages: %lx\n", (ulong)dd->valid_pages);
+       fprintf(fp, " total_valid_pages: %ld\n", 
dd->valid_pages[dd->max_sect_len]);
 
        return 0;
 }
-- 
2.33.1

++++++ 0014-diskdump-Introduce-read_pd.patch ++++++
>From 881f33d97cee9895796829d0cc969b51dd34d831 Mon Sep 17 00:00:00 2001
From: Roman Bolshakov <r.bolsha...@yadro.com>
Date: Thu, 17 Jun 2021 02:27:35 +0300
Subject: [PATCH] diskdump: Introduce read_pd()

Standalone function for reading of page descriptors is needed later for
of expected core size and detection of incomplete dumps.

Signed-off-by: Roman Bolshakov <r.bolsha...@yadro.com>
---
 diskdump.c | 33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

diff --git a/diskdump.c b/diskdump.c
index 0f94022..de3eeb2 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -510,6 +510,27 @@ arm_kdump_header_adjust(int header_version)
 }
 #endif  /* __i386__ && (ARM || MIPS) */
 
+/*
+ * Read page descriptor.
+ */
+static int
+read_pd(int fd, off_t offset, page_desc_t *pd)
+{
+       const off_t failed = (off_t)-1;
+
+       if (FLAT_FORMAT()) {
+               if (!read_flattened_format(fd, offset, pd, sizeof(*pd)))
+                       return READ_ERROR;
+       } else {
+               if (lseek(fd, offset, SEEK_SET) == failed)
+                       return SEEK_ERROR;
+               if (read(fd, pd, sizeof(*pd)) != sizeof(*pd))
+                       return READ_ERROR;
+       }
+
+       return 0;
+}
+
 static int 
 read_dump_header(char *file)
 {
@@ -1130,15 +1151,9 @@ cache_page(physaddr_t paddr)
                        + (off_t)(desc_pos - 1)*sizeof(page_desc_t);
 
        /* read page descriptor */
-       if (FLAT_FORMAT()) {
-               if (!read_flattened_format(dd->dfd, seek_offset, &pd, 
sizeof(pd)))
-                       return READ_ERROR;
-       } else {
-               if (lseek(dd->dfd, seek_offset, SEEK_SET) == failed)
-                       return SEEK_ERROR;
-               if (read(dd->dfd, &pd, sizeof(pd)) != sizeof(pd))
-                       return READ_ERROR;
-       }
+       ret = read_pd(dd->dfd, seek_offset, &pd);
+       if (ret)
+               return ret;
 
        /* sanity check */
        if (pd.size > block_size)
-- 
2.33.1

++++++ 0015-x86_64-Fix-check-for-__per_cpu_offset-initialization.patch ++++++
>From 44e5801d9016987b6b4ebd571bfde8ae3e75da7b Mon Sep 17 00:00:00 2001
From: Philipp Rudo <pr...@redhat.com>
Date: Thu, 5 Aug 2021 15:19:37 +0200
Subject: [PATCH] x86_64: Fix check for __per_cpu_offset initialization

Since at least kernel v2.6.30 the __per_cpu_offset gets initialized to
__per_cpu_load.  So first check if the __per_cpu_offset was set to a
proper value before reading any per cpu variable to prevent potential
bugs.

[ kh: added check for the existence of __per_cpu_load ]

Signed-off-by: Philipp Rudo <pr...@redhat.com>
Signed-off-by: Kazuhito Hagio <k-hagio...@nec.com>
---
 x86_64.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/x86_64.c b/x86_64.c
index 6eb7d67..87cbeae 100644
--- a/x86_64.c
+++ b/x86_64.c
@@ -1285,6 +1285,7 @@ x86_64_per_cpu_init(void)
        struct machine_specific *ms;
        struct syment *irq_sp, *curr_sp, *cpu_sp, *hardirq_stack_ptr_sp;
        ulong hardirq_stack_ptr;
+       ulong __per_cpu_load = 0;
 
        ms = machdep->machspec;
 
@@ -1326,7 +1327,12 @@ x86_64_per_cpu_init(void)
        else if (!ms->stkinfo.isize)
                ms->stkinfo.isize = 16384;
 
+       if (kernel_symbol_exists("__per_cpu_load"))
+               __per_cpu_load = symbol_value("__per_cpu_load");
+
        for (i = cpus = 0; i < NR_CPUS; i++) {
+               if (__per_cpu_load && kt->__per_cpu_offset[i] == __per_cpu_load)
+                       break;
                if (!readmem(cpu_sp->value + kt->__per_cpu_offset[i],
                    KVADDR, &cpunumber, sizeof(int),
                    "cpu number (per_cpu)", QUIET|RETURN_ON_ERROR))
@@ -5595,14 +5601,18 @@ x86_64_get_smp_cpus(void)
        char *cpu_pda_buf;
        ulong level4_pgt, cpu_pda_addr;
        struct syment *sp;
+       ulong __per_cpu_load = 0;
 
        if (!VALID_STRUCT(x8664_pda)) {
                if (!(sp = per_cpu_symbol_search("per_cpu__cpu_number")) ||
                    !(kt->flags & PER_CPU_OFF))
                        return 1;
 
+               if (kernel_symbol_exists("__per_cpu_load"))
+                       __per_cpu_load = symbol_value("__per_cpu_load");
+
                for (i = cpus = 0; i < NR_CPUS; i++) {
-                       if (kt->__per_cpu_offset[i] == 0)
+                       if (__per_cpu_load && kt->__per_cpu_offset[i] == 
__per_cpu_load)
                                break;
                        if (!readmem(sp->value + kt->__per_cpu_offset[i], 
                            KVADDR, &cpunumber, sizeof(int),
-- 
2.33.1

++++++ 0016-arm64-Get-CPU-registers-from-ELF-notes-even-without-.patch ++++++
>From 4b34197508578bb43639e6d169fb91fb0489fa2b Mon Sep 17 00:00:00 2001
From: James Hsu <james....@mediatek.com>
Date: Wed, 18 Aug 2021 15:45:47 +0800
Subject: [PATCH] arm64: Get CPU registers from ELF notes even without
 crash_notes symbol

Currently arm64 crash retrieves the CPU registers from crash_notes symbol
or ELF notes only when the symbol exists, but there are dumpfiles which
have the registers in ELF notes without the symbol.

With the patch, crash can retrieve the registers from ELF notes without
the crash_notes symbol.

Signed-off-by: James Hsu <james....@mediatek.com>
Signed-off-by: Kazuhito Hagio <k-hagio...@nec.com>
---
 arm64.c | 38 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/arm64.c b/arm64.c
index d73d5c5..7069312 100644
--- a/arm64.c
+++ b/arm64.c
@@ -3698,14 +3698,48 @@ arm64_get_crash_notes(void)
 {
        struct machine_specific *ms = machdep->machspec;
        ulong crash_notes;
-       Elf64_Nhdr *note;
+       Elf64_Nhdr *note = NULL;
        ulong offset;
        char *buf, *p;
        ulong *notes_ptrs;
        ulong i, found;
 
-       if (!symbol_exists("crash_notes"))
+       if (!symbol_exists("crash_notes")) {
+               if (DISKDUMP_DUMPFILE() || KDUMP_DUMPFILE()) {
+                       if (!(ms->panic_task_regs = calloc((size_t)kt->cpus, 
sizeof(struct arm64_pt_regs))))
+                               error(FATAL, "cannot calloc panic_task_regs 
space\n");
+
+                       for  (i = found = 0; i < kt->cpus; i++) {
+                               if (DISKDUMP_DUMPFILE())
+                                       note = diskdump_get_prstatus_percpu(i);
+                               else if (KDUMP_DUMPFILE())
+                                       note = netdump_get_prstatus_percpu(i);
+
+                               if (!note) {
+                                       error(WARNING, "cpu %d: cannot find 
NT_PRSTATUS note\n", i);
+                                       continue;
+                               }
+
+                               /*
+                                * Find correct location of note data. This 
contains elf_prstatus
+                                * structure which has registers etc. for the 
crashed task.
+                                */
+                               offset = sizeof(Elf64_Nhdr);
+                               offset = roundup(offset + note->n_namesz, 4);
+                               p = (char *)note + offset; /* start of 
elf_prstatus */
+
+                               BCOPY(p + OFFSET(elf_prstatus_pr_reg), 
&ms->panic_task_regs[i],
+                                     sizeof(struct arm64_pt_regs));
+
+                               found++;
+                       }
+                       if (!found) {
+                               free(ms->panic_task_regs);
+                               ms->panic_task_regs = NULL;
+                       }
+               }
                return;
+       }
 
        crash_notes = symbol_value("crash_notes");
 
-- 
2.33.1

++++++ 0017-ppc64-Add-MMU-type-info-in-machdep-command.patch ++++++
>From 15765867c0f1d937db5ec06f51adb6bfd13354ea Mon Sep 17 00:00:00 2001
From: Ritesh Harjani <rite...@linux.ibm.com>
Date: Thu, 26 Aug 2021 02:31:10 +0530
Subject: [PATCH] ppc64: Add MMU type info in machdep command

This adds MMU type info in "machdep" command.

Signed-off-by: Ritesh Harjani <rite...@linux.ibm.com>
---
 ppc64.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ppc64.c b/ppc64.c
index f368bf8..975caa5 100644
--- a/ppc64.c
+++ b/ppc64.c
@@ -3027,6 +3027,8 @@ ppc64_display_machine_stats(void)
         else
                 fprintf(fp, "(unknown)\n");
         fprintf(fp, "                 HZ: %d\n", machdep->hz);
+       fprintf(fp, "                MMU: %s\n", machdep->flags & RADIX_MMU
+                                                       ? "RADIX" : "HASH");
         fprintf(fp, "          PAGE SIZE: %d\n", PAGESIZE());
 //      fprintf(fp, "      L1 CACHE SIZE: %d\n", l1_cache_size());
         fprintf(fp, "KERNEL VIRTUAL BASE: %lx\n", machdep->kvbase);
-- 
2.33.1

++++++ 0018-diskdump-Add-support-for-reading-dumpfiles-compresse.patch ++++++
>From 7f38d1baf794823355ee100b3a1914155d4190f2 Mon Sep 17 00:00:00 2001
From: Kazuhito Hagio <k-hagio...@nec.com>
Date: Mon, 27 Sep 2021 09:45:42 +0900
Subject: [PATCH] diskdump: Add support for reading dumpfiles compressed by
 Zstandard

Add support for reading dumpfiles compressed by Zstandard (zstd)
using makedumpfile.

To build crash with zstd support, type "make zstd".

Signed-off-by: Kazuhito Hagio <k-hagio...@nec.com>
---
 Makefile    |  4 ++++
 README      |  4 ++--
 configure.c | 24 +++++++++++++++++++++---
 defs.h      |  4 ++++
 diskdump.c  | 37 +++++++++++++++++++++++++++++++++++++
 diskdump.h  |  1 +
 help.c      |  4 ++--
 7 files changed, 71 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index ece1306..eae023c 100644
--- a/Makefile
+++ b/Makefile
@@ -333,6 +333,10 @@ snappy: make_configure
        @./configure -x snappy ${CONF_TARGET_FLAG} -w -b
        @make --no-print-directory gdb_merge
 
+zstd: make_configure
+       @./configure -x zstd ${CONF_TARGET_FLAG} -w -b
+       @make --no-print-directory gdb_merge
+
 valgrind: make_configure
        @./configure -x valgrind ${CONF_TARGET_FLAG} -w -b
        @make --no-print-directory gdb_merge
diff --git a/README b/README
index 5017974..4962f27 100644
--- a/README
+++ b/README
@@ -102,8 +102,8 @@
   Traditionally when vmcores are compressed via the makedumpfile(8) facility
   the libz compression library is used, and by default the crash utility
   only supports libz.  Recently makedumpfile has been enhanced to optionally
-  use either the LZO or snappy compression libraries.  To build crash with
-  either or both of those libraries, type "make lzo" or "make snappy".
+  use the LZO, snappy or zstd compression libraries.  To build crash with any
+  or all of those libraries, type "make lzo", "make snappy" or "make zstd".
 
   crash supports valgrind Memcheck tool on the crash's custom memory allocator.
   To build crash with this feature enabled, type "make valgrind" and then run
diff --git a/configure.c b/configure.c
index e8f619a..b691a13 100644
--- a/configure.c
+++ b/configure.c
@@ -1738,6 +1738,10 @@ get_extra_flags(char *filename, char *initial)
  *    - enter -DSNAPPY in the CFLAGS.extra file
  *    - enter -lsnappy in the LDFLAGS.extra file
  *
+ *  For zstd:
+ *    - enter -DZSTD in the CFLAGS.extra file
+ *    - enter -lzstd in the LDFLAGS.extra file
+ *
  *  For valgrind:
  *    - enter -DVALGRIND in the CFLAGS.extra file
  */
@@ -1746,6 +1750,7 @@ add_extra_lib(char *option)
 {
        int lzo, add_DLZO, add_llzo2; 
        int snappy, add_DSNAPPY, add_lsnappy;
+       int zstd, add_DZSTD, add_lzstd;
        int valgrind, add_DVALGRIND;
        char *cflags, *ldflags;
        FILE *fp_cflags, *fp_ldflags;
@@ -1754,6 +1759,7 @@ add_extra_lib(char *option)
 
        lzo = add_DLZO = add_llzo2 = 0;
        snappy = add_DSNAPPY = add_lsnappy = 0;
+       zstd = add_DZSTD = add_lzstd = 0;
        valgrind = add_DVALGRIND = 0;
 
        ldflags = get_extra_flags("LDFLAGS.extra", NULL);
@@ -1775,13 +1781,21 @@ add_extra_lib(char *option)
                        add_lsnappy++;
        }
 
+       if (strcmp(option, "zstd") == 0) {
+               zstd++;
+               if (!cflags || !strstr(cflags, "-DZSTD"))
+                       add_DZSTD++;
+               if (!ldflags || !strstr(ldflags, "-lzstd"))
+                       add_lzstd++;
+       }
+
        if (strcmp(option, "valgrind") == 0) {
                valgrind++;
                if (!cflags || !strstr(cflags, "-DVALGRIND"))
                        add_DVALGRIND++;
        }
 
-       if ((lzo || snappy) &&
+       if ((lzo || snappy || zstd) &&
            file_exists("diskdump.o") && (unlink("diskdump.o") < 0)) {
                perror("diskdump.o");
                return;
@@ -1806,24 +1820,28 @@ add_extra_lib(char *option)
                return;
        }
 
-       if (add_DLZO || add_DSNAPPY || add_DVALGRIND) {
+       if (add_DLZO || add_DSNAPPY || add_DZSTD || add_DVALGRIND) {
                while (fgets(inbuf, 512, fp_cflags))
                        ;
                if (add_DLZO)
                        fputs("-DLZO\n", fp_cflags);
                if (add_DSNAPPY)
                        fputs("-DSNAPPY\n", fp_cflags);
+               if (add_DZSTD)
+                       fputs("-DZSTD\n", fp_cflags);
                if (add_DVALGRIND)
                        fputs("-DVALGRIND\n", fp_cflags);
        }
 
-       if (add_llzo2 || add_lsnappy) {
+       if (add_llzo2 || add_lsnappy || add_lzstd) {
                while (fgets(inbuf, 512, fp_ldflags))
                        ;
                if (add_llzo2)
                        fputs("-llzo2\n", fp_ldflags);
                if (add_lsnappy)
                        fputs("-lsnappy\n", fp_ldflags);
+               if (add_lzstd)
+                       fputs("-lzstd\n", fp_ldflags);
        }
 
        fclose(fp_cflags);
diff --git a/defs.h b/defs.h
index eb1c71b..b2e9472 100644
--- a/defs.h
+++ b/defs.h
@@ -54,6 +54,9 @@
 #ifdef SNAPPY
 #include <snappy-c.h>
 #endif
+#ifdef ZSTD
+#include <zstd.h>
+#endif
 
 #ifndef ATTRIBUTE_UNUSED
 #define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
@@ -327,6 +330,7 @@ struct number_option {
 #define NO_ELF_NOTES        (0x20)
 #define LZO_SUPPORTED       (0x40)
 #define SNAPPY_SUPPORTED    (0x80)
+#define ZSTD_SUPPORTED      (0x100)
 #define DISKDUMP_VALID()    (dd->flags & DISKDUMP_LOCAL)
 #define KDUMP_CMPRS_VALID() (dd->flags & KDUMP_CMPRS_LOCAL)
 #define KDUMP_SPLIT()       (dd->flags & DUMPFILE_SPLIT)
diff --git a/diskdump.c b/diskdump.c
index de3eeb2..112f769 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -1001,6 +1001,9 @@ is_diskdump(char *file)
 #ifdef SNAPPY
        dd->flags |= SNAPPY_SUPPORTED;
 #endif
+#ifdef ZSTD
+       dd->flags |= ZSTD_SUPPORTED;
+#endif
 
        pc->read_vmcoreinfo = vmcoreinfo_read_string;
 
@@ -1124,6 +1127,9 @@ cache_page(physaddr_t paddr)
        const int block_size = dd->block_size;
        const off_t failed = (off_t)-1;
        ulong retlen;
+#ifdef ZSTD
+       static ZSTD_DCtx *dctx = NULL;
+#endif
 
        for (i = found = 0; i < DISKDUMP_CACHED_PAGES; i++) {
                if (DISKDUMP_VALID_PAGE(dd->page_cache_hdr[i].pg_flags))
@@ -1251,6 +1257,33 @@ cache_page(physaddr_t paddr)
                              ret);
                        return READ_ERROR;
                }
+#endif
+       } else if (pd.flags & DUMP_DH_COMPRESSED_ZSTD) {
+
+               if (!(dd->flags & ZSTD_SUPPORTED)) {
+                       error(INFO, "%s: uncompess failed: no zstd compression 
support\n",
+                               DISKDUMP_VALID() ? "diskdump" : "compressed 
kdump");
+                       return READ_ERROR;
+               }
+#ifdef ZSTD
+               if (!dctx) {
+                       dctx = ZSTD_createDCtx();
+                       if (!dctx) {
+                               error(INFO, "%s: uncompess failed: cannot 
create ZSTD_DCtx\n",
+                                       DISKDUMP_VALID() ? "diskdump" : 
"compressed kdump");
+                               return READ_ERROR;
+                       }
+               }
+
+               retlen = ZSTD_decompressDCtx(dctx,
+                               dd->page_cache_hdr[i].pg_bufptr, block_size,
+                               dd->compressed_page, pd.size);
+               if (ZSTD_isError(retlen) || (retlen != block_size)) {
+                       error(INFO, "%s: uncompress failed: %d (%s)\n",
+                               DISKDUMP_VALID() ? "diskdump" : "compressed 
kdump",
+                               retlen, ZSTD_getErrorName(retlen));
+                       return READ_ERROR;
+               }
 #endif
        } else
                memcpy(dd->page_cache_hdr[i].pg_bufptr,
@@ -1806,6 +1839,8 @@ __diskdump_memory_dump(FILE *fp)
                fprintf(fp, "%sLZO_SUPPORTED", others++ ? "|" : "");
        if (dd->flags & SNAPPY_SUPPORTED)
                fprintf(fp, "%sSNAPPY_SUPPORTED", others++ ? "|" : "");
+       if (dd->flags & ZSTD_SUPPORTED)
+               fprintf(fp, "%sZSTD_SUPPORTED", others++ ? "|" : "");
         fprintf(fp, ") %s\n", FLAT_FORMAT() ? "[FLAT]" : "");
         fprintf(fp, "               dfd: %d\n", dd->dfd);
         fprintf(fp, "               ofp: %lx\n", (ulong)dd->ofp);
@@ -1872,6 +1907,8 @@ __diskdump_memory_dump(FILE *fp)
                        fprintf(fp, "DUMP_DH_COMPRESSED_LZO");
                if (dh->status & DUMP_DH_COMPRESSED_SNAPPY)
                        fprintf(fp, "DUMP_DH_COMPRESSED_SNAPPY");
+               if (dh->status & DUMP_DH_COMPRESSED_ZSTD)
+                       fprintf(fp, "DUMP_DH_COMPRESSED_ZSTD");
                if (dh->status & DUMP_DH_COMPRESSED_INCOMPLETE)
                        fprintf(fp, "DUMP_DH_COMPRESSED_INCOMPLETE");
                if (dh->status & DUMP_DH_EXCLUDED_VMEMMAP)
diff --git a/diskdump.h b/diskdump.h
index 2871340..c152c7b 100644
--- a/diskdump.h
+++ b/diskdump.h
@@ -86,6 +86,7 @@ struct kdump_sub_header {
 #define DUMP_DH_COMPRESSED_SNAPPY  0x4   /* page is compressed with snappy */
 #define DUMP_DH_COMPRESSED_INCOMPLETE  0x8   /* dumpfile is incomplete */
 #define DUMP_DH_EXCLUDED_VMEMMAP   0x10  /* unused vmemmap pages are excluded 
*/
+#define DUMP_DH_COMPRESSED_ZSTD    0x20  /* page is compressed with zstd */
 
 /* descriptor of each page for vmcore */
 typedef struct page_desc {
diff --git a/help.c b/help.c
index 6c262a3..f34838d 100644
--- a/help.c
+++ b/help.c
@@ -9420,8 +9420,8 @@ README_ENTER_DIRECTORY,
 "  Traditionally when vmcores are compressed via the makedumpfile(8) facility",
 "  the libz compression library is used, and by default the crash utility",
 "  only supports libz.  Recently makedumpfile has been enhanced to optionally",
-"  use either the LZO or snappy compression libraries.  To build crash with",
-"  either or both of those libraries, type \"make lzo\" or \"make snappy\".",
+"  use the LZO, snappy or zstd compression libraries.  To build crash with 
any",
+"  or all of those libraries, type \"make lzo\", \"make snappy\" or \"make 
zstd\".",
 "",
 "  crash supports valgrind Memcheck tool on the crash's custom memory 
allocator.",
 "  To build crash with this feature enabled, type \"make valgrind\" and then 
run",
-- 
2.33.1

++++++ 0019-Add-kernel-version-dependent-check-for-getting-lengt.patch ++++++
>From b8e1f2735b8dd1303aeb2affa309a2a409a82d38 Mon Sep 17 00:00:00 2001
From: Tao Liu <l...@redhat.com>
Date: Mon, 26 Jul 2021 09:58:54 +0800
Subject: [PATCH] Add kernel version dependent check for getting length of
 log_end

For kernels(>=2.4.9.11 [1] && <3.5 [2]), log_end was involved in the kernel 
sources.
For kernels(>=2.6.25 [3]), log_end was defined as:
    static unsigned log_end;
For kernels(<2.6.25), log_end was defined as:
    static unsigned long log_end;

Previously, the length of log_end is determined by get_symbol_length, but it can
be a regression when the returned length is 0 for some cases and value 
unchecked:

    crash> help -t
    ...
    help: invalid size request: 0  type: "log_end"

To solve the above issue, let's add a kernel version dependent check to get its
value appropriately when the length of the 'log_end' returns a value of zero.

[1]: https://elixir.bootlin.com/linux/2.4.9.11/source/kernel/printk.c#L74
[2]: https://elixir.bootlin.com/linux/v3.5/source/kernel/printk.c
[3]: https://elixir.bootlin.com/linux/v2.6.25/source/kernel/printk.c#L104

Signed-off-by: Tao Liu <l...@redhat.com>
---
 kernel.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel.c b/kernel.c
index a559f93..a8be7bb 100644
--- a/kernel.c
+++ b/kernel.c
@@ -5106,6 +5106,10 @@ dump_log(int msg_flags)
        if ((len = get_symbol_length("log_end")) == sizeof(int)) {
                get_symbol_data("log_end", len, &tmp);
                log_end = (ulong)tmp;
+       } else if (len == 0) {
+               THIS_KERNEL_VERSION >= LINUX(2,6,25) ?
+                       get_symbol_data("log_end", sizeof(unsigned), &log_end) :
+                       get_symbol_data("log_end", sizeof(unsigned long), 
&log_end);
        } else
                get_symbol_data("log_end", len, &log_end);
 
-- 
2.33.1

++++++ 0020-arm64-Use-VA_BITS-for-page_offset-calculation.patch ++++++
>From c180a63f2cb370da6097ad97eb07333c07aa988b Mon Sep 17 00:00:00 2001
From: Kazuhito Hagio <k-hagio...@nec.com>
Date: Mon, 25 Oct 2021 16:53:26 +0900
Subject: [PATCH] arm64: Use VA_BITS for page_offset calculation

Commit 167d37e347fe ("arm64: assign page_offset with VA_BITS kernel
configuration value") changed the page_offset calculation from
using VA_BITS_ACTUAL to CONFIG_ARM64_VA_BITS.  This caused an error
for ramdumps without vmcoreinfo like this:

  crash: vmlinux and /var/tmp/ramdump_elf_XUtCMT do not match!

Set the vmcoreinfo value to VA_BITS if available, and use VA_BITS
for page_offset calculation instead.

Also remove ARM64_FLIP_PAGE_OFFSET_ACTUAL because it's not used
actually.

Reported-by: Ankur Bansal <er.ankurban...@gmail.com>
Signed-off-by: Kazuhito Hagio <k-hagio...@nec.com>
---
 arm64.c | 5 ++++-
 defs.h  | 4 +---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arm64.c b/arm64.c
index 7069312..3dcbcc6 100644
--- a/arm64.c
+++ b/arm64.c
@@ -404,7 +404,7 @@ arm64_init(int when)
                                fprintf(fp, "CONFIG_ARM64_VA_BITS: %ld\n", 
ms->CONFIG_ARM64_VA_BITS);
                                fprintf(fp, "      VA_BITS_ACTUAL: %ld\n", 
ms->VA_BITS_ACTUAL);
                                fprintf(fp, "(calculated) VA_BITS: %ld\n", 
ms->VA_BITS);
-                               fprintf(fp, " PAGE_OFFSET: %lx\n", 
ARM64_FLIP_PAGE_OFFSET_ACTUAL);
+                               fprintf(fp, " PAGE_OFFSET: %lx\n", 
ARM64_FLIP_PAGE_OFFSET);
                                fprintf(fp, "    VA_START: %lx\n", 
ms->VA_START);
                                fprintf(fp, "     modules: %lx - %lx\n", 
ms->modules_vaddr, ms->modules_end);
                                fprintf(fp, "     vmalloc: %lx - %lx\n", 
ms->vmalloc_start_addr, ms->vmalloc_end);
@@ -4031,6 +4031,9 @@ arm64_calc_VA_BITS(void)
                                error(FATAL, "cannot determine 
VA_BITS_ACTUAL\n");
                }
 
+               if (machdep->machspec->CONFIG_ARM64_VA_BITS)
+                       machdep->machspec->VA_BITS = 
machdep->machspec->CONFIG_ARM64_VA_BITS;
+
                /*
                 * The mm flip commit is introduced before 52-bits VA, which is 
before the
                 * commit to export NUMBER(TCR_EL1_T1SZ)
diff --git a/defs.h b/defs.h
index 8b356d5..9710055 100644
--- a/defs.h
+++ b/defs.h
@@ -3238,9 +3238,7 @@ typedef signed int s32;
 #define ARM64_PAGE_OFFSET    ((0xffffffffffffffffUL) \
                                        << (machdep->machspec->VA_BITS - 1))
 /* kernels >= v5.4 the kernel VA space is flipped */
-#define ARM64_FLIP_PAGE_OFFSET (-(1UL) << 
machdep->machspec->CONFIG_ARM64_VA_BITS)
-#define ARM64_FLIP_PAGE_OFFSET_ACTUAL ((0xffffffffffffffffUL) \
-                                       - ((1UL) << 
machdep->machspec->VA_BITS_ACTUAL) + 1)
+#define ARM64_FLIP_PAGE_OFFSET (-(1UL) << machdep->machspec->VA_BITS)
 
 #define ARM64_USERSPACE_TOP  ((1UL) << machdep->machspec->VA_BITS)
 #define ARM64_USERSPACE_TOP_ACTUAL  ((1UL) << 
machdep->machspec->VA_BITS_ACTUAL)
-- 
2.33.1

++++++ crash-7.2.9.tar.gz -> crash-7.3.0.tar.gz ++++++
/work/SRC/openSUSE:Factory/crash/crash-7.2.9.tar.gz 
/work/SRC/openSUSE:Factory/.crash.new.1895/crash-7.3.0.tar.gz differ: char 12, 
line 1

++++++ crash-enable-zstd-support.patch ++++++
>From 1917e50265c15ff00c6f40b64720ef173f550059 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwi...@suse.com>
Date: Wed, 10 Nov 2021 12:30:27 +0100
Subject: [PATCH] crash: enable zstd support

---
 CFLAGS.extra  | 2 +-
 LDFLAGS.extra | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/CFLAGS.extra b/CFLAGS.extra
index 4fafcff..825d5ee 100644
--- a/CFLAGS.extra
+++ b/CFLAGS.extra
@@ -1 +1 @@
--DLZO -DSNAPPY
+-DLZO -DSNAPPY -DZSTD
diff --git a/LDFLAGS.extra b/LDFLAGS.extra
index 83f3661..ffc6ee8 100644
--- a/LDFLAGS.extra
+++ b/LDFLAGS.extra
@@ -1 +1 @@
--llzo2 -lsnappy
+-llzo2 -lsnappy -lzstd
-- 
2.33.1


++++++ crash-xen-pvops.patch ++++++
--- /var/tmp/diff_new_pack.XXzcXn/_old  2021-11-20 02:39:50.376641679 +0100
+++ /var/tmp/diff_new_pack.XXzcXn/_new  2021-11-20 02:39:50.380641666 +0100
@@ -1,5 +1,28 @@
-Index: b/kernel.c
-===================================================================
+From 4badc6229c69f5cd9da7eb7bdf400a53ec6db01a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20Tesa=C5=99=C3=ADk?= <ptesa...@suse.cz>
+Date: Fri, 25 Jun 2021 17:21:18 +0200
+Subject: [PATCH] Fix pvops Xen detection for kernels >= v4.20
+
+Upstream: accepted - expected crash 7.3.1
+Git-commit: 4badc6229c69f5cd9da7eb7bdf400a53ec6db01a
+
+Kernel commit 5c83511bdb9832c86be20fb86b783356e2f58062 removed
+pv_init_ops, and later commit 054ac8ad5ebe4a69e1f0e842483821ddbe560121
+removed the Xen-specific paravirt patch function. As a result, pvops Xen
+dumps are no longer recognized as Xen dumps, and virtual-to-physical
+translation fails.
+
+Use the value of xen_start_info to determine whether the kernel is
+running in Xen PV mode. This pointer is set during the initialization of
+a PV domain. Kudos to Juergen Gross, who suggested this check.
+
+Signed-off-by: Petr Tesarik <ptesa...@suse.com>
+---
+ kernel.c | 34 ++++++++++++++++++++++++++++------
+ 1 file changed, 28 insertions(+), 6 deletions(-)
+
+diff --git a/kernel.c b/kernel.c
+index e123f76..36fdea2 100644
 --- a/kernel.c
 +++ b/kernel.c
 @@ -95,6 +95,7 @@ static ulong __dump_audit(char *);
@@ -25,13 +48,13 @@
 -      if (PVOPS() && symbol_exists("pv_init_ops") &&
 -          readmem(symbol_value("pv_init_ops"), KVADDR, &pv_init_ops,
 -          sizeof(void *), "pv_init_ops", RETURN_ON_ERROR) &&
--          (p1 = value_symbol(pv_init_ops)) && 
--          STREQ(p1, "xen_patch")) {
+-          ((p1 = value_symbol(pv_init_ops)) &&
+-          (STREQ(p1, "xen_patch") || STREQ(p1, "paravirt_patch_default")))) {
 +      if (is_pvops_xen()) {
                kt->flags |= ARCH_XEN | ARCH_PVOPS_XEN;
                kt->xen_flags |= WRITABLE_PAGE_TABLES;
                if (machine_type("X86"))
-@@ -10690,6 +10686,32 @@ paravirt_init(void)
+@@ -10709,6 +10705,32 @@ paravirt_init(void)
        }
  }
  
@@ -64,3 +87,6 @@
  /*
   *  Get the kernel's xtime timespec from its relevant location.
   */
+-- 
+2.33.1
+

++++++ eppic-switch-to-system-lib.patch ++++++
--- /var/tmp/diff_new_pack.XXzcXn/_old  2021-11-20 02:39:50.428641508 +0100
+++ /var/tmp/diff_new_pack.XXzcXn/_new  2021-11-20 02:39:50.428641508 +0100
@@ -3,9 +3,11 @@
  extensions/eppic/applications/crash/eppic.c | 1110 
++++++++++++++++++++++++++++
  2 files changed, 1112 insertions(+), 24 deletions(-)
 
---- a/extensions/eppic.mk
-+++ b/extensions/eppic.mk
-@@ -31,29 +31,7 @@ all:
+Index: crash-7.3.0/extensions/eppic.mk
+===================================================================
+--- crash-7.3.0.orig/extensions/eppic.mk
++++ crash-7.3.0/extensions/eppic.mk
+@@ -30,29 +30,7 @@ all:
        @if [ -f /usr/bin/flex ] && [ -f /usr/bin/bison ]; then \
          if [ -f ../$(GDB)/crash.target ]; \
          then \
@@ -16,7 +18,7 @@
 -             if [ -n "$(EPPIC_GIT_URL)" ]; then \
 -               git clone "$(EPPIC_GIT_URL)" eppic; \
 -             else \
--                if [ -n "$(GITHUB)" ] ; then \
+-                if ping -c 1 -W 5 github.com >/dev/null ; then \
 -                  git clone https://github.com/lucchouina/eppic.git eppic; \
 -                fi; \
 -             fi; \
@@ -35,7 +37,7 @@
        else \
            echo "eppic.so: build failed: requires the crash $(GDB) module"; \
        fi ;\
-@@ -64,8 +42,8 @@ all:
+@@ -63,8 +41,8 @@ all:
  lib-eppic: 
        cd eppic/libeppic && make
              
@@ -46,8 +48,10 @@
  
  clean:
        if  [ -d eppic/libeppic ]; \
+Index: crash-7.3.0/extensions/eppic/applications/crash/eppic.c
+===================================================================
 --- /dev/null
-+++ b/extensions/eppic/applications/crash/eppic.c
++++ crash-7.3.0/extensions/eppic/applications/crash/eppic.c
 @@ -0,0 +1,1110 @@
 +/*
 + * $Id: eppic.c,v 1.15 2012/01/04 14:46:57 anderson Exp $

Reply via email to