diff --git a/9c881ab372010b46655dfed0a3c5cd78b3ff8fa0.patch b/9c881ab372010b46655dfed0a3c5cd78b3ff8fa0.patch new file mode 100644 index 0000000000000000000000000000000000000000..28e4610838fad6878e93a392bd3860a8f260add5 --- /dev/null +++ b/9c881ab372010b46655dfed0a3c5cd78b3ff8fa0.patch @@ -0,0 +1,130 @@ +diff --git a/defs.h b/defs.h +index e1a18e9..e468b1d 100644 +--- a/defs.h ++++ b/defs.h +@@ -5938,6 +5938,7 @@ struct x86_64_pt_regs_offsets { + struct x86_64_stkinfo { + ulong ebase[NR_CPUS][MAX_EXCEPTION_STACKS]; + int esize[MAX_EXCEPTION_STACKS]; ++ char available[NR_CPUS][MAX_EXCEPTION_STACKS]; + ulong ibase[NR_CPUS]; + int isize; + int NMI_stack_index; +diff --git a/x86_64.c b/x86_64.c +index 939c8a9..23a40a0 100644 +--- a/x86_64.c ++++ b/x86_64.c +@@ -1369,6 +1369,7 @@ x86_64_ist_init(void) + ulong init_tss; + struct machine_specific *ms; + struct syment *boot_sp, *tss_sp, *ist_sp; ++ char *exc_stack_struct_name = NULL; + + ms = machdep->machspec; + if (!(tss_sp = per_cpu_symbol_search("per_cpu__init_tss"))) { +@@ -1444,25 +1445,40 @@ x86_64_ist_init(void) + return; + } + +- if (MEMBER_EXISTS("exception_stacks", "NMI_stack")) { ++ if (MEMBER_EXISTS("cea_exception_stacks", "NMI_stack")) { ++ /* The effective cpu entry area mapping with guard pages. */ ++ exc_stack_struct_name = "cea_exception_stacks"; ++ } else if (MEMBER_EXISTS("exception_stacks", "NMI_stack")) { ++ /* The exception stacks' physical storage. No guard pages and no VC stack. */ ++ exc_stack_struct_name = "exception_stacks"; ++ } ++ if (exc_stack_struct_name) { + for (i = 0; i < MAX_EXCEPTION_STACKS; i++) { + if (STREQ(ms->stkinfo.exception_stacks[i], "DEBUG")) +- ms->stkinfo.esize[i] = MEMBER_SIZE("exception_stacks", "DB_stack"); ++ ms->stkinfo.esize[i] = MEMBER_SIZE(exc_stack_struct_name, "DB_stack"); + else if (STREQ(ms->stkinfo.exception_stacks[i], "NMI")) +- ms->stkinfo.esize[i] = MEMBER_SIZE("exception_stacks", "NMI_stack"); ++ ms->stkinfo.esize[i] = MEMBER_SIZE(exc_stack_struct_name, "NMI_stack"); + else if (STREQ(ms->stkinfo.exception_stacks[i], "DOUBLEFAULT")) +- ms->stkinfo.esize[i] = MEMBER_SIZE("exception_stacks", "DF_stack"); ++ ms->stkinfo.esize[i] = MEMBER_SIZE(exc_stack_struct_name, "DF_stack"); + else if (STREQ(ms->stkinfo.exception_stacks[i], "MCE")) +- ms->stkinfo.esize[i] = MEMBER_SIZE("exception_stacks", "MCE_stack"); ++ ms->stkinfo.esize[i] = MEMBER_SIZE(exc_stack_struct_name, "MCE_stack"); ++ else if (STREQ(ms->stkinfo.exception_stacks[i], "VC")) ++ ms->stkinfo.esize[i] = MEMBER_SIZE(exc_stack_struct_name, "VC_stack"); + } + /* +- * Adjust the top-of-stack addresses down to the base stack address. ++ * Adjust the top-of-stack addresses down to the base stack address ++ * and set stack page availabilituy flag. + */ + for (c = 0; c < kt->cpus; c++) { + for (i = 0; i < MAX_EXCEPTION_STACKS; i++) { +- if (ms->stkinfo.ebase[c][i] == 0) +- continue; +- ms->stkinfo.ebase[c][i] -= ms->stkinfo.esize[i]; ++ if (ms->stkinfo.ebase[c][i]) ++ ms->stkinfo.ebase[c][i] -= ms->stkinfo.esize[i]; ++ ++ ms->stkinfo.available[c][i] = TRUE; ++ /* VC stack can be unmapped if SEV-ES is disabled or not supported. */ ++ if (STREQ(ms->stkinfo.exception_stacks[i], "VC") && ++ !accessible(ms->stkinfo.ebase[c][i])) ++ ms->stkinfo.available[c][i] = FALSE; + } + } + +@@ -1487,6 +1503,7 @@ x86_64_ist_init(void) + else + ms->stkinfo.esize[i] = esize; + ms->stkinfo.ebase[c][i] -= ms->stkinfo.esize[i]; ++ ms->stkinfo.available[c][i] = TRUE; + } + } + +@@ -2842,7 +2859,8 @@ x86_64_eframe_search(struct bt_info *bt) + !(NUM_IN_BITMAP(bt->cpumask, c))) + continue; + for (i = 0; i < MAX_EXCEPTION_STACKS; i++) { +- if (ms->stkinfo.ebase[c][i] == 0) ++ if (ms->stkinfo.ebase[c][i] == 0 || ++ !ms->stkinfo.available[c][i]) + break; + bt->hp->esp = ms->stkinfo.ebase[c][i]; + fprintf(fp, "CPU %d %s EXCEPTION STACK:", +@@ -3288,7 +3306,8 @@ x86_64_in_exception_stack(struct bt_info *bt, int *estack_index) + + for (c = 0; !estack && (c < kt->cpus); c++) { + for (i = 0; i < MAX_EXCEPTION_STACKS; i++) { +- if (ms->stkinfo.ebase[c][i] == 0) ++ if (ms->stkinfo.ebase[c][i] == 0 || ++ !ms->stkinfo.available[c][i]) + break; + if ((rsp >= ms->stkinfo.ebase[c][i]) && + (rsp < (ms->stkinfo.ebase[c][i] + +@@ -5097,7 +5116,7 @@ x86_64_get_dumpfile_stack_frame(struct bt_info *bt_in, ulong *rip, ulong *rsp) + ms->stkinfo.esize[estack]; + console("x86_64_get_dumpfile_stack_frame: searching %s estack at %lx\n", + ms->stkinfo.exception_stacks[estack], bt->stackbase); +- if (!(bt->stackbase)) ++ if (!(bt->stackbase && ms->stkinfo.available[bt->tc->processor][estack])) + goto skip_stage; + bt->stackbuf = ms->irqstack; + alter_stackbuf(bt); +@@ -5380,6 +5399,8 @@ x86_64_exception_stacks_init(void) + ms->stkinfo.exception_stacks[ist-1] = "DOUBLEFAULT"; + if (strstr(buf, "machine")) + ms->stkinfo.exception_stacks[ist-1] = "MCE"; ++ if (strstr(buf, "vmm")) ++ ms->stkinfo.exception_stacks[ist-1] = "VC"; + } + } + +@@ -5737,6 +5758,9 @@ x86_64_display_machine_stats(void) + fprintf(fp, "%22s: %016lx", + buf, machdep->machspec->stkinfo.ebase[c][i]); + ++ if (!machdep->machspec->stkinfo.available[c][i]) ++ fprintf(fp, " [unavailable]"); ++ + if (hide_offline_cpu(c)) + fprintf(fp, " [OFFLINE]\n"); + else diff --git a/crash.spec b/crash.spec index 6048d78b9dcbf4bbc677c9b0589e5fe5da8b52e6..7e55dbdfa31f742fb5389e45a75148c99022f011 100644 --- a/crash.spec +++ b/crash.spec @@ -1,6 +1,6 @@ Name: crash Version: 7.2.8 -Release: 4 +Release: 5 Summary: Linux kernel crash utility. License: GPLv3 URL: https://crash-utility.github.io @@ -12,6 +12,7 @@ Patch1: use_system_readline_v3.patch Patch9000: add-SDEI-stack-resolution.patch Patch9001: fix-bitmap_len-calculation-overflow-problem-in-large.patch +Patch9002: 9c881ab372010b46655dfed0a3c5cd78b3ff8fa0.patch BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel BuildRequires: gcc gcc-c++ bison readline-devel @@ -77,6 +78,9 @@ install -D -m 0644 defs.h %{buildroot}%{_includedir}/%{name}/defs.h %{_mandir}/man8/crash.8* %changelog +* 20201221075849737529 patch-tracking 7.2.8-5 +- append patch file of upstream repository from <9c881ab372010b46655dfed0a3c5cd78b3ff8fa0> to <9c881ab372010b46655dfed0a3c5cd78b3ff8fa0> + * Sat Dec 12 2020 shixuantong - 7.2.8-4 - Update Source0, URL, add Source1 and update tarball from upstream release @@ -96,4 +100,4 @@ install -D -m 0644 defs.h %{buildroot}%{_includedir}/%{name}/defs.h - Package rebuild. * Fri Aug 30 2019 openEuler Buildteam - 7.2.6-1 -- Package init. +- Package init. \ No newline at end of file