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 <behlendorf1@llnl.gov>
This commit is contained in:
parent
89a461e70c
commit
44778f4110
|
@ -28,7 +28,6 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
|
||||||
SPL_AC_PDE_DATA
|
SPL_AC_PDE_DATA
|
||||||
SPL_AC_MUTEX_OWNER
|
SPL_AC_MUTEX_OWNER
|
||||||
SPL_AC_MUTEX_OWNER_TASK_STRUCT
|
SPL_AC_MUTEX_OWNER_TASK_STRUCT
|
||||||
SPL_AC_KALLSYMS_LOOKUP_NAME
|
|
||||||
SPL_AC_USER_PATH_DIR
|
SPL_AC_USER_PATH_DIR
|
||||||
SPL_AC_SET_FS_PWD
|
SPL_AC_SET_FS_PWD
|
||||||
SPL_AC_SET_FS_PWD_WITH_CONST
|
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_EXPORTED_RWSEM_IS_LOCKED
|
||||||
SPL_AC_KERNEL_FALLOCATE
|
SPL_AC_KERNEL_FALLOCATE
|
||||||
SPL_AC_KERN_PATH
|
SPL_AC_KERN_PATH
|
||||||
SPL_AC_CONFIG_KALLSYMS
|
|
||||||
SPL_AC_CONFIG_ZLIB_INFLATE
|
SPL_AC_CONFIG_ZLIB_INFLATE
|
||||||
SPL_AC_CONFIG_ZLIB_DEFLATE
|
SPL_AC_CONFIG_ZLIB_DEFLATE
|
||||||
SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
|
SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
|
||||||
|
@ -957,25 +955,6 @@ AC_DEFUN([SPL_AC_MUTEX_OWNER_TASK_STRUCT], [
|
||||||
EXTRA_KCFLAGS="$tmp_flags"
|
EXTRA_KCFLAGS="$tmp_flags"
|
||||||
])
|
])
|
||||||
|
|
||||||
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 #
|
||||||
dnl # 3.10 API change,
|
dnl # 3.10 API change,
|
||||||
dnl # PDE is replaced by PDE_DATA
|
dnl # PDE is replaced by PDE_DATA
|
||||||
|
@ -1501,26 +1480,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 #
|
||||||
dnl # zlib inflate compat,
|
dnl # zlib inflate compat,
|
||||||
dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
|
dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
|
||||||
|
|
|
@ -5,7 +5,6 @@ KERNEL_H = \
|
||||||
$(top_srcdir)/include/linux/compiler_compat.h \
|
$(top_srcdir)/include/linux/compiler_compat.h \
|
||||||
$(top_srcdir)/include/linux/delay_compat.h \
|
$(top_srcdir)/include/linux/delay_compat.h \
|
||||||
$(top_srcdir)/include/linux/file_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/list_compat.h \
|
||||||
$(top_srcdir)/include/linux/math64_compat.h \
|
$(top_srcdir)/include/linux/math64_compat.h \
|
||||||
$(top_srcdir)/include/linux/mm_compat.h \
|
$(top_srcdir)/include/linux/mm_compat.h \
|
||||||
|
|
|
@ -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 <behlendorf1@llnl.gov>.
|
|
||||||
* 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 */
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include <linux/file_compat.h>
|
#include <linux/file_compat.h>
|
||||||
#include <linux/list_compat.h>
|
#include <linux/list_compat.h>
|
||||||
#include <linux/bitops_compat.h>
|
#include <linux/bitops_compat.h>
|
||||||
#include <linux/kallsyms_compat.h>
|
|
||||||
#include <linux/module_compat.h>
|
#include <linux/module_compat.h>
|
||||||
#include <linux/sysctl_compat.h>
|
#include <linux/sysctl_compat.h>
|
||||||
#include <linux/proc_compat.h>
|
#include <linux/proc_compat.h>
|
||||||
|
|
|
@ -59,11 +59,6 @@ MODULE_PARM_DESC(spl_hostid, "The system hostid.");
|
||||||
proc_t p0 = { 0 };
|
proc_t p0 = { 0 };
|
||||||
EXPORT_SYMBOL(p0);
|
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
|
#if BITS_PER_LONG == 32
|
||||||
/*
|
/*
|
||||||
* Support 64/64 => 64 division on a 32-bit platform. While the kernel
|
* 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);
|
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
|
static int
|
||||||
__init spl_init(void)
|
__init spl_init(void)
|
||||||
{
|
{
|
||||||
|
@ -583,14 +520,10 @@ __init spl_init(void)
|
||||||
if ((rc = spl_zlib_init()))
|
if ((rc = spl_zlib_init()))
|
||||||
SGOTO(out9, rc);
|
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,
|
printk(KERN_NOTICE "SPL: Loaded module v%s-%s%s\n", SPL_META_VERSION,
|
||||||
SPL_META_RELEASE, SPL_DEBUG_STR);
|
SPL_META_RELEASE, SPL_DEBUG_STR);
|
||||||
SRETURN(rc);
|
SRETURN(rc);
|
||||||
out10:
|
|
||||||
spl_zlib_fini();
|
|
||||||
out9:
|
out9:
|
||||||
spl_tsd_fini();
|
spl_tsd_fini();
|
||||||
out8:
|
out8:
|
||||||
|
|
|
@ -409,51 +409,6 @@ SPL_PROC_HANDLER(proc_dohostid)
|
||||||
SRETURN(rc);
|
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
|
#ifdef DEBUG_KMEM
|
||||||
static void
|
static void
|
||||||
slab_seq_show_headers(struct seq_file *f)
|
slab_seq_show_headers(struct seq_file *f)
|
||||||
|
@ -792,15 +747,6 @@ static struct ctl_table spl_table[] = {
|
||||||
.mode = 0644,
|
.mode = 0644,
|
||||||
.proc_handler = &proc_dohostid,
|
.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
|
#ifdef DEBUG_LOG
|
||||||
{
|
{
|
||||||
.procname = "debug",
|
.procname = "debug",
|
||||||
|
|
Loading…
Reference in New Issue