diff options
-rw-r--r-- | kernel/module.c | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/kernel/module.c b/kernel/module.c index 14b8e82e05d4..b02d6335f8a6 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -62,12 +62,6 @@ | |||
62 | #define CREATE_TRACE_POINTS | 62 | #define CREATE_TRACE_POINTS |
63 | #include <trace/events/module.h> | 63 | #include <trace/events/module.h> |
64 | 64 | ||
65 | #if 0 | ||
66 | #define DEBUGP printk | ||
67 | #else | ||
68 | #define DEBUGP(fmt , a...) | ||
69 | #endif | ||
70 | |||
71 | #ifndef ARCH_SHF_SMALL | 65 | #ifndef ARCH_SHF_SMALL |
72 | #define ARCH_SHF_SMALL 0 | 66 | #define ARCH_SHF_SMALL 0 |
73 | #endif | 67 | #endif |
@@ -409,7 +403,7 @@ const struct kernel_symbol *find_symbol(const char *name, | |||
409 | return fsa.sym; | 403 | return fsa.sym; |
410 | } | 404 | } |
411 | 405 | ||
412 | DEBUGP("Failed to find symbol %s\n", name); | 406 | pr_debug("Failed to find symbol %s\n", name); |
413 | return NULL; | 407 | return NULL; |
414 | } | 408 | } |
415 | EXPORT_SYMBOL_GPL(find_symbol); | 409 | EXPORT_SYMBOL_GPL(find_symbol); |
@@ -599,11 +593,11 @@ static int already_uses(struct module *a, struct module *b) | |||
599 | 593 | ||
600 | list_for_each_entry(use, &b->source_list, source_list) { | 594 | list_for_each_entry(use, &b->source_list, source_list) { |
601 | if (use->source == a) { | 595 | if (use->source == a) { |
602 | DEBUGP("%s uses %s!\n", a->name, b->name); | 596 | pr_debug("%s uses %s!\n", a->name, b->name); |
603 | return 1; | 597 | return 1; |
604 | } | 598 | } |
605 | } | 599 | } |
606 | DEBUGP("%s does not use %s!\n", a->name, b->name); | 600 | pr_debug("%s does not use %s!\n", a->name, b->name); |
607 | return 0; | 601 | return 0; |
608 | } | 602 | } |
609 | 603 | ||
@@ -618,7 +612,7 @@ static int add_module_usage(struct module *a, struct module *b) | |||
618 | { | 612 | { |
619 | struct module_use *use; | 613 | struct module_use *use; |
620 | 614 | ||
621 | DEBUGP("Allocating new usage for %s.\n", a->name); | 615 | pr_debug("Allocating new usage for %s.\n", a->name); |
622 | use = kmalloc(sizeof(*use), GFP_ATOMIC); | 616 | use = kmalloc(sizeof(*use), GFP_ATOMIC); |
623 | if (!use) { | 617 | if (!use) { |
624 | printk(KERN_WARNING "%s: out of memory loading\n", a->name); | 618 | printk(KERN_WARNING "%s: out of memory loading\n", a->name); |
@@ -662,7 +656,7 @@ static void module_unload_free(struct module *mod) | |||
662 | mutex_lock(&module_mutex); | 656 | mutex_lock(&module_mutex); |
663 | list_for_each_entry_safe(use, tmp, &mod->target_list, target_list) { | 657 | list_for_each_entry_safe(use, tmp, &mod->target_list, target_list) { |
664 | struct module *i = use->target; | 658 | struct module *i = use->target; |
665 | DEBUGP("%s unusing %s\n", mod->name, i->name); | 659 | pr_debug("%s unusing %s\n", mod->name, i->name); |
666 | module_put(i); | 660 | module_put(i); |
667 | list_del(&use->source_list); | 661 | list_del(&use->source_list); |
668 | list_del(&use->target_list); | 662 | list_del(&use->target_list); |
@@ -760,7 +754,7 @@ static void wait_for_zero_refcount(struct module *mod) | |||
760 | /* Since we might sleep for some time, release the mutex first */ | 754 | /* Since we might sleep for some time, release the mutex first */ |
761 | mutex_unlock(&module_mutex); | 755 | mutex_unlock(&module_mutex); |
762 | for (;;) { | 756 | for (;;) { |
763 | DEBUGP("Looking at refcount...\n"); | 757 | pr_debug("Looking at refcount...\n"); |
764 | set_current_state(TASK_UNINTERRUPTIBLE); | 758 | set_current_state(TASK_UNINTERRUPTIBLE); |
765 | if (module_refcount(mod) == 0) | 759 | if (module_refcount(mod) == 0) |
766 | break; | 760 | break; |
@@ -803,7 +797,7 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user, | |||
803 | if (mod->state != MODULE_STATE_LIVE) { | 797 | if (mod->state != MODULE_STATE_LIVE) { |
804 | /* FIXME: if (force), slam module count and wake up | 798 | /* FIXME: if (force), slam module count and wake up |
805 | waiter --RR */ | 799 | waiter --RR */ |
806 | DEBUGP("%s already dying\n", mod->name); | 800 | pr_debug("%s already dying\n", mod->name); |
807 | ret = -EBUSY; | 801 | ret = -EBUSY; |
808 | goto out; | 802 | goto out; |
809 | } | 803 | } |
@@ -1056,7 +1050,7 @@ static int check_version(Elf_Shdr *sechdrs, | |||
1056 | 1050 | ||
1057 | if (versions[i].crc == maybe_relocated(*crc, crc_owner)) | 1051 | if (versions[i].crc == maybe_relocated(*crc, crc_owner)) |
1058 | return 1; | 1052 | return 1; |
1059 | DEBUGP("Found checksum %lX vs module %lX\n", | 1053 | pr_debug("Found checksum %lX vs module %lX\n", |
1060 | maybe_relocated(*crc, crc_owner), versions[i].crc); | 1054 | maybe_relocated(*crc, crc_owner), versions[i].crc); |
1061 | goto bad_version; | 1055 | goto bad_version; |
1062 | } | 1056 | } |
@@ -1833,7 +1827,7 @@ static int simplify_symbols(struct module *mod, const struct load_info *info) | |||
1833 | case SHN_COMMON: | 1827 | case SHN_COMMON: |
1834 | /* We compiled with -fno-common. These are not | 1828 | /* We compiled with -fno-common. These are not |
1835 | supposed to happen. */ | 1829 | supposed to happen. */ |
1836 | DEBUGP("Common symbol: %s\n", name); | 1830 | pr_debug("Common symbol: %s\n", name); |
1837 | printk("%s: please compile with -fno-common\n", | 1831 | printk("%s: please compile with -fno-common\n", |
1838 | mod->name); | 1832 | mod->name); |
1839 | ret = -ENOEXEC; | 1833 | ret = -ENOEXEC; |
@@ -1841,7 +1835,7 @@ static int simplify_symbols(struct module *mod, const struct load_info *info) | |||
1841 | 1835 | ||
1842 | case SHN_ABS: | 1836 | case SHN_ABS: |
1843 | /* Don't need to do anything */ | 1837 | /* Don't need to do anything */ |
1844 | DEBUGP("Absolute symbol: 0x%08lx\n", | 1838 | pr_debug("Absolute symbol: 0x%08lx\n", |
1845 | (long)sym[i].st_value); | 1839 | (long)sym[i].st_value); |
1846 | break; | 1840 | break; |
1847 | 1841 | ||
@@ -1965,7 +1959,7 @@ static void layout_sections(struct module *mod, struct load_info *info) | |||
1965 | for (i = 0; i < info->hdr->e_shnum; i++) | 1959 | for (i = 0; i < info->hdr->e_shnum; i++) |
1966 | info->sechdrs[i].sh_entsize = ~0UL; | 1960 | info->sechdrs[i].sh_entsize = ~0UL; |
1967 | 1961 | ||
1968 | DEBUGP("Core section allocation order:\n"); | 1962 | pr_debug("Core section allocation order:\n"); |
1969 | for (m = 0; m < ARRAY_SIZE(masks); ++m) { | 1963 | for (m = 0; m < ARRAY_SIZE(masks); ++m) { |
1970 | for (i = 0; i < info->hdr->e_shnum; ++i) { | 1964 | for (i = 0; i < info->hdr->e_shnum; ++i) { |
1971 | Elf_Shdr *s = &info->sechdrs[i]; | 1965 | Elf_Shdr *s = &info->sechdrs[i]; |
@@ -1977,7 +1971,7 @@ static void layout_sections(struct module *mod, struct load_info *info) | |||
1977 | || strstarts(sname, ".init")) | 1971 | || strstarts(sname, ".init")) |
1978 | continue; | 1972 | continue; |
1979 | s->sh_entsize = get_offset(mod, &mod->core_size, s, i); | 1973 | s->sh_entsize = get_offset(mod, &mod->core_size, s, i); |
1980 | DEBUGP("\t%s\n", name); | 1974 | pr_debug("\t%s\n", sname); |
1981 | } | 1975 | } |
1982 | switch (m) { | 1976 | switch (m) { |
1983 | case 0: /* executable */ | 1977 | case 0: /* executable */ |
@@ -1994,7 +1988,7 @@ static void layout_sections(struct module *mod, struct load_info *info) | |||
1994 | } | 1988 | } |
1995 | } | 1989 | } |
1996 | 1990 | ||
1997 | DEBUGP("Init section allocation order:\n"); | 1991 | pr_debug("Init section allocation order:\n"); |
1998 | for (m = 0; m < ARRAY_SIZE(masks); ++m) { | 1992 | for (m = 0; m < ARRAY_SIZE(masks); ++m) { |
1999 | for (i = 0; i < info->hdr->e_shnum; ++i) { | 1993 | for (i = 0; i < info->hdr->e_shnum; ++i) { |
2000 | Elf_Shdr *s = &info->sechdrs[i]; | 1994 | Elf_Shdr *s = &info->sechdrs[i]; |
@@ -2007,7 +2001,7 @@ static void layout_sections(struct module *mod, struct load_info *info) | |||
2007 | continue; | 2001 | continue; |
2008 | s->sh_entsize = (get_offset(mod, &mod->init_size, s, i) | 2002 | s->sh_entsize = (get_offset(mod, &mod->init_size, s, i) |
2009 | | INIT_OFFSET_MASK); | 2003 | | INIT_OFFSET_MASK); |
2010 | DEBUGP("\t%s\n", sname); | 2004 | pr_debug("\t%s\n", sname); |
2011 | } | 2005 | } |
2012 | switch (m) { | 2006 | switch (m) { |
2013 | case 0: /* executable */ | 2007 | case 0: /* executable */ |
@@ -2195,7 +2189,7 @@ static void layout_symtab(struct module *mod, struct load_info *info) | |||
2195 | symsect->sh_flags |= SHF_ALLOC; | 2189 | symsect->sh_flags |= SHF_ALLOC; |
2196 | symsect->sh_entsize = get_offset(mod, &mod->init_size, symsect, | 2190 | symsect->sh_entsize = get_offset(mod, &mod->init_size, symsect, |
2197 | info->index.sym) | INIT_OFFSET_MASK; | 2191 | info->index.sym) | INIT_OFFSET_MASK; |
2198 | DEBUGP("\t%s\n", info->secstrings + symsect->sh_name); | 2192 | pr_debug("\t%s\n", info->secstrings + symsect->sh_name); |
2199 | 2193 | ||
2200 | src = (void *)info->hdr + symsect->sh_offset; | 2194 | src = (void *)info->hdr + symsect->sh_offset; |
2201 | nsrc = symsect->sh_size / sizeof(*src); | 2195 | nsrc = symsect->sh_size / sizeof(*src); |
@@ -2216,7 +2210,7 @@ static void layout_symtab(struct module *mod, struct load_info *info) | |||
2216 | strsect->sh_flags |= SHF_ALLOC; | 2210 | strsect->sh_flags |= SHF_ALLOC; |
2217 | strsect->sh_entsize = get_offset(mod, &mod->init_size, strsect, | 2211 | strsect->sh_entsize = get_offset(mod, &mod->init_size, strsect, |
2218 | info->index.str) | INIT_OFFSET_MASK; | 2212 | info->index.str) | INIT_OFFSET_MASK; |
2219 | DEBUGP("\t%s\n", info->secstrings + strsect->sh_name); | 2213 | pr_debug("\t%s\n", info->secstrings + strsect->sh_name); |
2220 | } | 2214 | } |
2221 | 2215 | ||
2222 | static void add_kallsyms(struct module *mod, const struct load_info *info) | 2216 | static void add_kallsyms(struct module *mod, const struct load_info *info) |
@@ -2618,7 +2612,7 @@ static int move_module(struct module *mod, struct load_info *info) | |||
2618 | mod->module_init = ptr; | 2612 | mod->module_init = ptr; |
2619 | 2613 | ||
2620 | /* Transfer each section which specifies SHF_ALLOC */ | 2614 | /* Transfer each section which specifies SHF_ALLOC */ |
2621 | DEBUGP("final section addresses:\n"); | 2615 | pr_debug("final section addresses:\n"); |
2622 | for (i = 0; i < info->hdr->e_shnum; i++) { | 2616 | for (i = 0; i < info->hdr->e_shnum; i++) { |
2623 | void *dest; | 2617 | void *dest; |
2624 | Elf_Shdr *shdr = &info->sechdrs[i]; | 2618 | Elf_Shdr *shdr = &info->sechdrs[i]; |
@@ -2636,8 +2630,8 @@ static int move_module(struct module *mod, struct load_info *info) | |||
2636 | memcpy(dest, (void *)shdr->sh_addr, shdr->sh_size); | 2630 | memcpy(dest, (void *)shdr->sh_addr, shdr->sh_size); |
2637 | /* Update sh_addr to point to copy in image. */ | 2631 | /* Update sh_addr to point to copy in image. */ |
2638 | shdr->sh_addr = (unsigned long)dest; | 2632 | shdr->sh_addr = (unsigned long)dest; |
2639 | DEBUGP("\t0x%lx %s\n", | 2633 | pr_debug("\t0x%lx %s\n", |
2640 | shdr->sh_addr, info->secstrings + shdr->sh_name); | 2634 | (long)shdr->sh_addr, info->secstrings + shdr->sh_name); |
2641 | } | 2635 | } |
2642 | 2636 | ||
2643 | return 0; | 2637 | return 0; |
@@ -2798,7 +2792,7 @@ static struct module *load_module(void __user *umod, | |||
2798 | struct module *mod; | 2792 | struct module *mod; |
2799 | long err; | 2793 | long err; |
2800 | 2794 | ||
2801 | DEBUGP("load_module: umod=%p, len=%lu, uargs=%p\n", | 2795 | pr_debug("load_module: umod=%p, len=%lu, uargs=%p\n", |
2802 | umod, len, uargs); | 2796 | umod, len, uargs); |
2803 | 2797 | ||
2804 | /* Copy in the blobs from userspace, check they are vaguely sane. */ | 2798 | /* Copy in the blobs from userspace, check they are vaguely sane. */ |