Skip to content

Commit 0eeaf1e

Browse files
maninder42mcgrof
authored andcommitted
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: Onkarnath <[email protected]> Signed-off-by: Onkarnath <[email protected]> Signed-off-by: Maninder Singh <[email protected]> Reviewed-by: Zhen Lei <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]>
1 parent b06e931 commit 0eeaf1e

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

include/linux/kallsyms.h

+3-8
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ static inline void *dereference_symbol_descriptor(void *ptr)
6565
return ptr;
6666
}
6767

68+
/* How and when do we show kallsyms values? */
69+
extern bool kallsyms_show_value(const struct cred *cred);
70+
6871
#ifdef CONFIG_KALLSYMS
6972
unsigned long kallsyms_sym_address(int idx);
7073
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);
9497

9598
int lookup_symbol_name(unsigned long addr, char *symname);
9699

97-
/* How and when do we show kallsyms values? */
98-
extern bool kallsyms_show_value(const struct cred *cred);
99-
100100
#else /* !CONFIG_KALLSYMS */
101101

102102
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)
154154
return -ERANGE;
155155
}
156156

157-
static inline bool kallsyms_show_value(const struct cred *cred)
158-
{
159-
return false;
160-
}
161-
162157
static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *, unsigned long),
163158
void *data)
164159
{

kernel/ksyms_common.c

-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <linux/kallsyms.h>
77
#include <linux/security.h>
88

9-
#ifdef CONFIG_KALLSYMS
109
static inline int kallsyms_for_perf(void)
1110
{
1211
#ifdef CONFIG_PERF_EVENTS
@@ -42,4 +41,3 @@ bool kallsyms_show_value(const struct cred *cred)
4241
return false;
4342
}
4443
}
45-
#endif

0 commit comments

Comments
 (0)