diff mbox series

module: add stub for within_module

Message ID 20190407022558.65489-1-trong@android.com (mailing list archive)
State New, archived
Headers show
Series module: add stub for within_module | expand

Commit Message

Tri Vo April 7, 2019, 2:25 a.m. UTC
Provide a stub for within_module() when CONFIG_MODULES is not set. This
is needed to build CONFIG_GCOV_KERNEL.

Fixes: 8c3d220cb6b5 ("gcov: clang support")
Suggested-by: Matthew Wilcox <willy@infradead.org>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kbuild test robot <lkp@intel.com>
Link: https://marc.info/?l=linux-mm&m=155384681109231&w=2
Signed-off-by: Tri Vo <trong@android.com>
---
 include/linux/module.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Nick Desaulniers April 8, 2019, 6:08 p.m. UTC | #1
On Sat, Apr 6, 2019 at 7:26 PM Tri Vo <trong@android.com> wrote:
>
> Provide a stub for within_module() when CONFIG_MODULES is not set. This
> is needed to build CONFIG_GCOV_KERNEL.
>
> Fixes: 8c3d220cb6b5 ("gcov: clang support")

The above commit got backed out of the -mm tree, due to the issue this
patch addresses, so not sure it provides the correct context for the
patch.  Maybe that line in the commit message should be dropped?

> Suggested-by: Matthew Wilcox <willy@infradead.org>
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Reported-by: kbuild test robot <lkp@intel.com>
> Link: https://marc.info/?l=linux-mm&m=155384681109231&w=2
> Signed-off-by: Tri Vo <trong@android.com>
> ---
>  include/linux/module.h | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/include/linux/module.h b/include/linux/module.h
> index 5bf5dcd91009..47190ebb70bf 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -709,6 +709,11 @@ static inline bool is_module_text_address(unsigned long addr)
>         return false;
>  }
>
> +static inline bool within_module(unsigned long addr, const struct module *mod)
> +{
> +       return false;
> +}
> +

Do folks think that similar stubs for within_module_core and
within_module_init should be added, while we're here?

It looks like kernel/trace/ftrace.c uses them, but has proper
CONFIG_MODULE guards.

>  /* Get/put a kernel symbol (calls should be symmetric) */
>  #define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); })
>  #define symbol_put(x) do { } while (0)
> --
> 2.21.0.392.gf8f6787159e-goog
>
Nick Desaulniers April 8, 2019, 6:11 p.m. UTC | #2
On Mon, Apr 8, 2019 at 11:08 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Sat, Apr 6, 2019 at 7:26 PM Tri Vo <trong@android.com> wrote:
> >
> > Provide a stub for within_module() when CONFIG_MODULES is not set. This
> > is needed to build CONFIG_GCOV_KERNEL.
> >
> > Fixes: 8c3d220cb6b5 ("gcov: clang support")
>
> The above commit got backed out of the -mm tree, due to the issue this
> patch addresses, so not sure it provides the correct context for the
> patch.  Maybe that line in the commit message should be dropped?

Maybe Jessica could drop that if/when applying?

>
> > Suggested-by: Matthew Wilcox <willy@infradead.org>
> > Reported-by: Randy Dunlap <rdunlap@infradead.org>
> > Reported-by: kbuild test robot <lkp@intel.com>
> > Link: https://marc.info/?l=linux-mm&m=155384681109231&w=2
> > Signed-off-by: Tri Vo <trong@android.com>
> > ---
> >  include/linux/module.h | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/include/linux/module.h b/include/linux/module.h
> > index 5bf5dcd91009..47190ebb70bf 100644
> > --- a/include/linux/module.h
> > +++ b/include/linux/module.h
> > @@ -709,6 +709,11 @@ static inline bool is_module_text_address(unsigned long addr)
> >         return false;
> >  }
> >
> > +static inline bool within_module(unsigned long addr, const struct module *mod)
> > +{
> > +       return false;
> > +}
> > +
>
> Do folks think that similar stubs for within_module_core and
> within_module_init should be added, while we're here?
>

Otherwise, if the answer to the above is no,
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Jessica Yu April 15, 2019, 2:22 p.m. UTC | #3
+++ Nick Desaulniers [08/04/19 11:08 -0700]:
>On Sat, Apr 6, 2019 at 7:26 PM Tri Vo <trong@android.com> wrote:
>>
>> Provide a stub for within_module() when CONFIG_MODULES is not set. This
>> is needed to build CONFIG_GCOV_KERNEL.
>>
>> Fixes: 8c3d220cb6b5 ("gcov: clang support")
>
>The above commit got backed out of the -mm tree, due to the issue this
>patch addresses, so not sure it provides the correct context for the
>patch.  Maybe that line in the commit message should be dropped?

Yeah, if the commit is no longer valid, then we should drop this line
and perhaps generalize the commit message more, maybe something like
"provide a stub for within_module() to prevent build errors when 
!CONFIG_MODULES".

>> Suggested-by: Matthew Wilcox <willy@infradead.org>
>> Reported-by: Randy Dunlap <rdunlap@infradead.org>
>> Reported-by: kbuild test robot <lkp@intel.com>
>> Link: https://marc.info/?l=linux-mm&m=155384681109231&w=2
>> Signed-off-by: Tri Vo <trong@android.com>
>> ---
>>  include/linux/module.h | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/include/linux/module.h b/include/linux/module.h
>> index 5bf5dcd91009..47190ebb70bf 100644
>> --- a/include/linux/module.h
>> +++ b/include/linux/module.h
>> @@ -709,6 +709,11 @@ static inline bool is_module_text_address(unsigned long addr)
>>         return false;
>>  }
>>
>> +static inline bool within_module(unsigned long addr, const struct module *mod)
>> +{
>> +       return false;
>> +}
>> +
>
>Do folks think that similar stubs for within_module_core and
>within_module_init should be added, while we're here?
>
>It looks like kernel/trace/ftrace.c uses them, but has proper
>CONFIG_MODULE guards.

Tri, if you plan on sending a v2, could you add Nick's suggestion
above? Would probably be good to prevent future build errors if a user
omits CONFIG_MODULE guards.

Thanks,

Jessica
diff mbox series

Patch

diff --git a/include/linux/module.h b/include/linux/module.h
index 5bf5dcd91009..47190ebb70bf 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -709,6 +709,11 @@  static inline bool is_module_text_address(unsigned long addr)
 	return false;
 }
 
+static inline bool within_module(unsigned long addr, const struct module *mod)
+{
+	return false;
+}
+
 /* Get/put a kernel symbol (calls should be symmetric) */
 #define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); })
 #define symbol_put(x) do { } while (0)