diff options
Diffstat (limited to 'fs/binfmt_elf.c')
-rw-r--r-- | fs/binfmt_elf.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 81878b78c9d4..504b6eee50a9 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1093,6 +1093,29 @@ out: | |||
1093 | */ | 1093 | */ |
1094 | 1094 | ||
1095 | /* | 1095 | /* |
1096 | * The purpose of always_dump_vma() is to make sure that special kernel mappings | ||
1097 | * that are useful for post-mortem analysis are included in every core dump. | ||
1098 | * In that way we ensure that the core dump is fully interpretable later | ||
1099 | * without matching up the same kernel and hardware config to see what PC values | ||
1100 | * meant. These special mappings include - vDSO, vsyscall, and other | ||
1101 | * architecture specific mappings | ||
1102 | */ | ||
1103 | static bool always_dump_vma(struct vm_area_struct *vma) | ||
1104 | { | ||
1105 | /* Any vsyscall mappings? */ | ||
1106 | if (vma == get_gate_vma(vma->vm_mm)) | ||
1107 | return true; | ||
1108 | /* | ||
1109 | * arch_vma_name() returns non-NULL for special architecture mappings, | ||
1110 | * such as vDSO sections. | ||
1111 | */ | ||
1112 | if (arch_vma_name(vma)) | ||
1113 | return true; | ||
1114 | |||
1115 | return false; | ||
1116 | } | ||
1117 | |||
1118 | /* | ||
1096 | * Decide what to dump of a segment, part, all or none. | 1119 | * Decide what to dump of a segment, part, all or none. |
1097 | */ | 1120 | */ |
1098 | static unsigned long vma_dump_size(struct vm_area_struct *vma, | 1121 | static unsigned long vma_dump_size(struct vm_area_struct *vma, |
@@ -1100,10 +1123,13 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma, | |||
1100 | { | 1123 | { |
1101 | #define FILTER(type) (mm_flags & (1UL << MMF_DUMP_##type)) | 1124 | #define FILTER(type) (mm_flags & (1UL << MMF_DUMP_##type)) |
1102 | 1125 | ||
1103 | /* The vma can be set up to tell us the answer directly. */ | 1126 | /* always dump the vdso and vsyscall sections */ |
1104 | if (vma->vm_flags & VM_ALWAYSDUMP) | 1127 | if (always_dump_vma(vma)) |
1105 | goto whole; | 1128 | goto whole; |
1106 | 1129 | ||
1130 | if (vma->vm_flags & VM_NODUMP) | ||
1131 | return 0; | ||
1132 | |||
1107 | /* Hugetlb memory check */ | 1133 | /* Hugetlb memory check */ |
1108 | if (vma->vm_flags & VM_HUGETLB) { | 1134 | if (vma->vm_flags & VM_HUGETLB) { |
1109 | if ((vma->vm_flags & VM_SHARED) && FILTER(HUGETLB_SHARED)) | 1135 | if ((vma->vm_flags & VM_SHARED) && FILTER(HUGETLB_SHARED)) |