diff options
author | Brian Behlendorf <[email protected]> | 2014-10-01 19:58:11 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2014-10-17 15:11:51 -0700 |
commit | 44778f41100f88e7458d4deb2335ad09ce0bd0ea (patch) | |
tree | bebf3f33775f553de880b4af0d48b641df0a006b /module | |
parent | 89a461e70c13c860d336dc36358bb02172ed6346 (diff) |
Remove kallsyms_lookup_name() wrapper
After the removable of get_vmalloc_info(), the unused global memory
variables, and the optional dcache/icache shrinkers there is no
longer a need for the kallsyms compatibility code. This allows
us to eliminate another brittle area of the code by removing the
kernel upcall this functionality depended on for older kernels.
Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module')
-rw-r--r-- | module/spl/spl-generic.c | 69 | ||||
-rw-r--r-- | module/spl/spl-proc.c | 54 |
2 files changed, 1 insertions, 122 deletions
diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c index dacd0e260..fd68789bc 100644 --- a/module/spl/spl-generic.c +++ b/module/spl/spl-generic.c @@ -59,11 +59,6 @@ MODULE_PARM_DESC(spl_hostid, "The system hostid."); proc_t p0 = { 0 }; EXPORT_SYMBOL(p0); -#ifndef HAVE_KALLSYMS_LOOKUP_NAME -DECLARE_WAIT_QUEUE_HEAD(spl_kallsyms_lookup_name_waitq); -kallsyms_lookup_name_t spl_kallsyms_lookup_name_fn = SYMBOL_POISON; -#endif - #if BITS_PER_LONG == 32 /* * Support 64/64 => 64 division on a 32-bit platform. While the kernel @@ -490,64 +485,6 @@ zone_get_hostid(void *zone) } EXPORT_SYMBOL(zone_get_hostid); -/* - * The kallsyms_lookup_name() kernel function is not an exported symbol in - * Linux 2.6.19 through 2.6.32 inclusive. - * - * This function replaces the functionality by performing an upcall to user - * space where /proc/kallsyms is consulted for the requested address. - * - */ -#define GET_KALLSYMS_ADDR_CMD \ - "exec 0</dev/null " \ - " 1>/proc/sys/kernel/spl/kallsyms_lookup_name " \ - " 2>/dev/null; " \ - "awk '{ if ( $3 == \"kallsyms_lookup_name\" ) { print $1 } }' " \ - " /proc/kallsyms " - -static int -set_kallsyms_lookup_name(void) -{ -#ifndef HAVE_KALLSYMS_LOOKUP_NAME - char *argv[] = { "/bin/sh", - "-c", - GET_KALLSYMS_ADDR_CMD, - NULL }; - char *envp[] = { "HOME=/", - "TERM=linux", - "PATH=/sbin:/usr/sbin:/bin:/usr/bin", - NULL }; - int rc; - - rc = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC); - - /* - * Due to I/O buffering the helper may return successfully before - * the proc handler has a chance to execute. To catch this case - * wait up to 1 second to verify spl_kallsyms_lookup_name_fn was - * updated to a non SYMBOL_POISON value. - */ - if (rc == 0) { - rc = wait_event_timeout(spl_kallsyms_lookup_name_waitq, - spl_kallsyms_lookup_name_fn != SYMBOL_POISON, HZ); - if (rc == 0) - rc = -ETIMEDOUT; - else if (spl_kallsyms_lookup_name_fn == SYMBOL_POISON) - rc = -EFAULT; - else - rc = 0; - } - - if (rc) - printk("SPL: Failed user helper '%s %s %s', rc = %d\n", - argv[0], argv[1], argv[2], rc); - - return (rc); -#else - return (0); -#endif /* HAVE_KALLSYMS_LOOKUP_NAME */ -} - static int __init spl_init(void) { @@ -583,14 +520,10 @@ __init spl_init(void) if ((rc = spl_zlib_init())) SGOTO(out9, rc); - if ((rc = set_kallsyms_lookup_name())) - SGOTO(out10, rc = -EADDRNOTAVAIL); - printk(KERN_NOTICE "SPL: Loaded module v%s-%s%s\n", SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR); SRETURN(rc); -out10: - spl_zlib_fini(); + out9: spl_tsd_fini(); out8: diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c index 9c42c96ea..42733e0d7 100644 --- a/module/spl/spl-proc.c +++ b/module/spl/spl-proc.c @@ -409,51 +409,6 @@ SPL_PROC_HANDLER(proc_dohostid) SRETURN(rc); } -#ifndef HAVE_KALLSYMS_LOOKUP_NAME -SPL_PROC_HANDLER(proc_dokallsyms_lookup_name) -{ - int len, rc = 0; - char *end, str[32]; - SENTRY; - - if (write) { - /* This may only be set once at module load time */ - if (spl_kallsyms_lookup_name_fn != SYMBOL_POISON) - SRETURN(-EEXIST); - - /* We can't use spl_proc_doulongvec_minmax() in the write - * case here because the address while a hex value has no - * leading 0x which confuses the helper function. */ - rc = proc_copyin_string(str, sizeof(str), buffer, *lenp); - if (rc < 0) - SRETURN(rc); - - spl_kallsyms_lookup_name_fn = - (kallsyms_lookup_name_t)simple_strtoul(str, &end, 16); - wake_up(&spl_kallsyms_lookup_name_waitq); - - if (str == end) - SRETURN(-EINVAL); - - *ppos += *lenp; - } else { - len = snprintf(str, sizeof(str), "%lx", - (unsigned long)spl_kallsyms_lookup_name_fn); - if (*ppos >= len) - rc = 0; - else - rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n"); - - if (rc >= 0) { - *lenp = rc; - *ppos += rc; - } - } - - SRETURN(rc); -} -#endif /* HAVE_KALLSYMS_LOOKUP_NAME */ - #ifdef DEBUG_KMEM static void slab_seq_show_headers(struct seq_file *f) @@ -792,15 +747,6 @@ static struct ctl_table spl_table[] = { .mode = 0644, .proc_handler = &proc_dohostid, }, -#ifndef HAVE_KALLSYMS_LOOKUP_NAME - { - .procname = "kallsyms_lookup_name", - .data = &spl_kallsyms_lookup_name_fn, - .maxlen = sizeof(unsigned long), - .mode = 0644, - .proc_handler = &proc_dokallsyms_lookup_name, - }, -#endif #ifdef DEBUG_LOG { .procname = "debug", |