aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 4b5200f5f35a..a8430ff13837 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1423,9 +1423,40 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1423 1423
1424 return __get_user_pages(tsk, mm, start, nr_pages, flags, pages, vmas); 1424 return __get_user_pages(tsk, mm, start, nr_pages, flags, pages, vmas);
1425} 1425}
1426
1427EXPORT_SYMBOL(get_user_pages); 1426EXPORT_SYMBOL(get_user_pages);
1428 1427
1428/**
1429 * get_dump_page() - pin user page in memory while writing it to core dump
1430 * @addr: user address
1431 *
1432 * Returns struct page pointer of user page pinned for dump,
1433 * to be freed afterwards by page_cache_release() or put_page().
1434 *
1435 * Returns NULL on any kind of failure - a hole must then be inserted into
1436 * the corefile, to preserve alignment with its headers; and also returns
1437 * NULL wherever the ZERO_PAGE, or an anonymous pte_none, has been found -
1438 * allowing a hole to be left in the corefile to save diskspace.
1439 *
1440 * Called without mmap_sem, but after all other threads have been killed.
1441 */
1442#ifdef CONFIG_ELF_CORE
1443struct page *get_dump_page(unsigned long addr)
1444{
1445 struct vm_area_struct *vma;
1446 struct page *page;
1447
1448 if (__get_user_pages(current, current->mm, addr, 1,
1449 GUP_FLAGS_FORCE, &page, &vma) < 1)
1450 return NULL;
1451 if (page == ZERO_PAGE(0)) {
1452 page_cache_release(page);
1453 return NULL;
1454 }
1455 flush_cache_page(vma, addr, page_to_pfn(page));
1456 return page;
1457}
1458#endif /* CONFIG_ELF_CORE */
1459
1429pte_t *get_locked_pte(struct mm_struct *mm, unsigned long addr, 1460pte_t *get_locked_pte(struct mm_struct *mm, unsigned long addr,
1430 spinlock_t **ptl) 1461 spinlock_t **ptl)
1431{ 1462{