summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2014-10-01 19:58:11 -0400
committerBrian Behlendorf <[email protected]>2014-10-17 15:11:51 -0700
commit44778f41100f88e7458d4deb2335ad09ce0bd0ea (patch)
treebebf3f33775f553de880b4af0d48b641df0a006b
parent89a461e70c13c860d336dc36358bb02172ed6346 (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]>
-rw-r--r--config/spl-build.m441
-rw-r--r--include/linux/Makefile.am1
-rw-r--r--include/linux/kallsyms_compat.h44
-rw-r--r--include/sys/types.h1
-rw-r--r--module/spl/spl-generic.c69
-rw-r--r--module/spl/spl-proc.c54
6 files changed, 1 insertions, 209 deletions
diff --git a/config/spl-build.m4 b/config/spl-build.m4
index 8761be485..712ad8470 100644
--- a/config/spl-build.m4
+++ b/config/spl-build.m4
@@ -28,7 +28,6 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
SPL_AC_PDE_DATA
SPL_AC_MUTEX_OWNER
SPL_AC_MUTEX_OWNER_TASK_STRUCT
- SPL_AC_KALLSYMS_LOOKUP_NAME
SPL_AC_USER_PATH_DIR
SPL_AC_SET_FS_PWD
SPL_AC_SET_FS_PWD_WITH_CONST
@@ -47,7 +46,6 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
SPL_AC_EXPORTED_RWSEM_IS_LOCKED
SPL_AC_KERNEL_FALLOCATE
SPL_AC_KERN_PATH
- SPL_AC_CONFIG_KALLSYMS
SPL_AC_CONFIG_ZLIB_INFLATE
SPL_AC_CONFIG_ZLIB_DEFLATE
SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
@@ -958,25 +956,6 @@ AC_DEFUN([SPL_AC_MUTEX_OWNER_TASK_STRUCT], [
])
dnl #
-dnl # 2.6.18 API change,
-dnl # kallsyms_lookup_name no longer exported
-dnl #
-AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME],
- [AC_MSG_CHECKING([whether kallsyms_lookup_name() is available])
- SPL_LINUX_TRY_COMPILE_SYMBOL([
- #include <linux/kallsyms.h>
- ], [
- kallsyms_lookup_name(NULL);
- ], [kallsyms_lookup_name], [], [
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
- [kallsyms_lookup_name() is available])
- ], [
- AC_MSG_RESULT(no)
- ])
-])
-
-dnl #
dnl # 3.10 API change,
dnl # PDE is replaced by PDE_DATA
dnl #
@@ -1502,26 +1481,6 @@ AC_DEFUN([SPL_AC_KERN_PATH],
])
dnl #
-dnl # /proc/kallsyms support,
-dnl # Verify the kernel has CONFIG_KALLSYMS support enabled.
-dnl #
-AC_DEFUN([SPL_AC_CONFIG_KALLSYMS], [
- AC_MSG_CHECKING([whether CONFIG_KALLSYMS is defined])
- SPL_LINUX_TRY_COMPILE([
- #if !defined(CONFIG_KALLSYMS)
- #error CONFIG_KALLSYMS not defined
- #endif
- ],[ ],[
- AC_MSG_RESULT([yes])
- ],[
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([
- *** This kernel does not include the required kallsyms support.
- *** Rebuild the kernel with CONFIG_KALLSYMS=y set.])
- ])
-])
-
-dnl #
dnl # zlib inflate compat,
dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
dnl #
diff --git a/include/linux/Makefile.am b/include/linux/Makefile.am
index ac7064d24..bbd422770 100644
--- a/include/linux/Makefile.am
+++ b/include/linux/Makefile.am
@@ -5,7 +5,6 @@ KERNEL_H = \
$(top_srcdir)/include/linux/compiler_compat.h \
$(top_srcdir)/include/linux/delay_compat.h \
$(top_srcdir)/include/linux/file_compat.h \
- $(top_srcdir)/include/linux/kallsyms_compat.h \
$(top_srcdir)/include/linux/list_compat.h \
$(top_srcdir)/include/linux/math64_compat.h \
$(top_srcdir)/include/linux/mm_compat.h \
diff --git a/include/linux/kallsyms_compat.h b/include/linux/kallsyms_compat.h
deleted file mode 100644
index 1c7afa5dd..000000000
--- a/include/linux/kallsyms_compat.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*****************************************************************************\
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <[email protected]>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- * For details, see <http://zfsonlinux.org/>.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
-\*****************************************************************************/
-
-#ifndef _SPL_KALLSYMS_COMPAT_H
-#define _SPL_KALLSYMS_COMPAT_H
-
-#define SYMBOL_POISON ((void*)0xabcddcba)
-
-#ifdef HAVE_KALLSYMS_LOOKUP_NAME
-
-#include <linux/kallsyms.h>
-#define spl_kallsyms_lookup_name(name) kallsyms_lookup_name(name)
-
-#else
-
-extern wait_queue_head_t spl_kallsyms_lookup_name_waitq;
-typedef unsigned long (*kallsyms_lookup_name_t)(const char *);
-extern kallsyms_lookup_name_t spl_kallsyms_lookup_name_fn;
-#define spl_kallsyms_lookup_name(name) spl_kallsyms_lookup_name_fn(name)
-
-#endif /* HAVE_KALLSYMS_LOOKUP_NAME */
-
-#endif /* _SPL_KALLSYMS_COMPAT_H */
diff --git a/include/sys/types.h b/include/sys/types.h
index d34070c3d..2745db9c7 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -31,7 +31,6 @@
#include <linux/file_compat.h>
#include <linux/list_compat.h>
#include <linux/bitops_compat.h>
-#include <linux/kallsyms_compat.h>
#include <linux/module_compat.h>
#include <linux/sysctl_compat.h>
#include <linux/proc_compat.h>
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",