|
@@ -1092,6 +1092,29 @@ out:
|
|
|
* Jeremy Fitzhardinge <jeremy@sw.oz.au>
|
|
|
*/
|
|
|
|
|
|
+/*
|
|
|
+ * The purpose of always_dump_vma() is to make sure that special kernel mappings
|
|
|
+ * that are useful for post-mortem analysis are included in every core dump.
|
|
|
+ * In that way we ensure that the core dump is fully interpretable later
|
|
|
+ * without matching up the same kernel and hardware config to see what PC values
|
|
|
+ * meant. These special mappings include - vDSO, vsyscall, and other
|
|
|
+ * architecture specific mappings
|
|
|
+ */
|
|
|
+static bool always_dump_vma(struct vm_area_struct *vma)
|
|
|
+{
|
|
|
+ /* Any vsyscall mappings? */
|
|
|
+ if (vma == get_gate_vma(vma->vm_mm))
|
|
|
+ return true;
|
|
|
+ /*
|
|
|
+ * arch_vma_name() returns non-NULL for special architecture mappings,
|
|
|
+ * such as vDSO sections.
|
|
|
+ */
|
|
|
+ if (arch_vma_name(vma))
|
|
|
+ return true;
|
|
|
+
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
* Decide what to dump of a segment, part, all or none.
|
|
|
*/
|
|
@@ -1100,8 +1123,8 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma,
|
|
|
{
|
|
|
#define FILTER(type) (mm_flags & (1UL << MMF_DUMP_##type))
|
|
|
|
|
|
- /* The vma can be set up to tell us the answer directly. */
|
|
|
- if (vma->vm_flags & VM_ALWAYSDUMP)
|
|
|
+ /* always dump the vdso and vsyscall sections */
|
|
|
+ if (always_dump_vma(vma))
|
|
|
goto whole;
|
|
|
|
|
|
/* Hugetlb memory check */
|