module: add stub for within_module
Subsystems (2)
PATCH 1/1 module: add stub for within_module
Provide a stub for within_module() when CONFIG_MODULES is not set. This is needed to build CONFIG_GCOV_KERNEL.
--- include/linux/module.h | 5 +++++ 1 file changed, 5 insertions(+)
include/linux/module.h +5 -0
@@ -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)
Signature · 1 line
2.21.0.392.gf8f6787159e-goog
Quoted 5 lines · Tri Vo
Provide a stub for
within_module()whenCONFIG_MODULESis not set. This is needed to buildCONFIG_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?
Quoted 14 lines
Suggested-by Matthew Wilcox <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by kbuild test robot <[email protected]>Signed-off-by Tri Vo <[email protected]>--- include/linux/module.h | 5 +++++ 1 file changed, 5 insertions(+)include/linux/module.h +0
-0
include/linux/module.h static inline bool is_module_text_address(unsigned long addr) · line 716
Quoted 8 lines
include/linux/module.h +5
-0@@ -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.
Quoted 6 lines
include/linux/module.h +0
-1/* 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
Signature · 2 lines
Thanks, ~Nick Desaulniers
Nick Desaulniers
Reviewed-byQuoted 11 lines · Nick Desaulniers
Quoted 5 lines · Tri Vo
Provide a stub for
within_module()whenCONFIG_MODULESis not set. This is needed to buildCONFIG_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?
Quoted 18 lines
Quoted 18 lines
Suggested-by Matthew Wilcox <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by kbuild test robot <[email protected]>Signed-off-by Tri Vo <[email protected]>--- include/linux/module.h | 5 +++++ 1 file changed, 5 insertions(+)include/linux/module.h +0
-0@@ -709,6 +709,11 @@ static inline bool is_module_text_address(unsigned long addr)return false; }
Quoted 9 lines
include/linux/module.h static inline bool is_module_text_address(unsigned long addr) · line 716
Quoted 5 lines
include/linux/module.h +5
-0+static inline bool within_module (unsigned long addr,const struct module *mod) +{ +return false; +} +Do folks think that similar stubs for
within_module_coreandwithin_module_initshould be added, while we're here?
Otherwise, if the answer to the above is no,
Signature · 2 lines
Thanks, ~Nick Desaulniers
+++ Nick Desaulniers [08/04/19 11:08 -0700]:
Quoted 10 lines · Tri Vo
Quoted 5 lines
Provide a stub for
within_module()whenCONFIG_MODULESis not set. This is needed to buildCONFIG_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".
Quoted 26 lines
Quoted 14 lines
Suggested-by Matthew Wilcox <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by kbuild test robot <[email protected]>Signed-off-by Tri Vo <[email protected]>--- include/linux/module.h | 5 +++++ 1 file changed, 5 insertions(+)include/linux/module.h +0
-0include/linux/module.h static inline bool is_module_text_address(unsigned long addr) · line 716
Quoted 8 lines
include/linux/module.h +5
-0@@ -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_coreandwithin_module_initshould be added, while we're here?
Quoted 2 lines
It looks like
kernel/trace/ftrace.cuses them, but has properCONFIG_MODULEguards.
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
PATCH v2 1/1 module: add stubs for within_module functions
Provide stubs for within_module_core(), within_module_init(), and within_module() to prevent build errors when !CONFIG_MODULES.
v2:
- Generalized commit message, as per Jessica.
- Stubs for within_module_core() and within_module_init(), as per Nick.
--- include/linux/module.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
include/linux/module.h +17 -0
@@ -709,6 +709,23 @@ static inline bool is_module_text_address(unsigned long addr)return false; } +static inline bool within_module_core (unsigned long addr, +const struct module *mod) +{ +return false; +} + +static inline bool within_module_init (unsigned long addr, +const struct module *mod) +{ +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)
Signature · 1 line
2.21.0.392.gf8f6787159e-goog
Jessica Yu
AppliedRe: [PATCH v2] module: add stubs for within_module functions
+++ Tri Vo [15/04/19 11:18 -0700]:
Quoted 7 lines
Provide stubs for
within_module_core(),within_module_init(), andwithin_module()to prevent build errors when !CONFIG_MODULES.v2:
- Generalized commit message, as per Jessica.
- Stubs forwithin_module_core()andwithin_module_init(), as per Nick.
Quoted 5 lines
Suggested-by Matthew Wilcox <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by kbuild test robot <[email protected]>Signed-off-by Tri Vo <[email protected]>
Applied, thanks!
Jessica
Re: [PATCH v2] module: add stubs for within_module functions
Quoted 9 lines · Jessica Yu
+++ Tri Vo [15/04/19 11:18 -0700]:
Quoted 7 lines
Provide stubs for
within_module_core(),within_module_init(), andwithin_module()to prevent build errors when !CONFIG_MODULES.v2:
- Generalized commit message, as per Jessica.
- Stubs forwithin_module_core()andwithin_module_init(), as per Nick.
Quoted 7 lines
Quoted 5 lines
Suggested-by Matthew Wilcox <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by kbuild test robot <[email protected]>Signed-off-by Tri Vo <[email protected]>Applied, thanks!
Thank you!
Re: [PATCH v2] module: add stubs for within_module functions
Quoted 17 lines · Tri Vo
Quoted 15 lines · Jessica Yu
+++ Tri Vo [15/04/19 11:18 -0700]:
Quoted 12 lines
Provide stubs for
within_module_core(),within_module_init(), andwithin_module()to prevent build errors when !CONFIG_MODULES.v2:
- Generalized commit message, as per Jessica.
- Stubs forwithin_module_core()andwithin_module_init(), as per Nick.Suggested-by Matthew Wilcox <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by kbuild test robot <[email protected]>Signed-off-by Tri Vo <[email protected]>
Quoted 3 lines
Quoted 1 line
Applied, thanks!
Thank you!
Andrew,
this patch fixes 8c3d220cb6b5 ("gcov: clang support"). Could you re-apply the gcov patch? Sorry, if it's a dumb question. I'm not familiar with how cross-tree patches are handled in Linux.
Andrew Morton
maintainerRe: [PATCH v2] module: add stubs for within_module functions
Quoted 18 lines · On Tue, 16 Apr 2019 11:56:21 -0700 Tri Vo <[email protected]> wrote:
Quoted 17 lines · Tri Vo
Quoted 15 lines · Jessica Yu
+++ Tri Vo [15/04/19 11:18 -0700]:
Quoted 12 lines
Provide stubs for
within_module_core(),within_module_init(), andwithin_module()to prevent build errors when !CONFIG_MODULES.v2:
- Generalized commit message, as per Jessica.
- Stubs forwithin_module_core()andwithin_module_init(), as per Nick.Suggested-by Matthew Wilcox <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by kbuild test robot <[email protected]>Signed-off-by Tri Vo <[email protected]>
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Applied, thanks!
Thank you!
Andrew,
this patch fixes8c3d220cb6b5("gcov: clang support"). Could you re-apply the gcov patch? Sorry, if it's a dumb question. I'm not familiar with how cross-tree patches are handled in Linux.
hm, I wonder what Jessica applied this patch to?
Please resend a new version of "gcov: clang support".
Re: [PATCH v2] module: add stubs for within_module functions
+++ Andrew Morton [16/04/19 14:38 -0700]:
Quoted 22 lines · On Tue, 16 Apr 2019 11:56:21 -0700 Tri Vo <[email protected]> wrote:
Quoted 21 lines · Tri Vo
Quoted 19 lines · Jessica Yu
Quoted 16 lines
+++ Tri Vo [15/04/19 11:18 -0700]:
Quoted 7 lines
Provide stubs for
within_module_core(),within_module_init(), andwithin_module()to prevent build errors when !CONFIG_MODULES.v2:
- Generalized commit message, as per Jessica.
- Stubs forwithin_module_core()andwithin_module_init(), as per Nick.Quoted 5 lines
Suggested-by Matthew Wilcox <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by kbuild test robot <[email protected]>Signed-off-by Tri Vo <[email protected]>Applied, thanks!
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Thank you!
Andrew,
this patch fixes8c3d220cb6b5("gcov: clang support"). Could you re-apply the gcov patch? Sorry, if it's a dumb question. I'm not familiar with how cross-tree patches are handled in Linux.hm, I wonder what Jessica applied this patch to?
I applied the patch that supplies the missing within_module() stubs to the modules-next branch (a link to the repo is available in MAINTAINERS), it's landed in linux-next by now, and it should fix the build error reported by the kbuild test bot.
Thanks,
Jessica