Commit 0eeaf1eb authored by Maninder Singh's avatar Maninder Singh Committed by Luis Chamberlain

kallsyms: make kallsyms_show_value() as generic function

This change makes function kallsyms_show_value() as
generic function without dependency on CONFIG_KALLSYMS.

Now module address will be displayed with lsmod and /proc/modules.

Earlier:
=======
/ # insmod  test.ko
/ # lsmod
test 12288 0 - Live 0x0000000000000000 (O)  // No Module Load address
/ #

With change:
==========
/ # insmod test.ko
/ # lsmod
test 12288 0 - Live 0xffff800000fc0000 (O)  // Module address
/ # cat /proc/modules
test 12288 0 - Live 0xffff800000fc0000 (O)
Co-developed-by: default avatarOnkarnath <onkarnath.1@samsung.com>
Signed-off-by: default avatarOnkarnath <onkarnath.1@samsung.com>
Signed-off-by: default avatarManinder Singh <maninder1.s@samsung.com>
Reviewed-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
parent b06e9318
...@@ -65,6 +65,9 @@ static inline void *dereference_symbol_descriptor(void *ptr) ...@@ -65,6 +65,9 @@ static inline void *dereference_symbol_descriptor(void *ptr)
return ptr; return ptr;
} }
/* How and when do we show kallsyms values? */
extern bool kallsyms_show_value(const struct cred *cred);
#ifdef CONFIG_KALLSYMS #ifdef CONFIG_KALLSYMS
unsigned long kallsyms_sym_address(int idx); unsigned long kallsyms_sym_address(int idx);
int kallsyms_on_each_symbol(int (*fn)(void *, const char *, unsigned long), int kallsyms_on_each_symbol(int (*fn)(void *, const char *, unsigned long),
...@@ -94,9 +97,6 @@ extern int sprint_backtrace_build_id(char *buffer, unsigned long address); ...@@ -94,9 +97,6 @@ extern int sprint_backtrace_build_id(char *buffer, unsigned long address);
int lookup_symbol_name(unsigned long addr, char *symname); int lookup_symbol_name(unsigned long addr, char *symname);
/* How and when do we show kallsyms values? */
extern bool kallsyms_show_value(const struct cred *cred);
#else /* !CONFIG_KALLSYMS */ #else /* !CONFIG_KALLSYMS */
static inline unsigned long kallsyms_lookup_name(const char *name) static inline unsigned long kallsyms_lookup_name(const char *name)
...@@ -154,11 +154,6 @@ static inline int lookup_symbol_name(unsigned long addr, char *symname) ...@@ -154,11 +154,6 @@ static inline int lookup_symbol_name(unsigned long addr, char *symname)
return -ERANGE; return -ERANGE;
} }
static inline bool kallsyms_show_value(const struct cred *cred)
{
return false;
}
static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *, unsigned long), static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *, unsigned long),
void *data) void *data)
{ {
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <linux/kallsyms.h> #include <linux/kallsyms.h>
#include <linux/security.h> #include <linux/security.h>
#ifdef CONFIG_KALLSYMS
static inline int kallsyms_for_perf(void) static inline int kallsyms_for_perf(void)
{ {
#ifdef CONFIG_PERF_EVENTS #ifdef CONFIG_PERF_EVENTS
...@@ -42,4 +41,3 @@ bool kallsyms_show_value(const struct cred *cred) ...@@ -42,4 +41,3 @@ bool kallsyms_show_value(const struct cred *cred)
return false; return false;
} }
} }
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment