diff options
-rw-r--r-- | arch/alpha/include/asm/mman.h | 4 | ||||
-rw-r--r-- | arch/mips/include/asm/mman.h | 4 | ||||
-rw-r--r-- | arch/parisc/include/asm/mman.h | 4 | ||||
-rw-r--r-- | arch/xtensa/include/asm/mman.h | 4 | ||||
-rw-r--r-- | fs/binfmt_elf.c | 3 | ||||
-rw-r--r-- | include/asm-generic/mman-common.h | 4 | ||||
-rw-r--r-- | include/linux/mm.h | 1 | ||||
-rw-r--r-- | mm/madvise.c | 8 |
8 files changed, 32 insertions, 0 deletions
diff --git a/arch/alpha/include/asm/mman.h b/arch/alpha/include/asm/mman.h index 72db984f8781..cbeb3616a28e 100644 --- a/arch/alpha/include/asm/mman.h +++ b/arch/alpha/include/asm/mman.h | |||
@@ -56,6 +56,10 @@ | |||
56 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ | 56 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ |
57 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ | 57 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ |
58 | 58 | ||
59 | #define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, | ||
60 | overrides the coredump filter bits */ | ||
61 | #define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */ | ||
62 | |||
59 | /* compatibility flags */ | 63 | /* compatibility flags */ |
60 | #define MAP_FILE 0 | 64 | #define MAP_FILE 0 |
61 | 65 | ||
diff --git a/arch/mips/include/asm/mman.h b/arch/mips/include/asm/mman.h index 785b4ea4ec3f..46d3da0d4b92 100644 --- a/arch/mips/include/asm/mman.h +++ b/arch/mips/include/asm/mman.h | |||
@@ -80,6 +80,10 @@ | |||
80 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ | 80 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ |
81 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ | 81 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ |
82 | 82 | ||
83 | #define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, | ||
84 | overrides the coredump filter bits */ | ||
85 | #define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */ | ||
86 | |||
83 | /* compatibility flags */ | 87 | /* compatibility flags */ |
84 | #define MAP_FILE 0 | 88 | #define MAP_FILE 0 |
85 | 89 | ||
diff --git a/arch/parisc/include/asm/mman.h b/arch/parisc/include/asm/mman.h index f5b7bf5fba68..12219ebce869 100644 --- a/arch/parisc/include/asm/mman.h +++ b/arch/parisc/include/asm/mman.h | |||
@@ -62,6 +62,10 @@ | |||
62 | #define MADV_HUGEPAGE 67 /* Worth backing with hugepages */ | 62 | #define MADV_HUGEPAGE 67 /* Worth backing with hugepages */ |
63 | #define MADV_NOHUGEPAGE 68 /* Not worth backing with hugepages */ | 63 | #define MADV_NOHUGEPAGE 68 /* Not worth backing with hugepages */ |
64 | 64 | ||
65 | #define MADV_DONTDUMP 69 /* Explicity exclude from the core dump, | ||
66 | overrides the coredump filter bits */ | ||
67 | #define MADV_DODUMP 70 /* Clear the MADV_NODUMP flag */ | ||
68 | |||
65 | /* compatibility flags */ | 69 | /* compatibility flags */ |
66 | #define MAP_FILE 0 | 70 | #define MAP_FILE 0 |
67 | #define MAP_VARIABLE 0 | 71 | #define MAP_VARIABLE 0 |
diff --git a/arch/xtensa/include/asm/mman.h b/arch/xtensa/include/asm/mman.h index 30789010733d..25bc6c1309c3 100644 --- a/arch/xtensa/include/asm/mman.h +++ b/arch/xtensa/include/asm/mman.h | |||
@@ -86,6 +86,10 @@ | |||
86 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ | 86 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ |
87 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ | 87 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ |
88 | 88 | ||
89 | #define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, | ||
90 | overrides the coredump filter bits */ | ||
91 | #define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */ | ||
92 | |||
89 | /* compatibility flags */ | 93 | /* compatibility flags */ |
90 | #define MAP_FILE 0 | 94 | #define MAP_FILE 0 |
91 | 95 | ||
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index b64be5b5ac21..504b6eee50a9 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1127,6 +1127,9 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma, | |||
1127 | if (always_dump_vma(vma)) | 1127 | if (always_dump_vma(vma)) |
1128 | goto whole; | 1128 | goto whole; |
1129 | 1129 | ||
1130 | if (vma->vm_flags & VM_NODUMP) | ||
1131 | return 0; | ||
1132 | |||
1130 | /* Hugetlb memory check */ | 1133 | /* Hugetlb memory check */ |
1131 | if (vma->vm_flags & VM_HUGETLB) { | 1134 | if (vma->vm_flags & VM_HUGETLB) { |
1132 | if ((vma->vm_flags & VM_SHARED) && FILTER(HUGETLB_SHARED)) | 1135 | if ((vma->vm_flags & VM_SHARED) && FILTER(HUGETLB_SHARED)) |
diff --git a/include/asm-generic/mman-common.h b/include/asm-generic/mman-common.h index 787abbb6d867..d030d2c2647a 100644 --- a/include/asm-generic/mman-common.h +++ b/include/asm-generic/mman-common.h | |||
@@ -48,6 +48,10 @@ | |||
48 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ | 48 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ |
49 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ | 49 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ |
50 | 50 | ||
51 | #define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, | ||
52 | overrides the coredump filter bits */ | ||
53 | #define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */ | ||
54 | |||
51 | /* compatibility flags */ | 55 | /* compatibility flags */ |
52 | #define MAP_FILE 0 | 56 | #define MAP_FILE 0 |
53 | 57 | ||
diff --git a/include/linux/mm.h b/include/linux/mm.h index 2de2ddba51d4..a6fabdfd34c5 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -111,6 +111,7 @@ extern unsigned int kobjsize(const void *objp); | |||
111 | #define VM_HUGEPAGE 0x01000000 /* MADV_HUGEPAGE marked this vma */ | 111 | #define VM_HUGEPAGE 0x01000000 /* MADV_HUGEPAGE marked this vma */ |
112 | #endif | 112 | #endif |
113 | #define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ | 113 | #define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ |
114 | #define VM_NODUMP 0x04000000 /* Do not include in the core dump */ | ||
114 | 115 | ||
115 | #define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ | 116 | #define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ |
116 | #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ | 117 | #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ |
diff --git a/mm/madvise.c b/mm/madvise.c index f5ab745672b7..1ccbba5b6674 100644 --- a/mm/madvise.c +++ b/mm/madvise.c | |||
@@ -65,6 +65,12 @@ static long madvise_behavior(struct vm_area_struct * vma, | |||
65 | } | 65 | } |
66 | new_flags &= ~VM_DONTCOPY; | 66 | new_flags &= ~VM_DONTCOPY; |
67 | break; | 67 | break; |
68 | case MADV_DONTDUMP: | ||
69 | new_flags |= VM_NODUMP; | ||
70 | break; | ||
71 | case MADV_DODUMP: | ||
72 | new_flags &= ~VM_NODUMP; | ||
73 | break; | ||
68 | case MADV_MERGEABLE: | 74 | case MADV_MERGEABLE: |
69 | case MADV_UNMERGEABLE: | 75 | case MADV_UNMERGEABLE: |
70 | error = ksm_madvise(vma, start, end, behavior, &new_flags); | 76 | error = ksm_madvise(vma, start, end, behavior, &new_flags); |
@@ -293,6 +299,8 @@ madvise_behavior_valid(int behavior) | |||
293 | case MADV_HUGEPAGE: | 299 | case MADV_HUGEPAGE: |
294 | case MADV_NOHUGEPAGE: | 300 | case MADV_NOHUGEPAGE: |
295 | #endif | 301 | #endif |
302 | case MADV_DONTDUMP: | ||
303 | case MADV_DODUMP: | ||
296 | return 1; | 304 | return 1; |
297 | 305 | ||
298 | default: | 306 | default: |