Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

/proc/module: fix building without kallsyms

As reported by kernelci and other build bots, we now get a link
failure without CONFIG_KALLSYMS:

module.c:(.text+0xf2c): undefined reference to `kallsyms_show_value'

This adds a dummy helper with the same name that can be used
for compilation. It's not entirely clear to me what this
should return for !CONFIG_KALLSYMS, I picked an unconditional
'false', which leads to the module address being unavailable
to user space.

Link: https://kernelci.org/build/mainline/branch/master/kernel/v4.14-5-g516fb7f2e73d/
Fixes: 516fb7f2e73d ("/proc/module: use the same logic as /proc/kallsyms for address exposure")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Arnd Bergmann and committed by
Linus Torvalds
e4a8ca3b 01c313dd

+8 -2
+8 -2
include/linux/kallsyms.h
··· 14 14 #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \ 15 15 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1) 16 16 17 - /* How and when do we show kallsyms values? */ 18 - extern int kallsyms_show_value(void); 19 17 #ifndef CONFIG_64BIT 20 18 # define KALLSYM_FMT "%08lx" 21 19 #else ··· 51 53 52 54 int lookup_symbol_name(unsigned long addr, char *symname); 53 55 int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name); 56 + 57 + /* How and when do we show kallsyms values? */ 58 + extern int kallsyms_show_value(void); 54 59 55 60 #else /* !CONFIG_KALLSYMS */ 56 61 ··· 111 110 static inline int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name) 112 111 { 113 112 return -ERANGE; 113 + } 114 + 115 + static inline int kallsyms_show_value(void) 116 + { 117 + return false; 114 118 } 115 119 116 120 /* Stupid that this does nothing, but I didn't create this mess. */