aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/mm/init_64.c4
-rw-r--r--fs/proc/kcore.c19
-rw-r--r--include/linux/mm.h8
-rw-r--r--mm/vmalloc.c2
4 files changed, 28 insertions, 5 deletions
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index d5d23cc24076..5a4398a6006b 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -647,7 +647,7 @@ EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
647 647
648#endif /* CONFIG_MEMORY_HOTPLUG */ 648#endif /* CONFIG_MEMORY_HOTPLUG */
649 649
650static struct kcore_list kcore_modules, kcore_vsyscall; 650static struct kcore_list kcore_vsyscall;
651 651
652void __init mem_init(void) 652void __init mem_init(void)
653{ 653{
@@ -676,8 +676,6 @@ void __init mem_init(void)
676 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; 676 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
677 677
678 /* Register memory areas for /proc/kcore */ 678 /* Register memory areas for /proc/kcore */
679 kclist_add(&kcore_modules, (void *)MODULES_VADDR, MODULES_LEN,
680 KCORE_OTHER);
681 kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START, 679 kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START,
682 VSYSCALL_END - VSYSCALL_START, KCORE_OTHER); 680 VSYSCALL_END - VSYSCALL_START, KCORE_OTHER);
683 681
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index 78970e6f715c..c6a5ec731972 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -490,7 +490,7 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
490 if (m == NULL) { 490 if (m == NULL) {
491 if (clear_user(buffer, tsz)) 491 if (clear_user(buffer, tsz))
492 return -EFAULT; 492 return -EFAULT;
493 } else if (is_vmalloc_addr((void *)start)) { 493 } else if (is_vmalloc_or_module_addr((void *)start)) {
494 char * elf_buf; 494 char * elf_buf;
495 495
496 elf_buf = kzalloc(tsz, GFP_KERNEL); 496 elf_buf = kzalloc(tsz, GFP_KERNEL);
@@ -586,6 +586,22 @@ static void __init proc_kcore_text_init(void)
586} 586}
587#endif 587#endif
588 588
589#if defined(CONFIG_MODULES) && defined(MODULES_VADDR)
590/*
591 * MODULES_VADDR has no intersection with VMALLOC_ADDR.
592 */
593struct kcore_list kcore_modules;
594static void __init add_modules_range(void)
595{
596 kclist_add(&kcore_modules, (void *)MODULES_VADDR,
597 MODULES_END - MODULES_VADDR, KCORE_VMALLOC);
598}
599#else
600static void __init add_modules_range(void)
601{
602}
603#endif
604
589static int __init proc_kcore_init(void) 605static int __init proc_kcore_init(void)
590{ 606{
591 proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, 607 proc_root_kcore = proc_create("kcore", S_IRUSR, NULL,
@@ -595,6 +611,7 @@ static int __init proc_kcore_init(void)
595 /* Store vmalloc area */ 611 /* Store vmalloc area */
596 kclist_add(&kcore_vmalloc, (void *)VMALLOC_START, 612 kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
597 VMALLOC_END - VMALLOC_START, KCORE_VMALLOC); 613 VMALLOC_END - VMALLOC_START, KCORE_VMALLOC);
614 add_modules_range();
598 /* Store direct-map area from physical memory map */ 615 /* Store direct-map area from physical memory map */
599 kcore_update_ram(); 616 kcore_update_ram();
600 hotplug_memory_notifier(kcore_callback, 0); 617 hotplug_memory_notifier(kcore_callback, 0);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 5946e2ff9fe8..b6eae5e3144b 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -285,6 +285,14 @@ static inline int is_vmalloc_addr(const void *x)
285 return 0; 285 return 0;
286#endif 286#endif
287} 287}
288#ifdef CONFIG_MMU
289extern int is_vmalloc_or_module_addr(const void *x);
290#else
291static int is_vmalloc_or_module_addr(const void *x)
292{
293 return 0;
294}
295#endif
288 296
289static inline struct page *compound_head(struct page *page) 297static inline struct page *compound_head(struct page *page)
290{ 298{
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 5535da1d6961..69511e663234 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -184,7 +184,7 @@ static int vmap_page_range(unsigned long start, unsigned long end,
184 return ret; 184 return ret;
185} 185}
186 186
187static inline int is_vmalloc_or_module_addr(const void *x) 187int is_vmalloc_or_module_addr(const void *x)
188{ 188{
189 /* 189 /*
190 * ARM, x86-64 and sparc64 put modules in a special place, 190 * ARM, x86-64 and sparc64 put modules in a special place,