Skip to content

Commit

Permalink
fs/proc/kcore.c: don't add modules range to kcore if it's equal to vm…
Browse files Browse the repository at this point in the history
…core range

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 flag
to indicate they 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 are unnecessary.

So check if the modules range is equal to vmalloc range.  If so, just skip
adding the modules range.

Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: Xishi Qiu <qiuxishi@huawei.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Baoquan He authored and hnaz committed Oct 3, 2014
1 parent 2cff1c0 commit be1a4c1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/proc/kcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit be1a4c1

Please sign in to comment.