* [PATCH] modules: Fix build error in moduleloader.h
@ 2014-07-03 13:21 Steven Rostedt
2014-07-04 0:53 ` Masami Hiramatsu
2014-07-07 23:40 ` Rusty Russell
0 siblings, 2 replies; 5+ messages in thread
From: Steven Rostedt @ 2014-07-03 13:21 UTC (permalink / raw)
To: Rusty Russell; +Cc: LKML, Andrew Morton, Masami Hiramatsu, Fengguang Wu
Fengguang Wu's build bot detected that if moduleloader.h is included in
a C file (used by ftrace and kprobes to access module_alloc() when
available), that it can fail to build if CONFIG_MODULES and
CONFIG_MODULES_USE_ELF_REL is not defined.
This is because there's a printk() that dereferences struct module to
print the name of the module. But as struct module does not exist when
CONFIG_MODULES is not defined we get this error:
include/linux/moduleloader.h: In function 'apply_relocate':
>> include/linux/moduleloader.h:48:63: error: dereferencing pointer to incomplete type
printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
^
Avoid the printk if CONFIG_MODULES is not set.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
index 560ca53..d9da807 100644
--- a/include/linux/moduleloader.h
+++ b/include/linux/moduleloader.h
@@ -45,7 +45,10 @@ static inline int apply_relocate(Elf_Shdr *sechdrs,
unsigned int relsec,
struct module *me)
{
+/* me->name only exists if modules are enabled */
+#ifdef CONFIG_MODULES
printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
+#endif
return -ENOEXEC;
}
#endif
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] modules: Fix build error in moduleloader.h
2014-07-03 13:21 [PATCH] modules: Fix build error in moduleloader.h Steven Rostedt
@ 2014-07-04 0:53 ` Masami Hiramatsu
2014-07-07 23:40 ` Rusty Russell
1 sibling, 0 replies; 5+ messages in thread
From: Masami Hiramatsu @ 2014-07-04 0:53 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Rusty Russell, LKML, Andrew Morton, Fengguang Wu
(2014/07/03 22:21), Steven Rostedt wrote:
> Fengguang Wu's build bot detected that if moduleloader.h is included in
> a C file (used by ftrace and kprobes to access module_alloc() when
> available), that it can fail to build if CONFIG_MODULES and
> CONFIG_MODULES_USE_ELF_REL is not defined.
>
> This is because there's a printk() that dereferences struct module to
> print the name of the module. But as struct module does not exist when
> CONFIG_MODULES is not defined we get this error:
>
> include/linux/moduleloader.h: In function 'apply_relocate':
>>> include/linux/moduleloader.h:48:63: error: dereferencing pointer to incomplete type
> printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
> ^
> Avoid the printk if CONFIG_MODULES is not set.
Looks OK to me. BTW, CONFIG_KPROBES depends on CONFIG_MODULES,
so currently kprobes itself doesn't hit that problem.
Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Thank you, :)
>
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
> diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
> index 560ca53..d9da807 100644
> --- a/include/linux/moduleloader.h
> +++ b/include/linux/moduleloader.h
> @@ -45,7 +45,10 @@ static inline int apply_relocate(Elf_Shdr *sechdrs,
> unsigned int relsec,
> struct module *me)
> {
> +/* me->name only exists if modules are enabled */
> +#ifdef CONFIG_MODULES
> printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
> +#endif
> return -ENOEXEC;
> }
> #endif
>
--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] modules: Fix build error in moduleloader.h
2014-07-03 13:21 [PATCH] modules: Fix build error in moduleloader.h Steven Rostedt
2014-07-04 0:53 ` Masami Hiramatsu
@ 2014-07-07 23:40 ` Rusty Russell
2014-07-08 2:51 ` Masami Hiramatsu
2014-07-08 15:08 ` Steven Rostedt
1 sibling, 2 replies; 5+ messages in thread
From: Rusty Russell @ 2014-07-07 23:40 UTC (permalink / raw)
To: Steven Rostedt; +Cc: LKML, Andrew Morton, Masami Hiramatsu, Fengguang Wu
Steven Rostedt <rostedt@goodmis.org> writes:
> Fengguang Wu's build bot detected that if moduleloader.h is included in
> a C file (used by ftrace and kprobes to access module_alloc() when
> available), that it can fail to build if CONFIG_MODULES and
> CONFIG_MODULES_USE_ELF_REL is not defined.
>
> This is because there's a printk() that dereferences struct module to
> print the name of the module. But as struct module does not exist when
> CONFIG_MODULES is not defined we get this error:
First, we have module_name() for exactly this.
Second, there are two places like this: you hit
CONFIG_MODULES_USE_ELF_REL and not CONFIG_MODULES_USE_ELF_RELA.
(We could uninline them, and put them in module.c, but I think having
them in the header is nice and self-documenting.)
So does this work for you?
Thanks,
Rusty.
PS. Masami Hiramatsu, your review should have caught the second case,
at least :(
Subject: modules: Fix build error in moduleloader.h
Fengguang Wu's build bot detected that if moduleloader.h is included in
a C file (used by ftrace and kprobes to access module_alloc() when
available), that it can fail to build if CONFIG_MODULES and
CONFIG_MODULES_USE_ELF_REL is not defined.
This is because there's a printk() that dereferences struct module to
print the name of the module. But as struct module does not exist when
CONFIG_MODULES is not defined we get this error:
include/linux/moduleloader.h: In function 'apply_relocate':
>> include/linux/moduleloader.h:48:63: error: dereferencing pointer to
>> incomplete type
printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
^
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Based-on-the-true-story-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
index 560ca53a75fa..7eeb9bbfb816 100644
--- a/include/linux/moduleloader.h
+++ b/include/linux/moduleloader.h
@@ -45,7 +45,8 @@ static inline int apply_relocate(Elf_Shdr *sechdrs,
unsigned int relsec,
struct module *me)
{
- printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
+ printk(KERN_ERR "module %s: REL relocation unsupported\n",
+ module_name(me));
return -ENOEXEC;
}
#endif
@@ -67,7 +68,8 @@ static inline int apply_relocate_add(Elf_Shdr *sechdrs,
unsigned int relsec,
struct module *me)
{
- printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
+ printk(KERN_ERR "module %s: REL relocation unsupported\n",
+ module_name(me));
return -ENOEXEC;
}
#endif
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] modules: Fix build error in moduleloader.h
2014-07-07 23:40 ` Rusty Russell
@ 2014-07-08 2:51 ` Masami Hiramatsu
2014-07-08 15:08 ` Steven Rostedt
1 sibling, 0 replies; 5+ messages in thread
From: Masami Hiramatsu @ 2014-07-08 2:51 UTC (permalink / raw)
To: Rusty Russell; +Cc: Steven Rostedt, LKML, Andrew Morton, Fengguang Wu
(2014/07/08 8:40), Rusty Russell wrote:
> Steven Rostedt <rostedt@goodmis.org> writes:
>> Fengguang Wu's build bot detected that if moduleloader.h is included in
>> a C file (used by ftrace and kprobes to access module_alloc() when
>> available), that it can fail to build if CONFIG_MODULES and
>> CONFIG_MODULES_USE_ELF_REL is not defined.
>>
>> This is because there's a printk() that dereferences struct module to
>> print the name of the module. But as struct module does not exist when
>> CONFIG_MODULES is not defined we get this error:
>
> First, we have module_name() for exactly this.
>
> Second, there are two places like this: you hit
> CONFIG_MODULES_USE_ELF_REL and not CONFIG_MODULES_USE_ELF_RELA.
>
> (We could uninline them, and put them in module.c, but I think having
> them in the header is nice and self-documenting.)
>
> So does this work for you?
>
> Thanks,
> Rusty.
> PS. Masami Hiramatsu, your review should have caught the second case,
> at least :(
Oops, sorry, I missed the second one ... and this version seems good to me.
Thank you,
>
> Subject: modules: Fix build error in moduleloader.h
>
> Fengguang Wu's build bot detected that if moduleloader.h is included in
> a C file (used by ftrace and kprobes to access module_alloc() when
> available), that it can fail to build if CONFIG_MODULES and
> CONFIG_MODULES_USE_ELF_REL is not defined.
>
> This is because there's a printk() that dereferences struct module to
> print the name of the module. But as struct module does not exist when
> CONFIG_MODULES is not defined we get this error:
>
> include/linux/moduleloader.h: In function 'apply_relocate':
>>> include/linux/moduleloader.h:48:63: error: dereferencing pointer to
>>> incomplete type
> printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
> ^
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Based-on-the-true-story-by: Steven Rostedt <rostedt@goodmis.org>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
>
> diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
> index 560ca53a75fa..7eeb9bbfb816 100644
> --- a/include/linux/moduleloader.h
> +++ b/include/linux/moduleloader.h
> @@ -45,7 +45,8 @@ static inline int apply_relocate(Elf_Shdr *sechdrs,
> unsigned int relsec,
> struct module *me)
> {
> - printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
> + printk(KERN_ERR "module %s: REL relocation unsupported\n",
> + module_name(me));
> return -ENOEXEC;
> }
> #endif
> @@ -67,7 +68,8 @@ static inline int apply_relocate_add(Elf_Shdr *sechdrs,
> unsigned int relsec,
> struct module *me)
> {
> - printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
> + printk(KERN_ERR "module %s: REL relocation unsupported\n",
> + module_name(me));
> return -ENOEXEC;
> }
> #endif
>
--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] modules: Fix build error in moduleloader.h
2014-07-07 23:40 ` Rusty Russell
2014-07-08 2:51 ` Masami Hiramatsu
@ 2014-07-08 15:08 ` Steven Rostedt
1 sibling, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2014-07-08 15:08 UTC (permalink / raw)
To: Rusty Russell; +Cc: LKML, Andrew Morton, Masami Hiramatsu, Fengguang Wu
On Tue, 08 Jul 2014 09:10:09 +0930
Rusty Russell <rusty@rustcorp.com.au> wrote:
> Subject: modules: Fix build error in moduleloader.h
>
> Fengguang Wu's build bot detected that if moduleloader.h is included in
> a C file (used by ftrace and kprobes to access module_alloc() when
> available), that it can fail to build if CONFIG_MODULES and
> CONFIG_MODULES_USE_ELF_REL is not defined.
>
> This is because there's a printk() that dereferences struct module to
> print the name of the module. But as struct module does not exist when
> CONFIG_MODULES is not defined we get this error:
>
> include/linux/moduleloader.h: In function 'apply_relocate':
> >> include/linux/moduleloader.h:48:63: error: dereferencing pointer to
> >> incomplete type
> printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
> ^
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Based-on-the-true-story-by: Steven Rostedt <rostedt@goodmis.org>
Confirms-rustys-story-ends-the-same-by: Steven Rostedt <rostedt@goodmis.org>
-- Steve
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-07-08 15:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-03 13:21 [PATCH] modules: Fix build error in moduleloader.h Steven Rostedt
2014-07-04 0:53 ` Masami Hiramatsu
2014-07-07 23:40 ` Rusty Russell
2014-07-08 2:51 ` Masami Hiramatsu
2014-07-08 15:08 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox