public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] kallsyms: fix building without printk
@ 2017-11-13 16:50 Arnd Bergmann
  2017-11-13 16:51 ` [PATCH 2/2] /proc/module: fix building without kallsyms Arnd Bergmann
  2017-11-14  1:28 ` [PATCH 1/2] kallsyms: fix building without printk Sergey Senozhatsky
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-11-13 16:50 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Arnd Bergmann, Petr Mladek, Sergey Senozhatsky, Steven Rostedt,
	Andrew Morton, linux-kernel

Building kallsyms fails without CONFIG_PRINTK due to a missing
declaration:

kernel/kallsyms.c: In function 'kallsyms_show_value':
kernel/kallsyms.c:670:10: error: 'kptr_restrict' undeclared (first use in this function); did you mean 'keyring_restrict'?

This moves the declaration outside of the #ifdef guard, the definition
is already available without CONFIG_PRINTK.

Fixes: c0f3ea158939 ("stop using '%pK' for /proc/kallsyms pointer values")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/printk.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/printk.h b/include/linux/printk.h
index fbb75cac9028..e9b603ee9953 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -187,7 +187,6 @@ extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
 
 extern int printk_delay_msec;
 extern int dmesg_restrict;
-extern int kptr_restrict;
 
 extern int
 devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, void __user *buf,
@@ -278,6 +277,8 @@ static inline void printk_safe_flush_on_panic(void)
 }
 #endif
 
+extern int kptr_restrict;
+
 extern asmlinkage void dump_stack(void) __cold;
 
 #ifndef pr_fmt
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] /proc/module: fix building without kallsyms
  2017-11-13 16:50 [PATCH 1/2] kallsyms: fix building without printk Arnd Bergmann
@ 2017-11-13 16:51 ` Arnd Bergmann
  2017-11-14  1:28 ` [PATCH 1/2] kallsyms: fix building without printk Sergey Senozhatsky
  1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-11-13 16:51 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Arnd Bergmann, Thomas Gleixner, linux-kernel

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>
---
 include/linux/kallsyms.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 0a777c5216b1..708f337d780b 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -14,8 +14,6 @@
 #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
 			 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1)
 
-/* How and when do we show kallsyms values? */
-extern int kallsyms_show_value(void);
 #ifndef CONFIG_64BIT
 # define KALLSYM_FMT "%08lx"
 #else
@@ -54,6 +52,9 @@ extern void __print_symbol(const char *fmt, unsigned long address);
 int lookup_symbol_name(unsigned long addr, char *symname);
 int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
 
+/* How and when do we show kallsyms values? */
+extern int kallsyms_show_value(void);
+
 #else /* !CONFIG_KALLSYMS */
 
 static inline unsigned long kallsyms_lookup_name(const char *name)
@@ -112,6 +113,11 @@ static inline int lookup_symbol_attrs(unsigned long addr, unsigned long *size, u
 	return -ERANGE;
 }
 
+static inline int kallsyms_show_value(void)
+{
+	return false;
+}
+
 /* Stupid that this does nothing, but I didn't create this mess. */
 #define __print_symbol(fmt, addr)
 #endif /*CONFIG_KALLSYMS*/
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] kallsyms: fix building without printk
  2017-11-13 16:50 [PATCH 1/2] kallsyms: fix building without printk Arnd Bergmann
  2017-11-13 16:51 ` [PATCH 2/2] /proc/module: fix building without kallsyms Arnd Bergmann
@ 2017-11-14  1:28 ` Sergey Senozhatsky
  1 sibling, 0 replies; 3+ messages in thread
From: Sergey Senozhatsky @ 2017-11-14  1:28 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linus Torvalds, Petr Mladek, Sergey Senozhatsky, Steven Rostedt,
	Andrew Morton, linux-kernel

On (11/13/17 17:50), Arnd Bergmann wrote:
> Building kallsyms fails without CONFIG_PRINTK due to a missing
> declaration:
> 
> kernel/kallsyms.c: In function 'kallsyms_show_value':
> kernel/kallsyms.c:670:10: error: 'kptr_restrict' undeclared (first use in this function); did you mean 'keyring_restrict'?
> 
> This moves the declaration outside of the #ifdef guard, the definition
> is already available without CONFIG_PRINTK.
>
> Fixes: c0f3ea158939 ("stop using '%pK' for /proc/kallsyms pointer values")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

ah, I see what happened. was confused at first, because we
do !PRINTK build tests.

FWIW,
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

thanks.

	-ss

> ---
>  include/linux/printk.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index fbb75cac9028..e9b603ee9953 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -187,7 +187,6 @@ extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
>  
>  extern int printk_delay_msec;
>  extern int dmesg_restrict;
> -extern int kptr_restrict;
>  
>  extern int
>  devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, void __user *buf,
> @@ -278,6 +277,8 @@ static inline void printk_safe_flush_on_panic(void)
>  }
>  #endif
>  
> +extern int kptr_restrict;
> +
>  extern asmlinkage void dump_stack(void) __cold;
>  
>  #ifndef pr_fmt
> -- 
> 2.9.0
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-14  1:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-13 16:50 [PATCH 1/2] kallsyms: fix building without printk Arnd Bergmann
2017-11-13 16:51 ` [PATCH 2/2] /proc/module: fix building without kallsyms Arnd Bergmann
2017-11-14  1:28 ` [PATCH 1/2] kallsyms: fix building without printk Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox