mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Cc: Baoquan He <bhe@redhat.com>
Subject: [PATCH v3] not adding modules range to kcore if it's equal to vmcore range
Date: Tue, 26 Aug 2014 19:38:25 +0800	[thread overview]
Message-ID: <1409053105-3631-1-git-send-email-bhe@redhat.com> (raw)

On some ARCHs modules range is eauql to vmalloc range. E.g on i686
"#define MODULES_VADDR   VMALLOC_START"
"#define MODULES_END     VMALLOC_END"
This will cause 2 duplicate program segments in /proc/kcore, and no
any flag to indicate both of them are different. This is confusing.

And usually people who need check the elf header or read the content
of kcore will check memory ranges. Two program segments which are the
same completely can't give any help on this.

So in this patch a judgment added to check if modules range is equal
to or included in vmalloc range completely. If yes, just skip adding
the modules range. If and only if modules range is not completely
included in vmalloc range just add it since the part out of vmalloc
range need be accessible.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 fs/proc/kcore.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index 6df8d07..a4b7ff1 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -610,8 +610,11 @@ static void __init proc_kcore_text_init(void)
 struct kcore_list kcore_modules;
 static void __init add_modules_range(void)
 {
-	kclist_add(&kcore_modules, (void *)MODULES_VADDR,
+	if ( (MODULES_VADDR != VMALLOC_START) &&
+		(MODULES_END <= VMALLOC_END) ) {
+		kclist_add(&kcore_modules, (void *)MODULES_VADDR,
 			MODULES_END - MODULES_VADDR, KCORE_VMALLOC);
+	}
 }
 #else
 static void __init add_modules_range(void)
-- 
1.9.0


             reply	other threads:[~2014-08-26 11:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-26 11:38 Baoquan He [this message]
2014-08-26 11:53 ` Baoquan He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1409053105-3631-1-git-send-email-bhe@redhat.com \
    --to=bhe@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®