diff options
Diffstat (limited to 'mm/nommu.c')
| -rw-r--r-- | mm/nommu.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/mm/nommu.c b/mm/nommu.c index 4462b6a3fcb9..ed75bc962fbe 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | #include <linux/pagemap.h> | 22 | #include <linux/pagemap.h> |
| 23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
| 24 | #include <linux/vmalloc.h> | 24 | #include <linux/vmalloc.h> |
| 25 | #include <linux/ptrace.h> | 25 | #include <linux/tracehook.h> |
| 26 | #include <linux/blkdev.h> | 26 | #include <linux/blkdev.h> |
| 27 | #include <linux/backing-dev.h> | 27 | #include <linux/backing-dev.h> |
| 28 | #include <linux/mount.h> | 28 | #include <linux/mount.h> |
| @@ -266,6 +266,27 @@ void *vmalloc_node(unsigned long size, int node) | |||
| 266 | } | 266 | } |
| 267 | EXPORT_SYMBOL(vmalloc_node); | 267 | EXPORT_SYMBOL(vmalloc_node); |
| 268 | 268 | ||
| 269 | #ifndef PAGE_KERNEL_EXEC | ||
| 270 | # define PAGE_KERNEL_EXEC PAGE_KERNEL | ||
| 271 | #endif | ||
| 272 | |||
| 273 | /** | ||
| 274 | * vmalloc_exec - allocate virtually contiguous, executable memory | ||
| 275 | * @size: allocation size | ||
| 276 | * | ||
| 277 | * Kernel-internal function to allocate enough pages to cover @size | ||
| 278 | * the page level allocator and map them into contiguous and | ||
| 279 | * executable kernel virtual space. | ||
| 280 | * | ||
| 281 | * For tight control over page level allocator and protection flags | ||
| 282 | * use __vmalloc() instead. | ||
| 283 | */ | ||
| 284 | |||
| 285 | void *vmalloc_exec(unsigned long size) | ||
| 286 | { | ||
| 287 | return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL_EXEC); | ||
| 288 | } | ||
| 289 | |||
| 269 | /** | 290 | /** |
| 270 | * vmalloc_32 - allocate virtually contiguous memory (32bit addressable) | 291 | * vmalloc_32 - allocate virtually contiguous memory (32bit addressable) |
| 271 | * @size: allocation size | 292 | * @size: allocation size |
| @@ -745,7 +766,7 @@ static unsigned long determine_vm_flags(struct file *file, | |||
| 745 | * it's being traced - otherwise breakpoints set in it may interfere | 766 | * it's being traced - otherwise breakpoints set in it may interfere |
| 746 | * with another untraced process | 767 | * with another untraced process |
| 747 | */ | 768 | */ |
| 748 | if ((flags & MAP_PRIVATE) && (current->ptrace & PT_PTRACED)) | 769 | if ((flags & MAP_PRIVATE) && tracehook_expect_breakpoints(current)) |
| 749 | vm_flags &= ~VM_MAYSHARE; | 770 | vm_flags &= ~VM_MAYSHARE; |
| 750 | 771 | ||
| 751 | return vm_flags; | 772 | return vm_flags; |
