diff --git a/.crash.metadata b/.crash.metadata new file mode 100644 index 0000000..c8d8321 --- /dev/null +++ b/.crash.metadata @@ -0,0 +1,2 @@ +20865107a4a2ffcb31d9b2f390f72e1dcc3a5dbc SOURCES/crash-7.2.9.tar.gz +026f4c9e1c8152a2773354551c523acd32d7f00e SOURCES/gdb-7.6.tar.gz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..989bab0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/crash-7.2.9.tar.gz +SOURCES/gdb-7.6.tar.gz diff --git a/SOURCES/github_b97e7fd4e826_to_8b50d94ada21.patch b/SOURCES/github_b97e7fd4e826_to_8b50d94ada21.patch deleted file mode 100644 index 3c9e547..0000000 --- a/SOURCES/github_b97e7fd4e826_to_8b50d94ada21.patch +++ /dev/null @@ -1,368 +0,0 @@ -From b97e7fd4e8268d5c46f1b30b41ce1f6ca9ceb216 Mon Sep 17 00:00:00 2001 -From: HATAYAMA Daisuke -Date: Mon, 27 Jul 2020 19:00:19 +0900 -Subject: [PATCH 1/4] symbols: Add linux_banner_vmlinux in symbol table - -Add linux_banner_vmlinux in symbol table, which we'll later use in -calc_kaslr_offset() to do a sanity check in calculation of -kaslr_offset and phys_base. - -Signed-off-by: HATAYAMA Daisuke ---- - defs.h | 1 + - symbols.c | 10 ++++++++++ - 2 files changed, 11 insertions(+) - -diff --git a/defs.h b/defs.h -index d7adb23b86d5..17e98763362b 100644 ---- a/defs.h -+++ b/defs.h -@@ -2714,6 +2714,7 @@ struct symbol_table_data { - ulong pti_init_vmlinux; - ulong kaiser_init_vmlinux; - int kernel_symbol_type; -+ ulong linux_banner_vmlinux; - }; - - /* flags for st */ -diff --git a/symbols.c b/symbols.c -index 3b1f08af43ff..b9de4a179d93 100644 ---- a/symbols.c -+++ b/symbols.c -@@ -3226,6 +3226,11 @@ dump_symbol_table(void) - fprintf(fp, " kaiser_init_vmlinux: (unused)\n"); - } - -+ if (SADUMP_DUMPFILE()) -+ fprintf(fp, "linux_banner_vmlinux: %lx\n", st->linux_banner_vmlinux); -+ else -+ fprintf(fp, "linux_banner_vmlinux: (unused)\n"); -+ - fprintf(fp, " symval_hash[%d]: %lx\n", SYMVAL_HASH, - (ulong)&st->symval_hash[0]); - -@@ -12687,6 +12692,11 @@ numeric_forward(const void *P_x, const void *P_y) - else if (STREQ(y->name, "idt_table")) - st->idt_table_vmlinux = valueof(y); - -+ if (STREQ(x->name, "linux_banner")) -+ st->linux_banner_vmlinux = valueof(x); -+ else if (STREQ(y->name, "linux_banner")) -+ st->linux_banner_vmlinux = valueof(y); -+ - if (STREQ(x->name, "saved_command_line")) - st->saved_command_line_vmlinux = valueof(x); - else if (STREQ(y->name, "saved_command_line")) --- -2.7.4 - - -From d494fabe99b90cea8d717a90951e44e6dbda84bb Mon Sep 17 00:00:00 2001 -From: HATAYAMA Daisuke -Date: Mon, 27 Jul 2020 19:00:20 +0900 -Subject: [PATCH 2/4] symbols: fix initialization of st->{pti_init, - kaiser}_vmlinux - -In numeric_forward(), care must be taken both for x- and y- positions, -but either of kaiser_init and pti_init is only for x- or y- position -only. Fix this. Also, move the code in an appropriate position -according to each symbol name in the alphabetical order. - -Signed-off-by: HATAYAMA Daisuke ---- - symbols.c | 15 ++++++++++----- - 1 file changed, 10 insertions(+), 5 deletions(-) - -diff --git a/symbols.c b/symbols.c -index b9de4a179d93..2fecaee093a2 100644 ---- a/symbols.c -+++ b/symbols.c -@@ -12692,20 +12692,25 @@ numeric_forward(const void *P_x, const void *P_y) - else if (STREQ(y->name, "idt_table")) - st->idt_table_vmlinux = valueof(y); - -+ if (STREQ(x->name, "kaiser_init")) -+ st->kaiser_init_vmlinux = valueof(x); -+ else if (STREQ(y->name, "kaiser_init")) -+ st->kaiser_init_vmlinux = valueof(y); -+ - if (STREQ(x->name, "linux_banner")) - st->linux_banner_vmlinux = valueof(x); - else if (STREQ(y->name, "linux_banner")) - st->linux_banner_vmlinux = valueof(y); - -+ if (STREQ(x->name, "pti_init")) -+ st->pti_init_vmlinux = valueof(x); -+ else if (STREQ(y->name, "pti_init")) -+ st->pti_init_vmlinux = valueof(y); -+ - if (STREQ(x->name, "saved_command_line")) - st->saved_command_line_vmlinux = valueof(x); - else if (STREQ(y->name, "saved_command_line")) - st->saved_command_line_vmlinux = valueof(y); -- -- if (STREQ(x->name, "pti_init")) -- st->pti_init_vmlinux = valueof(x); -- else if (STREQ(y->name, "kaiser_init")) -- st->kaiser_init_vmlinux = valueof(y); - } - - xs = bfd_get_section(x); --- -2.7.4 - - -From ff45c8da8cafed350940b1a56dce65f58051db5e Mon Sep 17 00:00:00 2001 -From: HATAYAMA Daisuke -Date: Mon, 27 Jul 2020 19:00:22 +0900 -Subject: [PATCH 3/4] kaslr: cleanup how to set values to the arguments of - calc_kaslr_offset() - -Setting values of the arguments of calc_kaslr_offset() should be done -at the end of the function. Currently, they are set in the middle -where their values could still be changed according to -get_kaslr_offset_from_vmcoreinfo(). This behavior will be problematic -in the later commits when we implement a trial-and-error approach -because the value of kaslr_offset could be passed to the outside of -calc_kaslr_offset() unexpectedly. Thus, fix this first. - -Signed-off-by: HATAYAMA Daisuke ---- - kaslr_helper.c | 22 +++++++++++++--------- - 1 file changed, 13 insertions(+), 9 deletions(-) - -diff --git a/kaslr_helper.c b/kaslr_helper.c -index fe5909caa937..acbb5c2692e2 100644 ---- a/kaslr_helper.c -+++ b/kaslr_helper.c -@@ -394,10 +394,11 @@ quit: - #define PTI_USER_PGTABLE_MASK (1 << PTI_USER_PGTABLE_BIT) - #define CR3_PCID_MASK 0xFFFull - int --calc_kaslr_offset(ulong *kaslr_offset, ulong *phys_base) -+calc_kaslr_offset(ulong *ko, ulong *pb) - { - uint64_t cr3 = 0, idtr = 0, pgd = 0, idtr_paddr; - ulong divide_error_vmcore; -+ ulong kaslr_offset, phys_base; - ulong kaslr_offset_kdump, phys_base_kdump; - int ret = FALSE; - int verbose = CRASHDEBUG(1)? 1: 0; -@@ -445,9 +446,9 @@ calc_kaslr_offset(ulong *kaslr_offset, ulong *phys_base) - - /* Now we can calculate kaslr_offset and phys_base */ - divide_error_vmcore = get_vec0_addr(idtr_paddr); -- *kaslr_offset = divide_error_vmcore - st->divide_error_vmlinux; -- *phys_base = idtr_paddr - -- (st->idt_table_vmlinux + *kaslr_offset - __START_KERNEL_map); -+ kaslr_offset = divide_error_vmcore - st->divide_error_vmlinux; -+ phys_base = idtr_paddr - -+ (st->idt_table_vmlinux + kaslr_offset - __START_KERNEL_map); - - if (CRASHDEBUG(1)) { - fprintf(fp, "calc_kaslr_offset: idtr=%lx\n", idtr); -@@ -465,9 +466,9 @@ calc_kaslr_offset(ulong *kaslr_offset, ulong *phys_base) - * from vmcoreinfo - */ - if (get_kaslr_offset_from_vmcoreinfo( -- *kaslr_offset, &kaslr_offset_kdump, &phys_base_kdump)) { -- *kaslr_offset = kaslr_offset_kdump; -- *phys_base = phys_base_kdump; -+ kaslr_offset, &kaslr_offset_kdump, &phys_base_kdump)) { -+ kaslr_offset = kaslr_offset_kdump; -+ phys_base = phys_base_kdump; - } else if (CRASHDEBUG(1)) { - fprintf(fp, "kaslr_helper: failed to determine which kernel was running at crash,\n"); - fprintf(fp, "kaslr_helper: asssuming the kdump 1st kernel.\n"); -@@ -475,10 +476,13 @@ calc_kaslr_offset(ulong *kaslr_offset, ulong *phys_base) - - if (CRASHDEBUG(1)) { - fprintf(fp, "calc_kaslr_offset: kaslr_offset=%lx\n", -- *kaslr_offset); -- fprintf(fp, "calc_kaslr_offset: phys_base=%lx\n", *phys_base); -+ kaslr_offset); -+ fprintf(fp, "calc_kaslr_offset: phys_base=%lx\n", phys_base); - } - -+ *ko = kaslr_offset; -+ *pb = phys_base; -+ - ret = TRUE; - quit: - vt->kernel_pgd[0] = 0; --- -2.7.4 - - -From 8b50d94ada21f403665a5e562f40191f111e0313 Mon Sep 17 00:00:00 2001 -From: HATAYAMA Daisuke -Date: Mon, 27 Jul 2020 19:00:23 +0900 -Subject: [PATCH 4/4] kaslr: fix failure of calculating kaslr_offset due to an - sadump format restriction - -We faced recently a memory dump collected by sadump where unused part -of register values are non-zero. For the crash dump, calculating -kaslr_offset fails because it is based on the assumption that unused -part of register values in the sadump format are always zero cleared. - -The problem is that used and unused part of register values are -rigorously indistinguishable in the sadump format. Although there is -kernel data structure that represents a map between logical cpu -numbers and lapic ids, they cannot be used in order to calculate -kaslr_offset. - -To fix this, we have no choice but use a trial-and-error approach: try -to use each entry of register values in order until we find a good -pair of cr3 and idtr by which we can refer to linux_banner symbol as -expected. - -This fix is for the sadump specific issue, so there is no functional -change for the other crash dump formats. - - [ lijiang: adjust the code indent. ] - -Signed-off-by: HATAYAMA Daisuke ---- - kaslr_helper.c | 39 +++++++++++++++++++++++++++++++++++---- - sadump.c | 52 ++++++++++++++++++++++++++++------------------------ - 2 files changed, 63 insertions(+), 28 deletions(-) - -diff --git a/kaslr_helper.c b/kaslr_helper.c -index acbb5c2692e2..bb19e548d04e 100644 ---- a/kaslr_helper.c -+++ b/kaslr_helper.c -@@ -406,6 +406,7 @@ calc_kaslr_offset(ulong *ko, ulong *pb) - if (!machine_type("X86_64")) - return FALSE; - -+retry: - if (SADUMP_DUMPFILE()) { - if (!sadump_get_cr3_idtr(&cr3, &idtr)) - return FALSE; -@@ -437,12 +438,20 @@ calc_kaslr_offset(ulong *ko, ulong *pb) - machdep->machspec->pgdir_shift = PGDIR_SHIFT; - machdep->machspec->ptrs_per_pgd = PTRS_PER_PGD; - if (!readmem(pgd, PHYSADDR, machdep->pgd, PAGESIZE(), -- "pgd", RETURN_ON_ERROR)) -- goto quit; -+ "pgd", RETURN_ON_ERROR)) { -+ if (SADUMP_DUMPFILE()) -+ goto retry; -+ else -+ goto quit; -+ } - - /* Convert virtual address of IDT table to physical address */ -- if (!kvtop(NULL, idtr, &idtr_paddr, verbose)) -- goto quit; -+ if (!kvtop(NULL, idtr, &idtr_paddr, verbose)) { -+ if (SADUMP_DUMPFILE()) -+ goto retry; -+ else -+ goto quit; -+ } - - /* Now we can calculate kaslr_offset and phys_base */ - divide_error_vmcore = get_vec0_addr(idtr_paddr); -@@ -450,6 +459,28 @@ calc_kaslr_offset(ulong *ko, ulong *pb) - phys_base = idtr_paddr - - (st->idt_table_vmlinux + kaslr_offset - __START_KERNEL_map); - -+ if (SADUMP_DUMPFILE()) { -+ char buf[sizeof("Linux version")]; -+ ulong linux_banner_paddr; -+ -+ if (!kvtop(NULL, -+ st->linux_banner_vmlinux + kaslr_offset, -+ &linux_banner_paddr, -+ verbose)) -+ goto retry; -+ -+ if (!readmem(linux_banner_paddr, -+ PHYSADDR, -+ buf, -+ sizeof(buf), -+ "linux_banner", -+ RETURN_ON_ERROR)) -+ goto retry; -+ -+ if (!STRNEQ(buf, "Linux version")) -+ goto retry; -+ } -+ - if (CRASHDEBUG(1)) { - fprintf(fp, "calc_kaslr_offset: idtr=%lx\n", idtr); - fprintf(fp, "calc_kaslr_offset: pgd=%lx\n", pgd); -diff --git a/sadump.c b/sadump.c -index 35f7cf0fcf8f..009e17a4a44a 100644 ---- a/sadump.c -+++ b/sadump.c -@@ -1664,29 +1664,32 @@ get_sadump_data(void) - static int - get_sadump_smram_cpu_state_any(struct sadump_smram_cpu_state *smram) - { -- ulong offset; -- struct sadump_header *sh = sd->dump_header; -- int apicid; -- struct sadump_smram_cpu_state scs, zero; -- -- offset = sd->sub_hdr_offset + sizeof(uint32_t) + -- sd->dump_header->nr_cpus * sizeof(struct sadump_apic_state); -- -- memset(&zero, 0, sizeof(zero)); -- -- for (apicid = 0; apicid < sh->nr_cpus; ++apicid) { -- if (!read_device(&scs, sizeof(scs), &offset)) { -- error(INFO, "sadump: cannot read sub header " -- "cpu_state\n"); -- return FALSE; -- } -- if (memcmp(&scs, &zero, sizeof(scs)) != 0) { -- *smram = scs; -- return TRUE; -- } -- } -- -- return FALSE; -+ ulong offset; -+ struct sadump_header *sh = sd->dump_header; -+ static int apicid; -+ struct sadump_smram_cpu_state scs; -+ -+ if (apicid >= sh->nr_cpus) -+ return FALSE; -+ -+ offset = sd->sub_hdr_offset + sizeof(uint32_t) + -+ sd->dump_header->nr_cpus * sizeof(struct sadump_apic_state) + -+ apicid * sizeof(scs); -+ -+ while (apicid < sh->nr_cpus) { -+ apicid++; -+ if (!read_device(&scs, sizeof(scs), &offset)) { -+ error(INFO, "sadump: cannot read sub header " -+ "cpu_state\n"); -+ return FALSE; -+ } -+ if (scs.Cr3 && (scs.IdtUpper || scs.IdtLower)) { -+ *smram = scs; -+ return TRUE; -+ } -+ } -+ -+ return FALSE; - } - - int -@@ -1695,7 +1698,8 @@ sadump_get_cr3_idtr(ulong *cr3, ulong *idtr) - struct sadump_smram_cpu_state scs; - - memset(&scs, 0, sizeof(scs)); -- get_sadump_smram_cpu_state_any(&scs); -+ if (!get_sadump_smram_cpu_state_any(&scs)) -+ return FALSE; - - *cr3 = scs.Cr3; - *idtr = ((uint64_t)scs.IdtUpper)<<32 | (uint64_t)scs.IdtLower; --- -2.7.4 - diff --git a/SOURCES/github_9596b4388ea5.patch b/SOURCES/rhel8_arm64_52_bit_fix.patch similarity index 68% rename from SOURCES/github_9596b4388ea5.patch rename to SOURCES/rhel8_arm64_52_bit_fix.patch index 9607aa2..8efc331 100644 --- a/SOURCES/github_9596b4388ea5.patch +++ b/SOURCES/rhel8_arm64_52_bit_fix.patch @@ -1,16 +1,16 @@ -commit 9596b4388ea5ebbf7de79f0e377a497de1616654 +commit fe84f31c36bff278f68553d521c983836c5670e2 Author: Bhupesh Sharma -Date: Thu Aug 6 13:17:26 2020 +0530 +Date: Tue Dec 1 02:23:53 2020 +0530 - crash/arm64: Revert to implementation used in crash-7.2.3-17.el8 [Support for CONFIG_ARM64_USER_VA_BITS_52 and CONFIG_ARM64_PA_BITS=52] + arm64 crash fix for older kernels Signed-off-by: Bhupesh Sharma diff --git a/arm64.c b/arm64.c -index 49e25733f094..dfcde6e11359 100644 +index fdf77bd5e0c1..6d825c9e67de 100644 --- a/arm64.c +++ b/arm64.c -@@ -27,12 +27,9 @@ +@@ -27,13 +27,9 @@ static struct machine_specific arm64_machine_specific = { 0 }; static int arm64_verify_symbol(const char *, ulong, char); static void arm64_parse_cmdline_args(void); @@ -18,12 +18,13 @@ index 49e25733f094..dfcde6e11359 100644 -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 *); static ulong arm64_processor_speed(void); static void arm64_init_kernel_pgd(void); -@@ -81,7 +78,7 @@ static int arm64_on_irq_stack(int, ulong); +@@ -82,10 +78,9 @@ static int arm64_on_irq_stack(int, ulong); static void arm64_set_irq_stack(struct bt_info *); static void arm64_set_process_stack(struct bt_info *); static int arm64_get_kvaddr_ranges(struct vaddr_range *); @@ -31,8 +32,11 @@ index 49e25733f094..dfcde6e11359 100644 +static int 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); -@@ -147,12 +144,6 @@ arm64_init(int when) + + /* +@@ -149,12 +144,6 @@ arm64_init(int when) if (kernel_symbol_exists("kimage_voffset")) machdep->flags |= NEW_VMEMMAP; @@ -45,7 +49,7 @@ index 49e25733f094..dfcde6e11359 100644 if (!machdep->pagesize) { /* * Kerneldoc Documentation/arm64/booting.txt describes -@@ -179,16 +170,17 @@ arm64_init(int when) +@@ -181,16 +170,17 @@ arm64_init(int when) } @@ -69,9 +73,11 @@ index 49e25733f094..dfcde6e11359 100644 /* * idmap_pg_dir is 2 pages prior to 4.1, * and 3 pages thereafter. Only 4K and 64K -@@ -214,19 +206,12 @@ arm64_init(int when) +@@ -215,21 +205,13 @@ 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; @@ -93,7 +99,7 @@ index 49e25733f094..dfcde6e11359 100644 if (machdep->flags & NEW_VMEMMAP) { struct syment *sp; -@@ -235,15 +220,11 @@ arm64_init(int when) +@@ -238,15 +220,11 @@ arm64_init(int when) sp = kernel_symbol_search("_end"); ms->kimage_end = (sp ? sp->value : 0); @@ -114,16 +120,7 @@ index 49e25733f094..dfcde6e11359 100644 ms->vmalloc_start_addr = ms->modules_end + 1; -@@ -285,7 +266,7 @@ arm64_init(int when) - case 65536: - if (kernel_symbol_exists("idmap_ptrs_per_pgd") && - readmem(symbol_value("idmap_ptrs_per_pgd"), KVADDR, -- &value, sizeof(ulong), "idmap_ptrs_per_pgd", QUIET|RETURN_ON_ERROR)) -+ &value, sizeof(ulong), "idmap_ptrs_per_pgd", RETURN_ON_ERROR)) - machdep->ptrs_per_pgd = value; - - if (machdep->machspec->VA_BITS > PGDIR_SHIFT_L3_64K) { -@@ -335,6 +316,10 @@ arm64_init(int when) +@@ -338,6 +316,10 @@ arm64_init(int when) machdep->uvtop = arm64_uvtop; machdep->is_uvaddr = arm64_is_uvaddr; @@ -134,7 +131,22 @@ index 49e25733f094..dfcde6e11359 100644 machdep->eframe_search = arm64_eframe_search; machdep->back_trace = arm64_back_trace_cmd; machdep->in_alternate_stack = arm64_in_alternate_stack; -@@ -375,8 +360,7 @@ arm64_init(int when) +@@ -365,7 +347,6 @@ arm64_init(int when) + + /* use machdep parameters */ + arm64_calc_phys_offset(); +- arm64_calc_physvirt_offset(); + + if (CRASHDEBUG(1)) { + if (machdep->flags & NEW_VMEMMAP) +@@ -373,15 +354,13 @@ 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; case POST_GDB: arm64_calc_virtual_memory_ranges(); @@ -144,7 +156,7 @@ index 49e25733f094..dfcde6e11359 100644 if (!machdep->max_physmem_bits) { if ((string = pc->read_vmcoreinfo("NUMBER(MAX_PHYSMEM_BITS)"))) { machdep->max_physmem_bits = atol(string); -@@ -388,24 +372,8 @@ arm64_init(int when) +@@ -393,24 +372,8 @@ arm64_init(int when) else machdep->max_physmem_bits = _MAX_PHYSMEM_BITS; } @@ -169,7 +181,7 @@ index 49e25733f094..dfcde6e11359 100644 if (THIS_KERNEL_VERSION >= LINUX(4,0,0)) { ms->__SWP_TYPE_BITS = 6; ms->__SWP_TYPE_SHIFT = 2; -@@ -465,8 +433,11 @@ arm64_init(int when) +@@ -470,17 +433,18 @@ arm64_init(int when) * of the crash. We need this information to extract correct * backtraces from the panic task. */ @@ -183,7 +195,16 @@ index 49e25733f094..dfcde6e11359 100644 break; case LOG_ONLY: -@@ -648,15 +619,9 @@ arm64_dump_machdep_table(ulong arg) + machdep->machspec = &arm64_machine_specific; + arm64_calc_VA_BITS(); +- arm64_calc_KERNELPACMASK(); + arm64_calc_phys_offset(); + machdep->machspec->page_offset = ARM64_PAGE_OFFSET; +- arm64_calc_physvirt_offset(); + break; + } + } +@@ -655,20 +619,9 @@ arm64_dump_machdep_table(ulong arg) fprintf(fp, " machspec: %lx\n", (ulong)ms); fprintf(fp, " VA_BITS: %ld\n", ms->VA_BITS); @@ -196,18 +217,25 @@ index 49e25733f094..dfcde6e11359 100644 - fprintf(fp, " VA_BITS_ACTUAL: "); - if (ms->VA_BITS_ACTUAL) - 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); + fprintf(fp, " vabits_user: "); + if (ms->vabits_user) + fprintf(fp, "%ld\n", ms->vabits_user); else fprintf(fp, "(unused)\n"); fprintf(fp, " userspace_top: %016lx\n", ms->userspace_top); -@@ -745,12 +710,12 @@ arm64_parse_machdep_arg_l(char *argstring, char *param, ulong *value) +@@ -757,14 +710,12 @@ arm64_parse_machdep_arg_l(char *argstring, char *param, ulong *value) int flags = RETURN_ON_ERROR | QUIET; int err = 0; - 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) { + if (megabytes) { *value = dtol(p, flags, &err); @@ -218,7 +246,20 @@ index 49e25733f094..dfcde6e11359 100644 } else { *value = htol(p, flags, &err); } -@@ -824,60 +789,11 @@ arm64_parse_cmdline_args(void) +@@ -830,12 +781,6 @@ 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", +@@ -844,60 +789,11 @@ arm64_parse_cmdline_args(void) } } @@ -280,7 +321,7 @@ index 49e25733f094..dfcde6e11359 100644 if (ms->kimage_voffset) /* vmcoreinfo, ioctl, or --machdep override */ return; -@@ -885,6 +801,7 @@ arm64_calc_kimage_voffset(void) +@@ -905,6 +801,7 @@ arm64_calc_kimage_voffset(void) if (ACTIVE()) { char buf[BUFSIZE]; char *p1; @@ -288,7 +329,7 @@ index 49e25733f094..dfcde6e11359 100644 FILE *iomem; ulong kimage_voffset, vaddr; -@@ -925,24 +842,9 @@ arm64_calc_kimage_voffset(void) +@@ -945,24 +842,9 @@ arm64_calc_kimage_voffset(void) if (errflag) return; @@ -316,7 +357,33 @@ index 49e25733f094..dfcde6e11359 100644 error(WARNING, "kimage_voffset cannot be determined from the dumpfile.\n"); error(CONT, -@@ -981,16 +883,10 @@ arm64_calc_phys_offset(void) +@@ -978,25 +860,6 @@ 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) + { +@@ -1020,16 +883,10 @@ arm64_calc_phys_offset(void) physaddr_t paddr; ulong vaddr; struct syment *sp; @@ -333,7 +400,7 @@ index 49e25733f094..dfcde6e11359 100644 vaddr = symbol_value_from_proc_kallsyms("memstart_addr"); if (vaddr == BADVAL) vaddr = sp->value; -@@ -1053,31 +949,6 @@ arm64_calc_phys_offset(void) +@@ -1092,31 +949,6 @@ arm64_calc_phys_offset(void) fprintf(fp, "using %lx as phys_offset\n", ms->phys_offset); } @@ -365,7 +432,7 @@ index 49e25733f094..dfcde6e11359 100644 /* * Determine PHYS_OFFSET either by reading VMCOREINFO or the kernel -@@ -1133,12 +1004,6 @@ ulong +@@ -1172,14 +1004,9 @@ ulong arm64_VTOP(ulong addr) { if (machdep->flags & NEW_VMEMMAP) { @@ -376,9 +443,13 @@ index 49e25733f094..dfcde6e11359 100644 - } - if (addr >= machdep->machspec->page_offset) - return machdep->machspec->phys_offset - + (addr - machdep->machspec->page_offset); -@@ -1215,11 +1080,6 @@ arm64_uvtop(struct task_context *tc, ulong uvaddr, physaddr_t *paddr, int verbos +- return addr + machdep->machspec->physvirt_offset; ++ return machdep->machspec->phys_offset ++ + (addr - machdep->machspec->page_offset); + else if (machdep->machspec->kimage_voffset) + return addr - machdep->machspec->kimage_voffset; + else /* no randomness */ +@@ -1253,11 +1080,6 @@ arm64_uvtop(struct task_context *tc, ulong uvaddr, physaddr_t *paddr, int verbos } } @@ -390,7 +461,7 @@ index 49e25733f094..dfcde6e11359 100644 #define PMD_TYPE_MASK 3 #define PMD_TYPE_SECT 1 #define PMD_TYPE_TABLE 2 -@@ -1312,7 +1172,7 @@ arm64_vtop_3level_64k(ulong pgd, ulong vaddr, physaddr_t *paddr, int verbose) +@@ -1350,7 +1172,7 @@ arm64_vtop_3level_64k(ulong pgd, ulong vaddr, physaddr_t *paddr, int verbose) * #define __PAGETABLE_PUD_FOLDED */ @@ -399,7 +470,7 @@ index 49e25733f094..dfcde6e11359 100644 FILL_PMD(pmd_base, KVADDR, PTRS_PER_PMD_L3_64K * sizeof(ulong)); pmd_ptr = pmd_base + (((vaddr) >> PMD_SHIFT_L3_64K) & (PTRS_PER_PMD_L3_64K - 1)); pmd_val = ULONG(machdep->pmd + PAGEOFFSET(pmd_ptr)); -@@ -1322,7 +1182,7 @@ arm64_vtop_3level_64k(ulong pgd, ulong vaddr, physaddr_t *paddr, int verbose) +@@ -1360,7 +1182,7 @@ arm64_vtop_3level_64k(ulong pgd, ulong vaddr, physaddr_t *paddr, int verbose) goto no_page; if ((pmd_val & PMD_TYPE_MASK) == PMD_TYPE_SECT) { @@ -408,7 +479,7 @@ index 49e25733f094..dfcde6e11359 100644 if (verbose) { fprintf(fp, " PAGE: %lx (512MB)\n\n", sectionbase); arm64_translate_pte(pmd_val, 0, 0); -@@ -1331,7 +1191,7 @@ arm64_vtop_3level_64k(ulong pgd, ulong vaddr, physaddr_t *paddr, int verbose) +@@ -1369,7 +1191,7 @@ arm64_vtop_3level_64k(ulong pgd, ulong vaddr, physaddr_t *paddr, int verbose) return TRUE; } @@ -417,7 +488,7 @@ index 49e25733f094..dfcde6e11359 100644 FILL_PTBL(pte_base, KVADDR, PTRS_PER_PTE_L3_64K * sizeof(ulong)); pte_ptr = pte_base + (((vaddr) >> machdep->pageshift) & (PTRS_PER_PTE_L3_64K - 1)); pte_val = ULONG(machdep->ptbl + PAGEOFFSET(pte_ptr)); -@@ -1341,7 +1201,7 @@ arm64_vtop_3level_64k(ulong pgd, ulong vaddr, physaddr_t *paddr, int verbose) +@@ -1379,7 +1201,7 @@ arm64_vtop_3level_64k(ulong pgd, ulong vaddr, physaddr_t *paddr, int verbose) goto no_page; if (pte_val & PTE_VALID) { @@ -426,7 +497,7 @@ index 49e25733f094..dfcde6e11359 100644 if (verbose) { fprintf(fp, " PAGE: %lx\n\n", PAGEBASE(*paddr)); arm64_translate_pte(pte_val, 0, 0); -@@ -1644,11 +1504,10 @@ arm64_stackframe_init(void) +@@ -1682,11 +1504,10 @@ arm64_stackframe_init(void) machdep->machspec->kern_eframe_offset = SIZE(pt_regs); } @@ -442,7 +513,23 @@ index 49e25733f094..dfcde6e11359 100644 if ((sp1 = kernel_symbol_search("__irqentry_text_start")) && (sp2 = kernel_symbol_search("__irqentry_text_end"))) { machdep->machspec->__irqentry_text_start = sp1->value; -@@ -1857,38 +1716,20 @@ arm64_eframe_search(struct bt_info *bt) +@@ -1812,14 +1633,13 @@ 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] | ms->CONFIG_ARM64_KERNELPACMASK)) { ++ is_kernel_text(regs->regs[30])) { + switch (regs->pstate & PSR_MODE_MASK) + { + case PSR_MODE_EL1t: +@@ -1896,38 +1716,20 @@ arm64_eframe_search(struct bt_info *bt) return count; } @@ -485,7 +572,98 @@ index 49e25733f094..dfcde6e11359 100644 return FALSE; } -@@ -3297,7 +3138,7 @@ arm64_translate_pte(ulong pte, void *physaddr, ulonglong unused) +@@ -1963,7 +1765,6 @@ 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; + +@@ -2175,7 +1976,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 = machdep->machspec; ++ struct machine_specific *ms; + + stack_mask = (unsigned long)(ARM64_STACK_SIZE) - 1; + fp = frame->fp; +@@ -2189,8 +1990,6 @@ 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; +@@ -2242,6 +2041,7 @@ 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) { +@@ -2843,8 +2643,6 @@ 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; +@@ -2859,10 +2657,8 @@ 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)]); +- val = *up; +- if (is_kernel_text(val | ms->CONFIG_ARM64_KERNELPACMASK)) { +- val |= ms->CONFIG_ARM64_KERNELPACMASK; +- name = closest_symbol(val); ++ if (is_kernel_text(*up)) { ++ name = closest_symbol(*up); + fprintf(ofp, " %s[%s] %s at %lx", + bt->flags & BT_ERROR_MASK ? + " " : "", +@@ -2871,13 +2667,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(val, buf2, bt->radix) : +- name, val); +- if (module_symbol(val, NULL, &lm, NULL, 0)) ++ value_to_symstr(*up, buf2, bt->radix) : ++ name, *up); ++ if (module_symbol(*up, NULL, &lm, NULL, 0)) + fprintf(ofp, " [%s]", lm->mod_name); + fprintf(ofp, "\n"); + if (BT_REFERENCE_CHECK(bt)) +- arm64_do_bt_reference_check(bt, val, name); ++ arm64_do_bt_reference_check(bt, *up, name); + } + } + } +@@ -3180,7 +2976,6 @@ 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); +@@ -3196,8 +2991,6 @@ 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; +@@ -3345,7 +3138,7 @@ arm64_translate_pte(ulong pte, void *physaddr, ulonglong unused) char *arglist[MAXARGS]; int page_present; @@ -494,7 +672,7 @@ index 49e25733f094..dfcde6e11359 100644 page_present = pte & (PTE_VALID | machdep->machspec->PTE_PROT_NONE); if (physaddr) { -@@ -3563,8 +3404,8 @@ arm64_display_machine_stats(void) +@@ -3611,8 +3404,8 @@ arm64_display_machine_stats(void) fprintf(fp, " HZ: %d\n", machdep->hz); fprintf(fp, " PAGE SIZE: %d\n", PAGESIZE()); fprintf(fp, "KERNEL VIRTUAL BASE: %lx\n", machdep->machspec->page_offset); @@ -504,7 +682,7 @@ index 49e25733f094..dfcde6e11359 100644 fprintf(fp, "KERNEL VMEMMAP BASE: %lx\n", machdep->machspec->vmemmap_vaddr); fprintf(fp, " KERNEL STACK SIZE: %ld\n", STACKSIZE()); if (machdep->machspec->irq_stack_size) { -@@ -3594,7 +3435,7 @@ arm64_get_smp_cpus(void) +@@ -3642,7 +3435,7 @@ arm64_get_smp_cpus(void) /* * Retrieve task registers for the time of the crash. */ @@ -513,7 +691,7 @@ index 49e25733f094..dfcde6e11359 100644 arm64_get_crash_notes(void) { struct machine_specific *ms = machdep->machspec; -@@ -3603,10 +3444,10 @@ arm64_get_crash_notes(void) +@@ -3651,10 +3444,10 @@ arm64_get_crash_notes(void) ulong offset; char *buf, *p; ulong *notes_ptrs; @@ -526,7 +704,7 @@ index 49e25733f094..dfcde6e11359 100644 crash_notes = symbol_value("crash_notes"); -@@ -3618,9 +3459,9 @@ arm64_get_crash_notes(void) +@@ -3666,9 +3459,9 @@ arm64_get_crash_notes(void) */ if (!readmem(crash_notes, KVADDR, ¬es_ptrs[kt->cpus-1], sizeof(notes_ptrs[kt->cpus-1]), "crash_notes", RETURN_ON_ERROR)) { @@ -538,7 +716,7 @@ index 49e25733f094..dfcde6e11359 100644 } if (symbol_exists("__per_cpu_offset")) { -@@ -3636,11 +3477,12 @@ arm64_get_crash_notes(void) +@@ -3684,11 +3477,12 @@ arm64_get_crash_notes(void) if (!(ms->panic_task_regs = calloc((size_t)kt->cpus, sizeof(struct arm64_pt_regs)))) error(FATAL, "cannot calloc panic_task_regs space\n"); @@ -554,7 +732,7 @@ index 49e25733f094..dfcde6e11359 100644 } /* -@@ -3670,24 +3512,19 @@ arm64_get_crash_notes(void) +@@ -3718,24 +3512,19 @@ arm64_get_crash_notes(void) note->n_descsz == notesz) BCOPY((char *)note, buf, notesz); } else { @@ -586,7 +764,7 @@ index 49e25733f094..dfcde6e11359 100644 } /* -@@ -3700,17 +3537,18 @@ arm64_get_crash_notes(void) +@@ -3748,17 +3537,18 @@ arm64_get_crash_notes(void) BCOPY(p + OFFSET(elf_prstatus_pr_reg), &ms->panic_task_regs[i], sizeof(struct arm64_pt_regs)); @@ -611,7 +789,7 @@ index 49e25733f094..dfcde6e11359 100644 } static void -@@ -3834,9 +3672,6 @@ arm64_IS_VMALLOC_ADDR(ulong vaddr) +@@ -3882,13 +3672,9 @@ arm64_IS_VMALLOC_ADDR(ulong vaddr) (vaddr <= machdep->machspec->kimage_end)) return FALSE; @@ -620,8 +798,13 @@ index 49e25733f094..dfcde6e11359 100644 - return ((vaddr >= ms->vmalloc_start_addr && vaddr <= ms->vmalloc_end) || ((machdep->flags & VMEMMAP) && - (vaddr >= ms->vmemmap_vaddr && vaddr <= ms->vmemmap_end)) || -@@ -3848,54 +3683,9 @@ arm64_calc_VA_BITS(void) +- ((vaddr >= ms->vmemmap_vaddr && vaddr <= ms->vmemmap_end) || +- (vaddr >= ms->vmalloc_end && vaddr <= ms->vmemmap_vaddr))) || ++ (vaddr >= ms->vmemmap_vaddr && vaddr <= ms->vmemmap_end)) || + (vaddr >= ms->modules_vaddr && vaddr <= ms->modules_end)); + } + +@@ -3897,57 +3683,9 @@ arm64_calc_VA_BITS(void) { int bitval; struct syment *sp; @@ -667,6 +850,9 @@ index 49e25733f094..dfcde6e11359 100644 - 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"); - } @@ -677,7 +863,7 @@ index 49e25733f094..dfcde6e11359 100644 if (!(sp = symbol_search("swapper_pg_dir")) && !(sp = symbol_search("idmap_pg_dir")) && !(sp = symbol_search("_text")) && -@@ -3924,12 +3714,14 @@ arm64_calc_VA_BITS(void) +@@ -3976,12 +3714,14 @@ arm64_calc_VA_BITS(void) /* * Verify against dumpfiles that export VA_BITS in vmcoreinfo */ @@ -698,7 +884,7 @@ index 49e25733f094..dfcde6e11359 100644 if (CRASHDEBUG(1)) fprintf(fp, "VA_BITS: %ld\n", machdep->machspec->VA_BITS); -@@ -3947,15 +3739,6 @@ arm64_calc_VA_BITS(void) +@@ -3999,15 +3739,6 @@ arm64_calc_VA_BITS(void) * * Since VMEMMAP_SIZE is dependent upon the size of a struct page, * the two ranges cannot be determined until POST_GDB. @@ -714,12 +900,13 @@ index 49e25733f094..dfcde6e11359 100644 */ #define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) -@@ -3967,18 +3750,10 @@ static void +@@ -4019,23 +3750,10 @@ static void 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 vmemmap_start, vmemmap_end, vmemmap_size; + ulong vmalloc_end; ulong PUD_SIZE = UNINITIALIZED; @@ -729,22 +916,31 @@ index 49e25733f094..dfcde6e11359 100644 - 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); - } - } - if (THIS_KERNEL_VERSION < LINUX(3,17,0)) /* use original hardwired values */ return; -@@ -3997,19 +3772,8 @@ arm64_calc_virtual_memory_ranges(void) +@@ -4054,24 +3772,8 @@ arm64_calc_virtual_memory_ranges(void) break; } -#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; @@ -756,7 +952,7 @@ index 49e25733f094..dfcde6e11359 100644 vmemmap_size = 1UL << (ms->VA_BITS - machdep->pageshift - 1 + STRUCT_PAGE_MAX_SHIFT); else -@@ -4033,7 +3797,7 @@ arm64_calc_virtual_memory_ranges(void) +@@ -4095,7 +3797,7 @@ arm64_calc_virtual_memory_ranges(void) static int arm64_is_uvaddr(ulong addr, struct task_context *tc) { @@ -765,11 +961,41 @@ index 49e25733f094..dfcde6e11359 100644 } +@@ -4120,20 +3822,6 @@ 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 ac24a5d730d5..d0b021f61c67 100644 +index 95949507cae4..48f5e05e32f3 100644 --- a/defs.h +++ b/defs.h -@@ -3148,17 +3148,9 @@ typedef signed int s32; +@@ -3052,7 +3052,7 @@ typedef u64 pte_t; + #define MACHINE_TYPE "ARM64" + + #define PTOV(X) \ +- ((unsigned long)(X) - (machdep->machspec->physvirt_offset)) ++ ((unsigned long)(X)-(machdep->machspec->phys_offset)+(machdep->machspec->page_offset)) + + #define VTOP(X) arm64_VTOP((ulong)(X)) + +@@ -3186,17 +3186,9 @@ typedef signed int s32; */ #define ARM64_VA_START ((0xffffffffffffffffUL) \ << machdep->machspec->VA_BITS) @@ -787,123 +1013,25 @@ index ac24a5d730d5..d0b021f61c67 100644 /* only used for v4.6 or later */ #define ARM64_MODULES_VSIZE MEGABYTES(128) -@@ -3261,9 +3253,7 @@ struct machine_specific { +@@ -3299,11 +3291,7 @@ struct machine_specific { ulong kern_eframe_offset; ulong machine_kexec_start; ulong machine_kexec_end; - ulong VA_BITS_ACTUAL; - ulong CONFIG_ARM64_VA_BITS; - ulong VA_START; +- ulong CONFIG_ARM64_KERNELPACMASK; +- ulong physvirt_offset; + ulong vabits_user; }; struct arm64_stackframe { -diff --git a/netdump.c b/netdump.c -index 0054d6ab35b4..31ab6fae5ccd 100644 ---- a/netdump.c -+++ b/netdump.c -@@ -1228,19 +1228,7 @@ netdump_memory_dump(FILE *fp) - if (machine_type("X86_64")) - netdump_print("%lx (relocate)\n", nd->arch_data1); - else if (machine_type("ARM64")) -- netdump_print("%lx (kimage_voffset)\n", nd->arch_data1); -- } else -- netdump_print("(unused)\n"); -- netdump_print(" arch_data2: "); -- if (nd->arch_data2) { -- if (machine_type("ARM64")) -- netdump_print("%016lx\n" -- " CONFIG_ARM64_VA_BITS: %ld\n" -- " VA_BITS_ACTUAL: %lld\n", -- nd->arch_data2, nd->arch_data2 & 0xffffffff, -- ((ulonglong)nd->arch_data2 >> 32)); -- else -- netdump_print("%016lx (?)\n", nd->arch_data2); -+ netdump_print("%lx (kimage_voffset)\n", nd->arch_data); - } else - netdump_print("(unused)\n"); - netdump_print(" switch_stack: %lx\n", nd->switch_stack); -@@ -1865,8 +1853,7 @@ vmcoreinfo_read_string(const char *key) - int i, j, end; - size_t value_length; - size_t key_length = strlen(key); -- char *vmcoreinfo; -- uint size_vmcoreinfo; -+ char *vmcoreinfo = (char *)nd->vmcoreinfo; - char *value = NULL; +@@ -3552,8 +3540,6 @@ struct arm64_stackframe { + machdep->machspec->last_p4d_read = (ulong)(P4D); \ + } - /* -@@ -1875,49 +1862,25 @@ vmcoreinfo_read_string(const char *key) - * the NT_TASKSTRUCT note. - */ - if ((pc->flags2 & SNAP)) { -- if (STREQ(key, "NUMBER(kimage_voffset)") && nd->arch_data1) { -+ if (STREQ(key, "NUMBER(kimage_voffset)") && nd->arch_data) { - value = calloc(VADDR_PRLEN+1, sizeof(char)); -- sprintf(value, "%lx", nd->arch_data1); -- if (nd->arch_data2 == 0) -- pc->read_vmcoreinfo = no_vmcoreinfo; -- return value; -- } -- if (STREQ(key, "NUMBER(VA_BITS)") && nd->arch_data2) { -- value = calloc(VADDR_PRLEN+1, sizeof(char)); -- sprintf(value, "%ld", nd->arch_data2 & 0xffffffff); -- return value; -- } -- 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); -+ sprintf(value, "%lx", nd->arch_data); - pc->read_vmcoreinfo = no_vmcoreinfo; - return value; - } -- if (STREQ(key, "relocate") && nd->arch_data1) { -+ if (STREQ(key, "relocate") && nd->arch_data) { - value = calloc(VADDR_PRLEN+1, sizeof(char)); -- sprintf(value, "%lx", nd->arch_data1); -+ sprintf(value, "%lx", nd->arch_data); - pc->read_vmcoreinfo = no_vmcoreinfo; - return value; - } -- return NULL; -- } +-#define MAX_POSSIBLE_PHYSMEM_BITS 52 - -- if (nd->vmcoreinfo) { -- vmcoreinfo = (char *)nd->vmcoreinfo; -- size_vmcoreinfo = nd->size_vmcoreinfo; -- } else if (ACTIVE() && pkd->vmcoreinfo) { -- vmcoreinfo = (char *)pkd->vmcoreinfo; -- size_vmcoreinfo = pkd->size_vmcoreinfo; -- } else { -- vmcoreinfo = NULL; -- size_vmcoreinfo = 0; - } - -- if (!vmcoreinfo) -+ if (!nd->vmcoreinfo) - return NULL; - - /* the '+ 1' is the equal sign */ -- for (i = 0; i < (int)(size_vmcoreinfo - key_length + 1); i++) { -+ for (i = 0; i < (nd->size_vmcoreinfo - key_length + 1); i++) { - /* - * We must also check if we're at the beginning of VMCOREINFO - * or the separating newline is there, and of course if we -@@ -1931,7 +1894,7 @@ vmcoreinfo_read_string(const char *key) - - /* Found -- search for the next newline. */ - for (j = i + key_length + 1; -- j < size_vmcoreinfo; j++) { -+ j < nd->size_vmcoreinfo; j++) { - if (vmcoreinfo[j] == '\n') { - end = j; - break; -@@ -1944,7 +1907,7 @@ vmcoreinfo_read_string(const char *key) - */ - if (end == -1) { - /* Point after the end. */ -- end = size_vmcoreinfo + 1; -+ end = nd->size_vmcoreinfo + 1; - } - - value_length = end - (1+ i + key_length); + /* + * PHYSICAL_PAGE_MASK changed (enlarged) between 2.4 and 2.6, so + * for safety, use the 2.6 values to generate it. diff --git a/SOURCES/rhel8_arm64_idmap_ptrs_per_pgd_fix.patch b/SOURCES/rhel8_arm64_idmap_ptrs_per_pgd_fix.patch deleted file mode 100644 index 4d24e81..0000000 --- a/SOURCES/rhel8_arm64_idmap_ptrs_per_pgd_fix.patch +++ /dev/null @@ -1,30 +0,0 @@ -commit ba7c7b89f0e959342c6a5204653366820fb630ef -Author: Bhupesh Sharma -Date: Thu Nov 5 16:26:17 2020 +0530 - - rhel8 only patch - - Since we reverted to the implementation used in crash-7.2.3-17.el8 for - arm64 52-bit changes (see 'crash/arm64: Revert to implementation used - in crash-7.2.3-17.el8 [Support for CONFIG_ARM64_USER_VA_BITS_52 and - CONFIG_ARM64_PA_BITS=52]' for details), add the missing QUIET argument - if the read access to the 'idmap_ptrs_per_pgd' symbol failed. - - This will do away with the warning message we get in case the - 'idmap_ptrs_per_pgd' symbol is not found via readmem(). - - Signed-off-by: Bhupesh Sharma - -diff --git a/arm64.c b/arm64.c -index dfcde6e11359..6d825c9e67de 100644 ---- a/arm64.c -+++ b/arm64.c -@@ -266,7 +266,7 @@ arm64_init(int when) - case 65536: - if (kernel_symbol_exists("idmap_ptrs_per_pgd") && - readmem(symbol_value("idmap_ptrs_per_pgd"), KVADDR, -- &value, sizeof(ulong), "idmap_ptrs_per_pgd", RETURN_ON_ERROR)) -+ &value, sizeof(ulong), "idmap_ptrs_per_pgd", QUIET|RETURN_ON_ERROR)) - machdep->ptrs_per_pgd = value; - - if (machdep->machspec->VA_BITS > PGDIR_SHIFT_L3_64K) { diff --git a/SPECS/crash.spec b/SPECS/crash.spec index 022df77..fe2b870 100644 --- a/SPECS/crash.spec +++ b/SPECS/crash.spec @@ -3,8 +3,8 @@ # Summary: Kernel analysis utility for live systems, netdump, diskdump, kdump, LKCD or mcore dumpfiles Name: crash -Version: 7.2.8 -Release: 8%{?dist} +Version: 7.2.9 +Release: 2%{?dist} License: GPLv3 Group: Development/Debuggers Source0: https://github.com/crash-utility/crash/archive/crash-%{version}.tar.gz @@ -18,12 +18,7 @@ Requires: binutils Provides: bundled(gdb) = 7.6 Patch0: lzo_snappy.patch Patch1: rhel8_build.patch -Patch2: github_b80b16549e24.patch -Patch3: github_0f29a8ac6b73.patch -Patch4: github_1c45cea02df7.patch -Patch5: github_9596b4388ea5.patch -Patch6: github_b97e7fd4e826_to_8b50d94ada21.patch -Patch7: rhel8_arm64_idmap_ptrs_per_pgd_fix.patch +Patch2: rhel8_arm64_52_bit_fix.patch %description The core analysis suite is a self-contained tool that can be used to @@ -46,12 +41,7 @@ offered by Mission Critical Linux, or the LKCD kernel patch. %setup -n %{name}-%{version} -q %patch0 -p1 -b lzo_snappy.patch %patch1 -p1 -b rhel8_build.patch -%patch2 -p1 -b github_b80b16549e24.patch -%patch3 -p1 -b github_0f29a8ac6b73.patch -%patch4 -p1 -b github_1c45cea02df7.patch -%patch5 -p1 -b github_9596b4388ea5.patch -%patch6 -p1 -b github_b97e7fd4e826_to_8b50d94ada21.patch -%patch7 -p1 -b rhel8_arm64_idmap_ptrs_per_pgd_fix.patch +%patch2 -p1 -b rhel8_arm64_52_bit_fix.patch %build cp %{SOURCE1} . @@ -82,6 +72,17 @@ rm -rf %{buildroot} %{_includedir}/* %changelog +* Tue Dec 1 2020 Bhupesh Sharma - 7.2.9-2 +- Fix the sources file to add gdb-7.6 tarball + [The line was somehow removed when using rhpkg new-sources to + update the crash tarball location] + Resolves: rhbz#1881854 + +* Tue Dec 1 2020 Bhupesh Sharma - 7.2.9-1 +- Rebase to upstream crash version 7.2.9 +- Also minimize the rhel-only patches to the bare minimum. + Resolves: rhbz#1881854 + * Wed Nov 5 2020 Bhupesh Sharma - 7.2.8-8 - crash/arm64: Fix arm64 read error with 'idmap_ptrs_per_pgd' symbol with debug kernel Resolves: rhbz#1876039