With CONFIG_INTERMIX_VMALLOC, we can no longer assume all vmalloc
is contained between VMALLOC_START and VMALLOC_END. For code that
relies on operating on the vmalloc space, use
for_each_potential_vmalloc_area to track each area separately.

Signed-off-by: Laura Abbott <lau...@codeaurora.org>
---
 fs/proc/kcore.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index 5ed0e52..9be81a8 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -585,8 +585,6 @@ static struct notifier_block kcore_callback_nb 
__meminitdata = {
        .priority = 0,
 };
 
-static struct kcore_list kcore_vmalloc;
-
 #ifdef CONFIG_ARCH_PROC_KCORE_TEXT
 static struct kcore_list kcore_text;
 /*
@@ -621,6 +619,11 @@ static void __init add_modules_range(void)
 
 static int __init proc_kcore_init(void)
 {
+       struct kcore_list *kcore_vmalloc;
+       unsigned long vstart;
+       unsigned long vend;
+       int i;
+
        proc_root_kcore = proc_create("kcore", S_IRUSR, NULL,
                                      &proc_kcore_operations);
        if (!proc_root_kcore) {
@@ -629,9 +632,16 @@ static int __init proc_kcore_init(void)
        }
        /* Store text area if it's special */
        proc_kcore_text_init();
-       /* Store vmalloc area */
-       kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
-               VMALLOC_END - VMALLOC_START, KCORE_VMALLOC);
+       for_each_potential_vmalloc_area(&vstart, &vend, &i) {
+               kcore_vmalloc = kzalloc(sizeof(*kcore_vmalloc), GFP_KERNEL);
+               if (!kcore_vmalloc)
+                       return 0;
+
+               /* Store vmalloc area */
+               kclist_add(kcore_vmalloc, (void *)vstart,
+                               vend - vstart, KCORE_VMALLOC);
+       }
+
        add_modules_range();
        /* Store direct-map area from physical memory map */
        kcore_update_ram();
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to