|
|
7ef056 |
commit da49e2010b3cb88b4755d69d38fe90af6ba218b2
|
|
|
7ef056 |
Author: Dave Anderson <anderson@redhat.com>
|
|
|
7ef056 |
Date: Fri Jun 1 10:58:00 2018 -0400
|
|
|
7ef056 |
|
|
|
7ef056 |
Update for the recognition of the new x86_64 CPU_ENTRY_AREA virtual
|
|
|
7ef056 |
address range introduced in Linux 4.15. The memory range exists
|
|
|
7ef056 |
above the vmemmap range and below the mapped kernel static text/data
|
|
|
7ef056 |
region, and where all of the x86_64 exception stacks have been moved.
|
|
|
7ef056 |
Without the patch, reads from the new memory region fail because the
|
|
|
7ef056 |
address range is not recognized as a legitimate virtual address.
|
|
|
7ef056 |
Most notable is the failure of "bt" on tasks whose backtraces
|
|
|
7ef056 |
originate from any of the exception stacks, which fail with the two
|
|
|
7ef056 |
error messages "bt: seek error: kernel virtual address: <address>
|
|
|
7ef056 |
type: stack contents" followed by "bt: read of stack at <address>
|
|
|
7ef056 |
failed".
|
|
|
7ef056 |
(anderson@redhat.com)
|
|
|
7ef056 |
|
|
|
7ef056 |
diff --git a/defs.h b/defs.h
|
|
|
7ef056 |
index 931be07..6e6f6be 100644
|
|
|
7ef056 |
--- a/defs.h
|
|
|
7ef056 |
+++ b/defs.h
|
|
|
7ef056 |
@@ -3391,6 +3391,9 @@ struct arm64_stackframe {
|
|
|
7ef056 |
#define VSYSCALL_START 0xffffffffff600000
|
|
|
7ef056 |
#define VSYSCALL_END 0xffffffffff601000
|
|
|
7ef056 |
|
|
|
7ef056 |
+#define CPU_ENTRY_AREA_START 0xfffffe0000000000
|
|
|
7ef056 |
+#define CPU_ENTRY_AREA_END 0xfffffe7fffffffff
|
|
|
7ef056 |
+
|
|
|
7ef056 |
#define PTOV(X) ((unsigned long)(X)+(machdep->kvbase))
|
|
|
7ef056 |
#define VTOP(X) x86_64_VTOP((ulong)(X))
|
|
|
7ef056 |
#define IS_VMALLOC_ADDR(X) x86_64_IS_VMALLOC_ADDR((ulong)(X))
|
|
|
7ef056 |
@@ -5829,6 +5832,8 @@ struct machine_specific {
|
|
|
7ef056 |
ulong kpti_entry_stack;
|
|
|
7ef056 |
ulong kpti_entry_stack_size;
|
|
|
7ef056 |
ulong ptrs_per_pgd;
|
|
|
7ef056 |
+ ulong cpu_entry_area_start;
|
|
|
7ef056 |
+ ulong cpu_entry_area_end;
|
|
|
7ef056 |
};
|
|
|
7ef056 |
|
|
|
7ef056 |
#define KSYMS_START (0x1)
|
|
|
7ef056 |
diff --git a/x86_64.c b/x86_64.c
|
|
|
7ef056 |
index 1d5e155..54b6539 100644
|
|
|
7ef056 |
--- a/x86_64.c
|
|
|
7ef056 |
+++ b/x86_64.c
|
|
|
7ef056 |
@@ -407,6 +407,11 @@ x86_64_init(int when)
|
|
|
7ef056 |
machdep->machspec->modules_end = MODULES_END_2_6_31;
|
|
|
7ef056 |
}
|
|
|
7ef056 |
}
|
|
|
7ef056 |
+ if (STRUCT_EXISTS("cpu_entry_area")) {
|
|
|
7ef056 |
+ machdep->machspec->cpu_entry_area_start = CPU_ENTRY_AREA_START;
|
|
|
7ef056 |
+ machdep->machspec->cpu_entry_area_end = CPU_ENTRY_AREA_END;
|
|
|
7ef056 |
+ }
|
|
|
7ef056 |
+
|
|
|
7ef056 |
STRUCT_SIZE_INIT(cpuinfo_x86, "cpuinfo_x86");
|
|
|
7ef056 |
/*
|
|
|
7ef056 |
* Before 2.6.25 the structure was called gate_struct
|
|
|
7ef056 |
@@ -879,20 +884,21 @@ x86_64_dump_machdep_table(ulong arg)
|
|
|
7ef056 |
|
|
|
7ef056 |
/* pml4 and upml is legacy for extension modules */
|
|
|
7ef056 |
if (ms->pml4) {
|
|
|
7ef056 |
- fprintf(fp, " pml4: %lx\n", (ulong)ms->pml4);
|
|
|
7ef056 |
- fprintf(fp, " last_pml4_read: %lx\n", (ulong)ms->last_pml4_read);
|
|
|
7ef056 |
+ fprintf(fp, " pml4: %lx\n", (ulong)ms->pml4);
|
|
|
7ef056 |
+ fprintf(fp, " last_pml4_read: %lx\n", (ulong)ms->last_pml4_read);
|
|
|
7ef056 |
|
|
|
7ef056 |
} else {
|
|
|
7ef056 |
- fprintf(fp, " pml4: (unused)\n");
|
|
|
7ef056 |
- fprintf(fp, " last_pml4_read: (unused)\n");
|
|
|
7ef056 |
+ fprintf(fp, " pml4: (unused)\n");
|
|
|
7ef056 |
+ fprintf(fp, " last_pml4_read: (unused)\n");
|
|
|
7ef056 |
}
|
|
|
7ef056 |
|
|
|
7ef056 |
if (ms->upml) {
|
|
|
7ef056 |
- fprintf(fp, " upml: %lx\n", (ulong)ms->upml);
|
|
|
7ef056 |
- fprintf(fp, " last_upml_read: %lx\n", (ulong)ms->last_upml_read);
|
|
|
7ef056 |
+ fprintf(fp, " upml: %lx\n", (ulong)ms->upml);
|
|
|
7ef056 |
+ fprintf(fp, " last_upml_read: %lx\n", (ulong)ms->last_upml_read);
|
|
|
7ef056 |
} else {
|
|
|
7ef056 |
- fprintf(fp, " upml: (unused)\n");
|
|
|
7ef056 |
- fprintf(fp, " last_upml_read: (unused)\n");
|
|
|
7ef056 |
+ fprintf(fp, " GART_end: %lx\n", ms->GART_end);
|
|
|
7ef056 |
+ fprintf(fp, " upml: (unused)\n");
|
|
|
7ef056 |
+ fprintf(fp, " last_upml_read: (unused)\n");
|
|
|
7ef056 |
}
|
|
|
7ef056 |
|
|
|
7ef056 |
if (ms->p4d) {
|
|
|
7ef056 |
@@ -1016,10 +1022,14 @@ x86_64_dump_machdep_table(ulong arg)
|
|
|
7ef056 |
fprintf(fp, "\n ");
|
|
|
7ef056 |
fprintf(fp, "%016lx ", ms->stkinfo.ibase[c]);
|
|
|
7ef056 |
}
|
|
|
7ef056 |
- fprintf(fp, "\n kpti_entry_stack_size: %ld", ms->kpti_entry_stack_size);
|
|
|
7ef056 |
- fprintf(fp, "\n kpti_entry_stack: ");
|
|
|
7ef056 |
+ fprintf(fp, "\n kpti_entry_stack_size: ");
|
|
|
7ef056 |
+ if (ms->kpti_entry_stack_size)
|
|
|
7ef056 |
+ fprintf(fp, "%ld", ms->kpti_entry_stack_size);
|
|
|
7ef056 |
+ else
|
|
|
7ef056 |
+ fprintf(fp, "(unused)");
|
|
|
7ef056 |
+ fprintf(fp, "\n kpti_entry_stack: ");
|
|
|
7ef056 |
if (machdep->flags & KPTI) {
|
|
|
7ef056 |
- fprintf(fp, "%lx\n ", ms->kpti_entry_stack);
|
|
|
7ef056 |
+ fprintf(fp, "(percpu: %lx):\n ", ms->kpti_entry_stack);
|
|
|
7ef056 |
for (c = 0; c < cpus; c++) {
|
|
|
7ef056 |
if (c && !(c%4))
|
|
|
7ef056 |
fprintf(fp, "\n ");
|
|
|
7ef056 |
@@ -1028,6 +1038,16 @@ x86_64_dump_machdep_table(ulong arg)
|
|
|
7ef056 |
fprintf(fp, "\n");
|
|
|
7ef056 |
} else
|
|
|
7ef056 |
fprintf(fp, "(unused)\n");
|
|
|
7ef056 |
+ fprintf(fp, " cpu_entry_area_start: ");
|
|
|
7ef056 |
+ if (ms->cpu_entry_area_start)
|
|
|
7ef056 |
+ fprintf(fp, "%016lx\n", (ulong)ms->cpu_entry_area_start);
|
|
|
7ef056 |
+ else
|
|
|
7ef056 |
+ fprintf(fp, "(unused)\n");
|
|
|
7ef056 |
+ fprintf(fp, " cpu_entry_area_end: ");
|
|
|
7ef056 |
+ if (ms->cpu_entry_area_end)
|
|
|
7ef056 |
+ fprintf(fp, "%016lx\n", (ulong)ms->cpu_entry_area_end);
|
|
|
7ef056 |
+ else
|
|
|
7ef056 |
+ fprintf(fp, "(unused)\n");
|
|
|
7ef056 |
}
|
|
|
7ef056 |
|
|
|
7ef056 |
/*
|
|
|
7ef056 |
@@ -1586,7 +1606,10 @@ x86_64_IS_VMALLOC_ADDR(ulong vaddr)
|
|
|
7ef056 |
((machdep->flags & VMEMMAP) &&
|
|
|
7ef056 |
(vaddr >= VMEMMAP_VADDR && vaddr <= VMEMMAP_END)) ||
|
|
|
7ef056 |
(vaddr >= MODULES_VADDR && vaddr <= MODULES_END) ||
|
|
|
7ef056 |
- (vaddr >= VSYSCALL_START && vaddr < VSYSCALL_END));
|
|
|
7ef056 |
+ (vaddr >= VSYSCALL_START && vaddr < VSYSCALL_END) ||
|
|
|
7ef056 |
+ (machdep->machspec->cpu_entry_area_start &&
|
|
|
7ef056 |
+ vaddr >= machdep->machspec->cpu_entry_area_start &&
|
|
|
7ef056 |
+ vaddr <= machdep->machspec->cpu_entry_area_end));
|
|
|
7ef056 |
}
|
|
|
7ef056 |
|
|
|
7ef056 |
static int
|