* Re: [PATCH -next] module: fix build error when CONFIG_SYSFS is disabled
2021-05-25 8:54 [PATCH -next] module: fix build error when CONFIG_SYSFS is disabled Bixuan Cui
@ 2021-05-25 7:36 ` Stephen Boyd
2021-05-25 8:28 ` Bixuan Cui
2021-05-25 9:19 ` Bixuan Cui
0 siblings, 2 replies; 4+ messages in thread
From: Stephen Boyd @ 2021-05-25 7:36 UTC (permalink / raw)
To: Bixuan Cui, jeyu; +Cc: sfr, akpm, linux-kernel
Quoting Bixuan Cui (2021-05-25 01:54:00)
> kernel/module.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/module.c b/kernel/module.c
> index decf4601e943..7287ecc76714 100644
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -2794,7 +2794,8 @@ static void add_kallsyms(struct module *mod, const struct load_info *info)
> }
> #endif /* CONFIG_KALLSYMS */
>
> -#if IS_ENABLED(CONFIG_KALLSYMS) && IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID)
> +#if IS_ENABLED(CONFIG_KALLSYMS) && IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID) && \
> + IS_ENABLED(CONFIG_SYSFS)
Thanks for the report. It is the wrong fix though as we don't care that
sysfs is enabled or not. How about this patch?
---8<---
diff --git a/kernel/module.c b/kernel/module.c
index b5dd92e35b02..5be1f8ea4886 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1462,6 +1462,13 @@ resolve_symbol_wait(struct module *mod,
return ksym;
}
+#ifdef CONFIG_KALLSYMS
+static inline bool sect_empty(const Elf_Shdr *sect)
+{
+ return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0;
+}
+#endif
+
/*
* /sys/module/foo/sections stuff
* J. Corbet <corbet@lwn.net>
@@ -1469,11 +1476,6 @@ resolve_symbol_wait(struct module *mod,
#ifdef CONFIG_SYSFS
#ifdef CONFIG_KALLSYMS
-static inline bool sect_empty(const Elf_Shdr *sect)
-{
- return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0;
-}
-
struct module_sect_attr {
struct bin_attribute battr;
unsigned long address;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH -next] module: fix build error when CONFIG_SYSFS is disabled
2021-05-25 7:36 ` Stephen Boyd
@ 2021-05-25 8:28 ` Bixuan Cui
2021-05-25 9:19 ` Bixuan Cui
1 sibling, 0 replies; 4+ messages in thread
From: Bixuan Cui @ 2021-05-25 8:28 UTC (permalink / raw)
To: Stephen Boyd, jeyu; +Cc: sfr, akpm, linux-kernel
On 2021/5/25 15:36, Stephen Boyd wrote:
> Quoting Bixuan Cui (2021-05-25 01:54:00)
>> kernel/module.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/module.c b/kernel/module.c
>> index decf4601e943..7287ecc76714 100644
>> --- a/kernel/module.c
>> +++ b/kernel/module.c
>> @@ -2794,7 +2794,8 @@ static void add_kallsyms(struct module *mod, const struct load_info *info)
>> }
>> #endif /* CONFIG_KALLSYMS */
>>
>> -#if IS_ENABLED(CONFIG_KALLSYMS) && IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID)
>> +#if IS_ENABLED(CONFIG_KALLSYMS) && IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID) && \
>> + IS_ENABLED(CONFIG_SYSFS)
> Thanks for the report. It is the wrong fix though as we don't care that
> sysfs is enabled or not. How about this patch?
Hello, your patch solves that problem very well. Will you send a new patch?
Thanks
Bixuan Cui
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH -next] module: fix build error when CONFIG_SYSFS is disabled
@ 2021-05-25 8:54 Bixuan Cui
2021-05-25 7:36 ` Stephen Boyd
0 siblings, 1 reply; 4+ messages in thread
From: Bixuan Cui @ 2021-05-25 8:54 UTC (permalink / raw)
To: jeyu; +Cc: sfr, swboyd, akpm, linux-kernel, Bixuan Cui
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="y", Size: 1088 bytes --]
Fix build error when disable CONFIG_SYSFS:
kernel/module.c:2805:8: error: implicit declaration of function ‘sect_empty’; did you mean ‘desc_empty’? [-Werror=implicit-function-declaration]
2805 | if (!sect_empty(sechdr) && sechdr->sh_type == SHT_NOTE &&
Fixes: 9ee6682aa528 ("module: add printk formats to add module build ID to stacktraces")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
---
kernel/module.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/module.c b/kernel/module.c
index decf4601e943..7287ecc76714 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2794,7 +2794,8 @@ static void add_kallsyms(struct module *mod, const struct load_info *info)
}
#endif /* CONFIG_KALLSYMS */
-#if IS_ENABLED(CONFIG_KALLSYMS) && IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID)
+#if IS_ENABLED(CONFIG_KALLSYMS) && IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID) && \
+ IS_ENABLED(CONFIG_SYSFS)
static void init_build_id(struct module *mod, const struct load_info *info)
{
const Elf_Shdr *sechdr;
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH -next] module: fix build error when CONFIG_SYSFS is disabled
2021-05-25 7:36 ` Stephen Boyd
2021-05-25 8:28 ` Bixuan Cui
@ 2021-05-25 9:19 ` Bixuan Cui
1 sibling, 0 replies; 4+ messages in thread
From: Bixuan Cui @ 2021-05-25 9:19 UTC (permalink / raw)
To: Stephen Boyd, jeyu; +Cc: sfr, akpm, linux-kernel
I will send a new, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-25 9:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 8:54 [PATCH -next] module: fix build error when CONFIG_SYSFS is disabled Bixuan Cui
2021-05-25 7:36 ` Stephen Boyd
2021-05-25 8:28 ` Bixuan Cui
2021-05-25 9:19 ` Bixuan Cui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).