diff options
Diffstat (limited to 'mm/nommu.c')
-rw-r--r-- | mm/nommu.c | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/mm/nommu.c b/mm/nommu.c index 88ff091eb07a..3613517c7592 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/personality.h> | 29 | #include <linux/personality.h> |
30 | #include <linux/security.h> | 30 | #include <linux/security.h> |
31 | #include <linux/syscalls.h> | 31 | #include <linux/syscalls.h> |
32 | #include <linux/audit.h> | ||
32 | 33 | ||
33 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
34 | #include <asm/tlb.h> | 35 | #include <asm/tlb.h> |
@@ -293,11 +294,58 @@ void *vmalloc(unsigned long size) | |||
293 | } | 294 | } |
294 | EXPORT_SYMBOL(vmalloc); | 295 | EXPORT_SYMBOL(vmalloc); |
295 | 296 | ||
297 | /* | ||
298 | * vzalloc - allocate virtually continguos memory with zero fill | ||
299 | * | ||
300 | * @size: allocation size | ||
301 | * | ||
302 | * Allocate enough pages to cover @size from the page level | ||
303 | * allocator and map them into continguos kernel virtual space. | ||
304 | * The memory allocated is set to zero. | ||
305 | * | ||
306 | * For tight control over page level allocator and protection flags | ||
307 | * use __vmalloc() instead. | ||
308 | */ | ||
309 | void *vzalloc(unsigned long size) | ||
310 | { | ||
311 | return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, | ||
312 | PAGE_KERNEL); | ||
313 | } | ||
314 | EXPORT_SYMBOL(vzalloc); | ||
315 | |||
316 | /** | ||
317 | * vmalloc_node - allocate memory on a specific node | ||
318 | * @size: allocation size | ||
319 | * @node: numa node | ||
320 | * | ||
321 | * Allocate enough pages to cover @size from the page level | ||
322 | * allocator and map them into contiguous kernel virtual space. | ||
323 | * | ||
324 | * For tight control over page level allocator and protection flags | ||
325 | * use __vmalloc() instead. | ||
326 | */ | ||
296 | void *vmalloc_node(unsigned long size, int node) | 327 | void *vmalloc_node(unsigned long size, int node) |
297 | { | 328 | { |
298 | return vmalloc(size); | 329 | return vmalloc(size); |
299 | } | 330 | } |
300 | EXPORT_SYMBOL(vmalloc_node); | 331 | |
332 | /** | ||
333 | * vzalloc_node - allocate memory on a specific node with zero fill | ||
334 | * @size: allocation size | ||
335 | * @node: numa node | ||
336 | * | ||
337 | * Allocate enough pages to cover @size from the page level | ||
338 | * allocator and map them into contiguous kernel virtual space. | ||
339 | * The memory allocated is set to zero. | ||
340 | * | ||
341 | * For tight control over page level allocator and protection flags | ||
342 | * use __vmalloc() instead. | ||
343 | */ | ||
344 | void *vzalloc_node(unsigned long size, int node) | ||
345 | { | ||
346 | return vzalloc(size); | ||
347 | } | ||
348 | EXPORT_SYMBOL(vzalloc_node); | ||
301 | 349 | ||
302 | #ifndef PAGE_KERNEL_EXEC | 350 | #ifndef PAGE_KERNEL_EXEC |
303 | # define PAGE_KERNEL_EXEC PAGE_KERNEL | 351 | # define PAGE_KERNEL_EXEC PAGE_KERNEL |
@@ -1411,6 +1459,7 @@ SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, | |||
1411 | struct file *file = NULL; | 1459 | struct file *file = NULL; |
1412 | unsigned long retval = -EBADF; | 1460 | unsigned long retval = -EBADF; |
1413 | 1461 | ||
1462 | audit_mmap_fd(fd, flags); | ||
1414 | if (!(flags & MAP_ANONYMOUS)) { | 1463 | if (!(flags & MAP_ANONYMOUS)) { |
1415 | file = fget(fd); | 1464 | file = fget(fd); |
1416 | if (!file) | 1465 | if (!file) |