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-02-04 20:24:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/crash (Old)
 and      /work/SRC/openSUSE:Factory/.crash.new.28504 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "crash"

Thu Feb  4 20:24:33 2021 rev:170 rq:869400 version:7.2.8

Changes:
--------
--- /work/SRC/openSUSE:Factory/crash/crash.changes      2021-01-30 
13:57:44.366394228 +0100
+++ /work/SRC/openSUSE:Factory/.crash.new.28504/crash.changes   2021-02-04 
20:25:07.326921990 +0100
@@ -7,0 +8,13 @@
+Mon Jan 18 10:30:03 UTC 2021 - Michal Suchanek <msucha...@suse.de>
+
+- Update arm64 support (boo#1169099).
+  crash-Fix-to-allow-the-translation-of-ARM64-FIXMAP-address.patch
+  crash-Introduce-a-new-ARM64-machdep-vabits_actual-value-co.patch
+  crash-Prepare-for-the-introduction-of-ARM64-8.3-Pointer-Au.patch
+  crash-Several-fixes-for-ARM64-kernels.patch
+  crash-arm64-Change-tcr_el1_t1sz-variable-name-to-TCR_EL1_T.patch
+  crash-xendump-fix-failure-to-match-arm-aarch64-elf-format-.patch
+  crash-arm64-update-mapping-symbol-filter-in-arm64_verify_s.patch
+  crash-Fix-segmentation-fault-when-ikconfig-passed-nonstand.patch
+
+-------------------------------------------------------------------

New:
----
  crash-Fix-segmentation-fault-when-ikconfig-passed-nonstand.patch
  crash-Fix-to-allow-the-translation-of-ARM64-FIXMAP-address.patch
  crash-Introduce-a-new-ARM64-machdep-vabits_actual-value-co.patch
  crash-Prepare-for-the-introduction-of-ARM64-8.3-Pointer-Au.patch
  crash-Several-fixes-for-ARM64-kernels.patch
  crash-arm64-Change-tcr_el1_t1sz-variable-name-to-TCR_EL1_T.patch
  crash-arm64-update-mapping-symbol-filter-in-arm64_verify_s.patch
  crash-xendump-fix-failure-to-match-arm-aarch64-elf-format-.patch

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

Other differences:
------------------
++++++ crash.spec ++++++
--- /var/tmp/diff_new_pack.FkR7oz/_old  2021-02-04 20:25:08.498923775 +0100
+++ /var/tmp/diff_new_pack.FkR7oz/_new  2021-02-04 20:25:08.502923781 +0100
@@ -89,6 +89,22 @@
 Patch33:        
%{name}-task.c-avoid-unnecessary-cpu-cycles-in-stkptr_to_tas.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/49ed67d2c72e3f1a18ca5ce2166c6f5091ed61b0.patch
+Patch35:        
%{name}-Fix-to-allow-the-translation-of-ARM64-FIXMAP-address.patch
+# PATCH-FIX-UPSTREAM - 
https://github.com/crash-utility/crash/commit/d379b47f04dc77ea1989609aca9bfd8d37b7b639.patch
+Patch36:        
%{name}-Introduce-a-new-ARM64-machdep-vabits_actual-value-co.patch
+# PATCH-FIX-UPSTREAM - 
https://github.com/crash-utility/crash/commit/41d61189d60e0fdd6509b96dc8160795263f3229.patch
+Patch37:        
%{name}-Prepare-for-the-introduction-of-ARM64-8.3-Pointer-Au.patch
+# PATCH-FIX-UPSTREAM - 
https://github.com/crash-utility/crash/commit/339ddcd6f26fbd3519f50e96689645da867f6e0f.patch
+Patch38:        %{name}-Several-fixes-for-ARM64-kernels.patch
+# PATCH-FIX-UPSTREAM - 
https://github.com/crash-utility/crash/commit/1c45cea02df7f947b4296c1dcaefa1024235ef10.patch
+Patch39:        
%{name}-arm64-Change-tcr_el1_t1sz-variable-name-to-TCR_EL1_T.patch
+# PATCH-FIX-UPSTREAM - 
https://github.com/crash-utility/crash/commit/4d2e607af5d758f9ae42864cb6b26af49e9f5b1d.patch
+Patch40:        
%{name}-xendump-fix-failure-to-match-arm-aarch64-elf-format-.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
 Patch90:        %{name}-sial-ps-2.6.29.diff
 # PATCH-FIX-UPSTREAM - 
https://github.com/crash-utility/crash/commit/e770735200c02ac2414c394ea6ec5f7f033efe64.patch
 Patch91:        %{name}-gdb-fix-aarch64.patch
@@ -292,6 +308,14 @@
 %patch32 -p1
 %patch33 -p1
 %patch34 -p1
+%patch35 -p1
+%patch36 -p1
+%patch37 -p1
+%patch38 -p1
+%patch39 -p1
+%patch40 -p1
+%patch41 -p1
+%patch42 -p1
 %if %{have_snappy}
 %patch15 -p1
 %endif

++++++ crash-Fix-segmentation-fault-when-ikconfig-passed-nonstand.patch ++++++
>From 5a0488049917ba2790d59108f3def16825528974 Mon Sep 17 00:00:00 2001
From: Jackie Liu <liuyu...@kylinos.cn>
Date: Tue, 5 Jan 2021 09:45:11 +0800
Subject: [PATCH] Fix segmentation fault when ikconfig passed nonstandard
 values

References: bsc#1169099
Upstream: accepted - expected 7.2.10
Git-commit: 5a0488049917ba2790d59108f3def16825528974

Fix for a segmentation fault when analyzing arm64 kernels that are
configured with CONFIG_IKCONFIG and have a strange entry that does
not contain the delimiter "=", such as "CONFIG_SECU+[some hex data]".

Without the patch, in the add_ikconfig_entry() function, strtok_r()
interprets it as consisting of a single token and the val variable
is set to NULL, and then strdup() crashes.

Suggested-by: Kazuhito Hagio <k-hagio...@nec.com>
Signed-off-by: Jackie Liu <liuyu...@kylinos.cn>
---
 kernel.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/kernel.c b/kernel.c
index e722ff941527..272e0d8751cf 100644
--- a/kernel.c
+++ b/kernel.c
@@ -10241,7 +10241,7 @@ static struct ikconfig_list {
        char *val;
 } *ikconfig_all;
 
-static void add_ikconfig_entry(char *line, struct ikconfig_list *ent)
+static int add_ikconfig_entry(char *line, struct ikconfig_list *ent)
 {
        char *tokptr, *name, *val;
 
@@ -10249,8 +10249,16 @@ static void add_ikconfig_entry(char *line, struct 
ikconfig_list *ent)
        sscanf(name, "CONFIG_%s", name);
        val = strtok_r(NULL, "", &tokptr);
 
+       if (!val) {
+               if (CRASHDEBUG(2))
+                       error(WARNING, "invalid ikconfig entry: %s\n", line);
+               return FALSE;
+       }
+
        ent->name = strdup(name);
        ent->val = strdup(val);
+
+       return TRUE;
 }
 
 static int setup_ikconfig(char *config)
@@ -10270,8 +10278,8 @@ static int setup_ikconfig(char *config)
                        ent++;
 
                if (STRNEQ(ent, "CONFIG_")) {
-                       add_ikconfig_entry(ent,
-                                        &ikconfig_all[kt->ikconfig_ents++]);
+                       if (add_ikconfig_entry(ent, 
&ikconfig_all[kt->ikconfig_ents]))
+                               kt->ikconfig_ents++;
                        if (kt->ikconfig_ents == IKCONFIG_MAX) {
                                error(WARNING, "ikconfig overflow.\n");
                                return 1;
-- 
2.26.2

++++++ crash-Fix-to-allow-the-translation-of-ARM64-FIXMAP-address.patch ++++++
>From 49ed67d2c72e3f1a18ca5ce2166c6f5091ed61b0 Mon Sep 17 00:00:00 2001
From: Dave Anderson <ander...@redhat.com>
Date: Mon, 24 Feb 2020 11:53:04 -0500
Subject: [PATCH] Fix to allow the translation of ARM64 FIXMAP addresses
 located in the virtual memory region between the end of the vmalloc region
 and the beginning of the vmemmap region.  Without the patch, reads of virtual
 addresses within that region are not recognized properly and will fail.
 (zhaoqia...@xiaomi.com)

References: bsc#1169099
Upstream: 7.2.9
Git-commit: 49ed67d2c72e3f1a18ca5ce2166c6f5091ed61b0

---
 arm64.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arm64.c b/arm64.c
index 7662d71f2e6d..6abcfe053e90 100644
--- a/arm64.c
+++ b/arm64.c
@@ -3839,7 +3839,8 @@ arm64_IS_VMALLOC_ADDR(ulong vaddr)
 
         return ((vaddr >= ms->vmalloc_start_addr && vaddr <= ms->vmalloc_end) 
||
                 ((machdep->flags & VMEMMAP) &&
-                 (vaddr >= ms->vmemmap_vaddr && vaddr <= ms->vmemmap_end)) ||
+                ((vaddr >= ms->vmemmap_vaddr && vaddr <= ms->vmemmap_end) ||
+                (vaddr >= ms->vmalloc_end && vaddr <= ms->vmemmap_vaddr))) ||
                 (vaddr >= ms->modules_vaddr && vaddr <= ms->modules_end));
 }
 
-- 
2.26.2

++++++ crash-Introduce-a-new-ARM64-machdep-vabits_actual-value-co.patch ++++++
>From d379b47f04dc77ea1989609aca9bfd8d37b7b639 Mon Sep 17 00:00:00 2001
From: Dave Anderson <ander...@redhat.com>
Date: Thu, 2 Apr 2020 15:09:42 -0400
Subject: [PATCH] Introduce a new ARM64 "--machdep vabits_actual=<value>"
 command line option for Linux 5.4 and later dumpfiles, which require the
 kernel's dynamically-determined "vabits_actual" value for virtual address
 translation.  Without the patch, the crash session fails during
 initialization with the error message "crash: cannot determine
 VA_BITS_ACTUAL".  This option will become unnecessary when the proposed
 TCR_EL1.T1SZ vmcoreinfo entry entry is incorporated into the kernel.
 (ander...@redhat.com)

References: bsc#1169099
Upstream: 7.2.9
Git-commit: d379b47f04dc77ea1989609aca9bfd8d37b7b639

---
 arm64.c | 11 +++++++++++
 crash.8 |  1 +
 help.c  |  1 +
 3 files changed, 13 insertions(+)

diff --git a/arm64.c b/arm64.c
index 6abcfe053e90..09b1b766229e 100644
--- a/arm64.c
+++ b/arm64.c
@@ -747,6 +747,8 @@ arm64_parse_machdep_arg_l(char *argstring, char *param, 
ulong *value)
 
                if (STRNEQ(argstring, "max_physmem_bits")) {
                        *value = dtol(p, flags, &err);
+               } else if (STRNEQ(argstring, "vabits_actual")) {
+                       *value = dtol(p, flags, &err);
                } else if (megabytes) {
                        *value = dtol(p, flags, &err);
                        if (!err)
@@ -816,6 +818,12 @@ arm64_parse_cmdline_args(void)
                                        "setting max_physmem_bits to: %ld\n\n",
                                        machdep->max_physmem_bits);
                                continue;
+                       } else if (arm64_parse_machdep_arg_l(arglist[i], 
"vabits_actual",
+                               &machdep->machspec->VA_BITS_ACTUAL)) {
+                               error(NOTE,
+                                       "setting vabits_actual to: %ld\n\n",
+                                       machdep->machspec->VA_BITS_ACTUAL);
+                               continue;
                        }
 
                        error(WARNING, "ignoring --machdep option: %s\n",
@@ -3890,6 +3898,9 @@ arm64_calc_VA_BITS(void)
                                machdep->machspec->VA_BITS_ACTUAL = value;
                                machdep->machspec->VA_BITS = value;
                                machdep->machspec->VA_START = 
_VA_START(machdep->machspec->VA_BITS_ACTUAL);
+                       } else if (machdep->machspec->VA_BITS_ACTUAL) {
+                               machdep->machspec->VA_BITS = 
machdep->machspec->VA_BITS_ACTUAL;
+                               machdep->machspec->VA_START = 
_VA_START(machdep->machspec->VA_BITS_ACTUAL);
                        } else
                                error(FATAL, "cannot determine 
VA_BITS_ACTUAL\n");
                }
diff --git a/crash.8 b/crash.8
index f9de36d87f68..994a2e05b8ab 100644
--- a/crash.8
+++ b/crash.8
@@ -280,6 +280,7 @@ ARM64:
   phys_offset=<physical-address>
   kimage_voffset=<kimage_voffset-value>
   max_physmem_bits=<value>
+  vabits_actual=<value>
 X86:
   page_offset=<CONFIG_PAGE_OFFSET-value>
 .fi
diff --git a/help.c b/help.c
index eda5ce97b612..c443cad74bc1 100644
--- a/help.c
+++ b/help.c
@@ -181,6 +181,7 @@ char *program_usage_info[] = {
     "      phys_offset=<physical-address>",
     "      kimage_voffset=<kimage_voffset-value>",
     "      max_physmem_bits=<value>",
+    "      vabits_actual=<value>",
     "    X86:",
     "      page_offset=<CONFIG_PAGE_OFFSET-value>",
     "",
-- 
2.26.2

++++++ crash-Prepare-for-the-introduction-of-ARM64-8.3-Pointer-Au.patch ++++++
>From 41d61189d60e0fdd6509b96dc8160795263f3229 Mon Sep 17 00:00:00 2001
From: Dave Anderson <ander...@redhat.com>
Date: Fri, 24 Apr 2020 13:16:47 -0400
Subject: [PATCH] Prepare for the introduction of ARM64 8.3 Pointer
 Authentication as in-kernel feature.  The value of CONFIG_ARM64_KERNELPACMASK
 will be exported as a vmcoreinfo entry, and will be used with text return
 addresses on the kernel stack. (amit.kach...@arm.com)

References: bsc#1169099
Upstream: 7.2.9
Git-commit: 41d61189d60e0fdd6509b96dc8160795263f3229

---
 arm64.c | 50 +++++++++++++++++++++++++++++++++++++++++---------
 defs.h  |  1 +
 2 files changed, 42 insertions(+), 9 deletions(-)

diff --git a/arm64.c b/arm64.c
index 09b1b766229e..1285c03dc1cd 100644
--- a/arm64.c
+++ b/arm64.c
@@ -84,6 +84,7 @@ static int arm64_get_kvaddr_ranges(struct vaddr_range *);
 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);
 
 
 /*
@@ -213,6 +214,7 @@ arm64_init(int when)
                machdep->pagemask = ~((ulonglong)machdep->pageoffset);
 
                arm64_calc_VA_BITS();
+               arm64_calc_KERNELPACMASK();
                ms = machdep->machspec;
                if (ms->VA_BITS_ACTUAL) {
                        ms->page_offset = ARM64_PAGE_OFFSET_ACTUAL;
@@ -472,6 +474,7 @@ arm64_init(int when)
        case LOG_ONLY:
                machdep->machspec = &arm64_machine_specific;
                arm64_calc_VA_BITS();
+               arm64_calc_KERNELPACMASK();
                arm64_calc_phys_offset();
                machdep->machspec->page_offset = ARM64_PAGE_OFFSET;
                break;
@@ -659,6 +662,11 @@ arm64_dump_machdep_table(ulong arg)
                fprintf(fp, "%ld\n", ms->VA_BITS_ACTUAL);
        else
                fprintf(fp, "(unused)\n");
+       fprintf(fp, "CONFIG_ARM64_KERNELPACMASK: ");
+       if (ms->CONFIG_ARM64_KERNELPACMASK)
+               fprintf(fp, "%lx\n", ms->CONFIG_ARM64_KERNELPACMASK);
+       else
+               fprintf(fp, "(unused)\n");
        fprintf(fp, "         userspace_top: %016lx\n", ms->userspace_top);
        fprintf(fp, "           page_offset: %016lx\n", ms->page_offset);
        fprintf(fp, "    vmalloc_start_addr: %016lx\n", ms->vmalloc_start_addr);
@@ -1782,13 +1790,14 @@ static int
 arm64_is_kernel_exception_frame(struct bt_info *bt, ulong stkptr)
 {
         struct arm64_pt_regs *regs;
+       struct machine_specific *ms = machdep->machspec;
 
         regs = (struct arm64_pt_regs 
*)&bt->stackbuf[(ulong)(STACK_OFFSET_TYPE(stkptr))];
 
        if (INSTACK(regs->sp, bt) && INSTACK(regs->regs[29], bt) && 
            !(regs->pstate & (0xffffffff00000000ULL | PSR_MODE32_BIT)) &&
            is_kernel_text(regs->pc) &&
-           is_kernel_text(regs->regs[30])) {
+           is_kernel_text(regs->regs[30] | ms->CONFIG_ARM64_KERNELPACMASK)) {
                switch (regs->pstate & PSR_MODE_MASK)
                {
                case PSR_MODE_EL1t:
@@ -1932,6 +1941,7 @@ arm64_print_stackframe_entry(struct bt_info *bt, int 
level, struct arm64_stackfr
          * See, for example, "bl schedule" before ret_to_user().
          */
        branch_pc = frame->pc - 4;
+
         name = closest_symbol(branch_pc);
         name_plus_offset = NULL;
 
@@ -2143,7 +2153,7 @@ arm64_unwind_frame(struct bt_info *bt, struct 
arm64_stackframe *frame)
        unsigned long stack_mask;
        unsigned long irq_stack_ptr, orig_sp;
        struct arm64_pt_regs *ptregs;
-       struct machine_specific *ms;
+       struct machine_specific *ms = machdep->machspec;
 
        stack_mask = (unsigned long)(ARM64_STACK_SIZE) - 1;
        fp = frame->fp;
@@ -2157,6 +2167,8 @@ arm64_unwind_frame(struct bt_info *bt, struct 
arm64_stackframe *frame)
        frame->sp = fp + 0x10;
        frame->fp = GET_STACK_ULONG(fp);
        frame->pc = GET_STACK_ULONG(fp + 8);
+       if (is_kernel_text(frame->pc | ms->CONFIG_ARM64_KERNELPACMASK))
+               frame->pc |= ms->CONFIG_ARM64_KERNELPACMASK;
 
        if ((frame->fp == 0) && (frame->pc == 0))
                return FALSE;
@@ -2208,7 +2220,6 @@ arm64_unwind_frame(struct bt_info *bt, struct 
arm64_stackframe *frame)
         *  irq_stack_ptr = IRQ_STACK_PTR(raw_smp_processor_id());
         *  orig_sp = IRQ_STACK_TO_TASK_STACK(irq_stack_ptr);   (pt_regs 
pointer on process stack)
         */
-       ms = machdep->machspec;
        irq_stack_ptr = ms->irq_stacks[bt->tc->processor] + ms->irq_stack_size 
- 16;
 
        if (frame->sp == irq_stack_ptr) {
@@ -2810,6 +2821,8 @@ arm64_print_text_symbols(struct bt_info *bt, struct 
arm64_stackframe *frame, FIL
        char buf2[BUFSIZE];
        char *name;
        ulong start;
+       ulong val;
+       struct machine_specific *ms = machdep->machspec;
 
        if (bt->flags & BT_TEXT_SYMBOLS_ALL)
                start = bt->stackbase;
@@ -2824,8 +2837,10 @@ arm64_print_text_symbols(struct bt_info *bt, struct 
arm64_stackframe *frame, FIL
 
        for (i = (start - bt->stackbase)/sizeof(ulong); i < LONGS_PER_STACK; 
i++) {
                up = (ulong *)(&bt->stackbuf[i*sizeof(ulong)]);
-               if (is_kernel_text(*up)) {
-                       name = closest_symbol(*up);
+               val = *up;
+               if (is_kernel_text(val | ms->CONFIG_ARM64_KERNELPACMASK)) {
+                       val |= ms->CONFIG_ARM64_KERNELPACMASK;
+                       name = closest_symbol(val);
                        fprintf(ofp, "  %s[%s] %s at %lx",
                                bt->flags & BT_ERROR_MASK ?
                                "  " : "",
@@ -2834,13 +2849,13 @@ arm64_print_text_symbols(struct bt_info *bt, struct 
arm64_stackframe *frame, FIL
                                MKSTR(bt->stackbase + 
                                (i * sizeof(long)))),
                                bt->flags & BT_SYMBOL_OFFSET ?
-                               value_to_symstr(*up, buf2, bt->radix) :
-                               name, *up);
-                       if (module_symbol(*up, NULL, &lm, NULL, 0))
+                               value_to_symstr(val, buf2, bt->radix) :
+                               name, val);
+                       if (module_symbol(val, NULL, &lm, NULL, 0))
                                fprintf(ofp, " [%s]", lm->mod_name);
                        fprintf(ofp, "\n");
                        if (BT_REFERENCE_CHECK(bt))
-                               arm64_do_bt_reference_check(bt, *up, name);
+                               arm64_do_bt_reference_check(bt, val, name);
                }
        }
 }
@@ -3143,6 +3158,7 @@ arm64_print_exception_frame(struct bt_info *bt, ulong 
pt_regs, int mode, FILE *o
        struct syment *sp;
        ulong LR, SP, offset;
        char buf[BUFSIZE];
+       struct machine_specific *ms = machdep->machspec;
 
        if (CRASHDEBUG(1)) 
                fprintf(ofp, "pt_regs: %lx\n", pt_regs);
@@ -3158,6 +3174,8 @@ arm64_print_exception_frame(struct bt_info *bt, ulong 
pt_regs, int mode, FILE *o
                rows = 4;
        } else {
                LR = regs->regs[30];
+               if (is_kernel_text (LR | ms->CONFIG_ARM64_KERNELPACMASK))
+                       LR |= ms->CONFIG_ARM64_KERNELPACMASK;
                SP = regs->sp;
                top_reg = 29;
                is_64_bit = TRUE;
@@ -4070,6 +4088,20 @@ arm64_swp_offset(ulong pte)
        return pte;
 }
 
+static void arm64_calc_KERNELPACMASK(void)
+{
+       ulong value;
+       char *string;
+
+       if ((string = pc->read_vmcoreinfo("NUMBER(KERNELPACMASK)"))) {
+               value = htol(string, QUIET, NULL);
+               free(string);
+               machdep->machspec->CONFIG_ARM64_KERNELPACMASK = value;
+               if (CRASHDEBUG(1))
+                       fprintf(fp, "CONFIG_ARM64_KERNELPACMASK: %lx\n", value);
+       }
+}
+
 #endif  /* ARM64 */
 
 
diff --git a/defs.h b/defs.h
index 4e57a56ec7e1..d742e8e46500 100644
--- a/defs.h
+++ b/defs.h
@@ -3281,6 +3281,7 @@ struct machine_specific {
        ulong VA_BITS_ACTUAL;
        ulong CONFIG_ARM64_VA_BITS;
        ulong VA_START;
+       ulong CONFIG_ARM64_KERNELPACMASK;
 };
 
 struct arm64_stackframe {
-- 
2.26.2

++++++ crash-Several-fixes-for-ARM64-kernels.patch ++++++
>From 339ddcd6f26fbd3519f50e96689645da867f6e0f Mon Sep 17 00:00:00 2001
From: Dave Anderson <ander...@redhat.com>
Date: Fri, 24 Apr 2020 14:16:32 -0400
Subject: [PATCH] Several fixes for ARM64 kernels:  (1) Linux kernel patch
 "arm64: mm: Introduce vabits_actual"      introduced "physvirt_offset", which
 is not equal to      (PHYS_OFFSET - PAGE_OFFSET) when KASLR is enabled.     
 physvirt_offset is caculated in arch/arm64/mm/init.c      before
 memstart_addr (PHYS_OFFSET) is randomized.  Let      arm64_VTOP() and
 arm64_PTOV() use physvirt_offset instead,      whose default value is set to
 (phys_offset - page_offset)  (2) For ARM64 RAM dumps without any vmcoreinfo
 and KASLRpassed as      argument, " _stext_vmlinux" is not set.  This causes
 incorrect      calculation of vmalloc_start with VA_BITS_ACTUAL.  (3) For
 ARM64 RAM dumps For ramdumps without vmcoreinfo, get     
 CONFIG_ARM64_VA_BITS from in-kernel config. Without this,      vmemmap size
 is calculated incorrectly.  (4) Fix the vmemmap_start to match with what the
 kernel uses. (vinayakm.l...@gmail.com)

References: bsc#1169099
Upstream: 7.2.9
Git-commit: 339ddcd6f26fbd3519f50e96689645da867f6e0f

---
 arm64.c | 40 ++++++++++++++++++++++++++++++++++++----
 defs.h  |  3 ++-
 main.c  |  1 +
 3 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/arm64.c b/arm64.c
index 1285c03dc1cd..653225cd8cd6 100644
--- a/arm64.c
+++ b/arm64.c
@@ -31,6 +31,7 @@ static int arm64_search_for_kimage_voffset(ulong);
 static int verify_kimage_voffset(void);
 static void arm64_calc_kimage_voffset(void);
 static void arm64_calc_phys_offset(void);
+static void arm64_calc_physvirt_offset(void);
 static void arm64_calc_virtual_memory_ranges(void);
 static void arm64_get_section_size_bits(void);
 static int arm64_kdump_phys_base(ulong *);
@@ -364,6 +365,7 @@ arm64_init(int when)
 
                /* use machdep parameters */
                arm64_calc_phys_offset();
+               arm64_calc_physvirt_offset();
        
                if (CRASHDEBUG(1)) {
                        if (machdep->flags & NEW_VMEMMAP)
@@ -371,6 +373,7 @@ arm64_init(int when)
                                        machdep->machspec->kimage_voffset);
                        fprintf(fp, "phys_offset: %lx\n", 
                                machdep->machspec->phys_offset);
+                       fprintf(fp, "physvirt_offset: %lx\n", 
machdep->machspec->physvirt_offset);
                }
 
                break;
@@ -477,6 +480,7 @@ arm64_init(int when)
                arm64_calc_KERNELPACMASK();
                arm64_calc_phys_offset();
                machdep->machspec->page_offset = ARM64_PAGE_OFFSET;
+               arm64_calc_physvirt_offset();
                break;
        }
 }
@@ -974,6 +978,25 @@ arm64_calc_kimage_voffset(void)
                ms->kimage_voffset += (kt->relocate * -1);
 }
 
+static void
+arm64_calc_physvirt_offset(void)
+{
+       struct machine_specific *ms = machdep->machspec;
+       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),
+                       sp->value, sp->value -
+                       machdep->machspec->kimage_voffset) > 0) {
+                               ms->physvirt_offset = physvirt_offset;
+               }
+       }
+}
+
 static void
 arm64_calc_phys_offset(void)
 {
@@ -1156,8 +1179,7 @@ arm64_VTOP(ulong addr)
                }
 
                if (addr >= machdep->machspec->page_offset)
-                       return machdep->machspec->phys_offset
-                               + (addr - machdep->machspec->page_offset);
+                       return addr + machdep->machspec->physvirt_offset;
                else if (machdep->machspec->kimage_voffset)
                        return addr - machdep->machspec->kimage_voffset;
                else /* no randomness */
@@ -3999,6 +4021,7 @@ arm64_calc_virtual_memory_ranges(void)
        struct machine_specific *ms = machdep->machspec;
        ulong value, vmemmap_start, vmemmap_end, vmemmap_size, vmalloc_end;
        char *string;
+       int ret;
        ulong PUD_SIZE = UNINITIALIZED;
 
        if (!machdep->machspec->CONFIG_ARM64_VA_BITS) {
@@ -4006,6 +4029,10 @@ arm64_calc_virtual_memory_ranges(void)
                        value = atol(string);
                        free(string);
                        machdep->machspec->CONFIG_ARM64_VA_BITS = value;
+               } else if (kt->ikconfig_flags & IKCONFIG_AVAIL) {
+                       if ((ret = get_kernel_config("CONFIG_ARM64_VA_BITS",
+                                       &string)) == IKCONFIG_STR)
+                               machdep->machspec->CONFIG_ARM64_VA_BITS = 
atol(string);
                }
        }
 
@@ -4030,9 +4057,14 @@ arm64_calc_virtual_memory_ranges(void)
 #define STRUCT_PAGE_MAX_SHIFT   6
 
        if (ms->VA_BITS_ACTUAL) {
-               vmemmap_size = (1UL) << (ms->CONFIG_ARM64_VA_BITS - 
machdep->pageshift - 1 + STRUCT_PAGE_MAX_SHIFT);
+               ulong va_bits_min = 48;
+
+               if (machdep->machspec->CONFIG_ARM64_VA_BITS < 48)
+                       va_bits_min = ms->CONFIG_ARM64_VA_BITS;
+
+               vmemmap_size = (1UL) << (va_bits_min - machdep->pageshift - 1 + 
STRUCT_PAGE_MAX_SHIFT);
                vmalloc_end = (- PUD_SIZE - vmemmap_size - KILOBYTES(64));
-               vmemmap_start = (-vmemmap_size);
+               vmemmap_start = (-vmemmap_size - MEGABYTES(2));
                ms->vmalloc_end = vmalloc_end - 1;
                ms->vmemmap_vaddr = vmemmap_start;
                ms->vmemmap_end = -1;
diff --git a/defs.h b/defs.h
index d742e8e46500..aba58fff7a1b 100644
--- a/defs.h
+++ b/defs.h
@@ -3031,7 +3031,7 @@ typedef u64 pte_t;
 #define MACHINE_TYPE       "ARM64"    
 
 #define PTOV(X) \
-       ((unsigned 
long)(X)-(machdep->machspec->phys_offset)+(machdep->machspec->page_offset))
+       ((unsigned long)(X) - (machdep->machspec->physvirt_offset))
 
 #define VTOP(X)               arm64_VTOP((ulong)(X))
 
@@ -3282,6 +3282,7 @@ struct machine_specific {
        ulong CONFIG_ARM64_VA_BITS;
        ulong VA_START;
        ulong CONFIG_ARM64_KERNELPACMASK;
+       ulong physvirt_offset;
 };
 
 struct arm64_stackframe {
diff --git a/main.c b/main.c
index e04f28d8c98f..7f562e69d3c1 100644
--- a/main.c
+++ b/main.c
@@ -244,6 +244,7 @@ main(int argc, char **argv)
                                        kt->relocate *= -1;
                                        kt->flags |= RELOC_SET;
                                        kt->flags2 |= KASLR;
+                                       st->_stext_vmlinux = UNINITIALIZED;
                                }
 
                        } else if (STREQ(long_options[option_index].name, 
"reloc")) {
-- 
2.26.2

++++++ crash-arm64-Change-tcr_el1_t1sz-variable-name-to-TCR_EL1_T.patch ++++++
>From 1c45cea02df7f947b4296c1dcaefa1024235ef10 Mon Sep 17 00:00:00 2001
From: Bhupesh Sharma <bhsha...@redhat.com>
Date: Tue, 14 Jul 2020 01:14:49 +0530
Subject: [PATCH] arm64: Change tcr_el1_t1sz variable name to TCR_EL1_T1SZ

References: bsc#1169099
Upstream: 7.2.9
Git-commit: 1c45cea02df7f947b4296c1dcaefa1024235ef10

Since linux kernel commit bbdbc11804ff ("arm64/crash_core: Export
TCR_EL1.T1SZ in vmcoreinfo") [available in linux-next now], the name
of tcr_el1_t1sz vmcoreinfo variable has been changed to TCR_EL1_T1SZ.

Make a similar change in crash-utility.

Signed-off-by: Bhupesh Sharma <bhsha...@redhat.com>
---
 arm64.c   | 2 +-
 netdump.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arm64.c b/arm64.c
index 653225cd8cd6..fdf77bd5e0c1 100644
--- a/arm64.c
+++ b/arm64.c
@@ -3922,7 +3922,7 @@ arm64_calc_VA_BITS(void)
                } else if (ACTIVE())
                        error(FATAL, "cannot determine VA_BITS_ACTUAL: please 
use /proc/kcore\n");
                else {
-                       if ((string = 
pc->read_vmcoreinfo("NUMBER(tcr_el1_t1sz)"))) {
+                       if ((string = 
pc->read_vmcoreinfo("NUMBER(TCR_EL1_T1SZ)"))) {
                                /* See ARMv8 ARM for the description of
                                 * TCR_EL1.T1SZ and how it can be used
                                 * to calculate the vabits_actual
diff --git a/netdump.c b/netdump.c
index 406416af36bf..0054d6ab35b4 100644
--- a/netdump.c
+++ b/netdump.c
@@ -1887,7 +1887,7 @@ vmcoreinfo_read_string(const char *key)
                        sprintf(value, "%ld", nd->arch_data2 & 0xffffffff);
                        return value;
                }
-               if (STREQ(key, "NUMBER(tcr_el1_t1sz)") && nd->arch_data2) {
+               if (STREQ(key, "NUMBER(TCR_EL1_T1SZ)") && nd->arch_data2) {
                        value = calloc(VADDR_PRLEN+1, sizeof(char));
                        sprintf(value, "%lld", ((ulonglong)nd->arch_data2 >> 
32) & 0xffffffff);
                        pc->read_vmcoreinfo = no_vmcoreinfo;
-- 
2.26.2

++++++ crash-arm64-update-mapping-symbol-filter-in-arm64_verify_s.patch ++++++
>From 9080711bd1c0645c272e74c25724ad2969d64674 Mon Sep 17 00:00:00 2001
From: Qianli Zhao <zhaoqia...@xiaomi.com>
Date: Thu, 26 Nov 2020 12:49:36 +0800
Subject: [PATCH] arm64: update mapping symbol filter in arm64_verify_symbol

References: bsc#1169099
Upstream: accepted - expected 7.2.10
Git-commit: 9080711bd1c0645c272e74c25724ad2969d64674

Update mapping symbol filter in arm64_verify_symbol() to support the
long form of mapping symbols, e.g. "$x.<any...>" described on [1].
Without the patch, the "dis" command cannot completely parse out the
disassembly of a function that has mapping symbols in the long form
and misses the tail part of the function.

[1] Morello Supplement to ELF for the Arm 64-bit Architecture
    https://developer.arm.com/documentation/102072/

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

diff --git a/arm64.c b/arm64.c
index fdf77bd5e0c1..37aed07edf1d 100644
--- a/arm64.c
+++ b/arm64.c
@@ -510,9 +510,11 @@ arm64_verify_symbol(const char *name, ulong value, char 
type)
            ((type == 'a') || (type == 'n') || (type == 'N') || (type == 'U')))
                return FALSE;
 
-       if (STREQ(name, "$d") || STREQ(name, "$x"))
+       if (STREQ(name, "$d") || STRNEQ(name, "$d.") ||
+           STREQ(name, "$x") || STRNEQ(name, "$x.") ||
+           STREQ(name, "$c") || STRNEQ(name, "$c."))
                return FALSE;
-       
+
        if ((type == 'A') && STRNEQ(name, "__crc_"))
                return FALSE;
 
-- 
2.26.2


++++++ crash-gdb-fix-aarch64.patch ++++++
--- /var/tmp/diff_new_pack.FkR7oz/_old  2021-02-04 20:25:08.686924061 +0100
+++ /var/tmp/diff_new_pack.FkR7oz/_new  2021-02-04 20:25:08.686924061 +0100
@@ -5,12 +5,15 @@
  patch, the build of the embedded gdb module fails with an error message that
  indicates "multiple definition of 'tdesc_aarch64'". (ander...@redhat.com)
 
+Upstream: 7.2.9
+Git-commit: e770735200c02ac2414c394ea6ec5f7f033efe64
+
 ---
  gdb-7.6.patch | 30 ++++++++++++++++++++++++++++++
  1 file changed, 30 insertions(+)
 
 diff --git a/gdb-7.6.patch b/gdb-7.6.patch
-index f6c311d..f64b55f 100644
+index f6c311dd866c..f64b55fe547a 100644
 --- a/gdb-7.6.patch
 +++ b/gdb-7.6.patch
 @@ -2471,3 +2471,33 @@ diff -up gdb-7.6/opcodes/configure.orig 
gdb-7.6/opcodes/configure
@@ -47,3 +50,6 @@
 + #include "features/aarch64.c"
 + #include "features/aarch64-without-fpu.c"
 + 
+-- 
+2.26.2
+

++++++ crash-xendump-fix-failure-to-match-arm-aarch64-elf-format-.patch ++++++
>From 4d2e607af5d758f9ae42864cb6b26af49e9f5b1d Mon Sep 17 00:00:00 2001
From: Goodbach <goodb...@gmail.com>
Date: Wed, 12 Aug 2020 11:22:29 +0800
Subject: [PATCH] xendump: fix failure to match arm/aarch64 elf format of
 xendump file

References: bsc#1169099
Upstream: 7.2.9
Git-commit: 4d2e607af5d758f9ae42864cb6b26af49e9f5b1d

Resolves: https://github.com/crash-utility/crash/pull/61
Signed-off-by: Goodbach <goodb...@gmail.com>
---
 xendump.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xendump.c b/xendump.c
index 70cf261abcbd..a81817d0250b 100644
--- a/xendump.c
+++ b/xendump.c
@@ -2055,6 +2055,16 @@ xc_core_elf_verify(char *file, char *buf)
                                goto bailout;
                        break;
 
+               case EM_ARM:
+                       if (machine_type_mismatch(file, "ARM", NULL, 0))
+                               goto bailout;
+                       break;
+
+               case EM_AARCH64:
+                       if (machine_type_mismatch(file, "ARM64", NULL, 0))
+                               goto bailout;
+                       break;
+
                default:
                        if (machine_type_mismatch(file, "(unknown)", NULL, 0))
                                goto bailout;
-- 
2.26.2

Reply via email to