Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164770
b: refs/heads/master
c: 81ac3ad
h: refs/heads/master
v: v3
  • Loading branch information
KAMEZAWA Hiroyuki authored and Linus Torvalds committed Sep 23, 2009
1 parent fe61b28 commit 6c25ab2
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 26562c59fa9111ae3ea7b78045889662aac9e5ac
refs/heads/master: 81ac3ad9061dd9cd490ee92f0c5316a14d77ce18
4 changes: 1 addition & 3 deletions trunk/arch/x86/mm/init_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);

#endif /* CONFIG_MEMORY_HOTPLUG */

static struct kcore_list kcore_modules, kcore_vsyscall;
static struct kcore_list kcore_vsyscall;

void __init mem_init(void)
{
Expand Down Expand Up @@ -676,8 +676,6 @@ void __init mem_init(void)
initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;

/* Register memory areas for /proc/kcore */
kclist_add(&kcore_modules, (void *)MODULES_VADDR, MODULES_LEN,
KCORE_OTHER);
kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START,
VSYSCALL_END - VSYSCALL_START, KCORE_OTHER);

Expand Down
19 changes: 18 additions & 1 deletion trunk/fs/proc/kcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
if (m == NULL) {
if (clear_user(buffer, tsz))
return -EFAULT;
} else if (is_vmalloc_addr((void *)start)) {
} else if (is_vmalloc_or_module_addr((void *)start)) {
char * elf_buf;

elf_buf = kzalloc(tsz, GFP_KERNEL);
Expand Down Expand Up @@ -586,6 +586,22 @@ static void __init proc_kcore_text_init(void)
}
#endif

#if defined(CONFIG_MODULES) && defined(MODULES_VADDR)
/*
* MODULES_VADDR has no intersection with VMALLOC_ADDR.
*/
struct kcore_list kcore_modules;
static void __init add_modules_range(void)
{
kclist_add(&kcore_modules, (void *)MODULES_VADDR,
MODULES_END - MODULES_VADDR, KCORE_VMALLOC);
}
#else
static void __init add_modules_range(void)
{
}
#endif

static int __init proc_kcore_init(void)
{
proc_root_kcore = proc_create("kcore", S_IRUSR, NULL,
Expand All @@ -595,6 +611,7 @@ static int __init proc_kcore_init(void)
/* Store vmalloc area */
kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
VMALLOC_END - VMALLOC_START, KCORE_VMALLOC);
add_modules_range();
/* Store direct-map area from physical memory map */
kcore_update_ram();
hotplug_memory_notifier(kcore_callback, 0);
Expand Down
8 changes: 8 additions & 0 deletions trunk/include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ static inline int is_vmalloc_addr(const void *x)
return 0;
#endif
}
#ifdef CONFIG_MMU
extern int is_vmalloc_or_module_addr(const void *x);
#else
static int is_vmalloc_or_module_addr(const void *x)
{
return 0;
}
#endif

static inline struct page *compound_head(struct page *page)
{
Expand Down
2 changes: 1 addition & 1 deletion trunk/mm/vmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ static int vmap_page_range(unsigned long start, unsigned long end,
return ret;
}

static inline int is_vmalloc_or_module_addr(const void *x)
int is_vmalloc_or_module_addr(const void *x)
{
/*
* ARM, x86-64 and sparc64 put modules in a special place,
Expand Down

0 comments on commit 6c25ab2

Please sign in to comment.