[PATCH v2 0/3] module: make structure definitions always visible

Thomas Weißschuh posted 3 patches 2 months, 3 weeks ago
include/linux/module.h   | 29 +++++++++++------------------
kernel/module/internal.h |  7 +++++++
lib/kunit/test.c         |  8 --------
3 files changed, 18 insertions(+), 26 deletions(-)
[PATCH v2 0/3] module: make structure definitions always visible
Posted by Thomas Weißschuh 2 months, 3 weeks ago
Code using IS_ENABLED(CONFIG_MODULES) as a C expression may need access
to the module structure definitions to compile.
Make sure these structure definitions are always visible.

This will conflict with commit 6bb37af62634 ("module: Move modprobe_path
and modules_disabled ctl_tables into the module subsys") from the sysctl
tree, but the resolution is trivial.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
Changes in v2:
- Pick up tags from v1
- Keep MODULE_ARCH_INIT and 'struct module' definitions together
- Link to v1: https://lore.kernel.org/r/20250612-kunit-ifdef-modules-v1-0-fdccd42dcff8@linutronix.de

---
Thomas Weißschuh (3):
      module: move 'struct module_use' to internal.h
      module: make structure definitions always visible
      kunit: test: Drop CONFIG_MODULE ifdeffery

 include/linux/module.h   | 29 +++++++++++------------------
 kernel/module/internal.h |  7 +++++++
 lib/kunit/test.c         |  8 --------
 3 files changed, 18 insertions(+), 26 deletions(-)
---
base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
change-id: 20250611-kunit-ifdef-modules-0fefd13ae153

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh@linutronix.de>

Re: [PATCH v2 0/3] module: make structure definitions always visible
Posted by Daniel Gomez 2 months, 3 weeks ago
On Fri, 11 Jul 2025 15:31:35 +0200, Thomas Weißschuh wrote:
> Code using IS_ENABLED(CONFIG_MODULES) as a C expression may need access
> to the module structure definitions to compile.
> Make sure these structure definitions are always visible.
> 
> This will conflict with commit 6bb37af62634 ("module: Move modprobe_path
> and modules_disabled ctl_tables into the module subsys") from the sysctl
> tree, but the resolution is trivial.
> 
> [...]

Applied, thanks!

[1/3] module: move 'struct module_use' to internal.h
      commit: bb02f22eaabc4d878577e2b8c46ed7b6be5f5459
[2/3] module: make structure definitions always visible
      commit: 02281b559cd1fdfdc8f7eb05bbbe3ab7b35246f0
[3/3] kunit: test: Drop CONFIG_MODULE ifdeffery
      commit: dffcba8acea3a80b3478750ac32f17bd5345b68e

Best regards,
-- 
Daniel Gomez <da.gomez@samsung.com>

Re: [PATCH v2 0/3] module: make structure definitions always visible
Posted by Thomas Weißschuh 2 months, 3 weeks ago
On Fri, Jul 11, 2025 at 03:39:04PM +0200, Daniel Gomez wrote:
> 
> On Fri, 11 Jul 2025 15:31:35 +0200, Thomas Weißschuh wrote:
> > Code using IS_ENABLED(CONFIG_MODULES) as a C expression may need access
> > to the module structure definitions to compile.
> > Make sure these structure definitions are always visible.
> > 
> > This will conflict with commit 6bb37af62634 ("module: Move modprobe_path
> > and modules_disabled ctl_tables into the module subsys") from the sysctl
> > tree, but the resolution is trivial.
> > 
> > [...]
> 
> Applied, thanks!
> 
> [1/3] module: move 'struct module_use' to internal.h
>       commit: bb02f22eaabc4d878577e2b8c46ed7b6be5f5459
> [2/3] module: make structure definitions always visible
>       commit: 02281b559cd1fdfdc8f7eb05bbbe3ab7b35246f0
> [3/3] kunit: test: Drop CONFIG_MODULE ifdeffery
>       commit: dffcba8acea3a80b3478750ac32f17bd5345b68e

Thanks!

FYI If you apply a patch you need to add yourself to the Signed-off-by chain.
And Link tags are nice. For example:

b4 shazam --add-my-sob --add-link
Re: [PATCH v2 0/3] module: make structure definitions always visible
Posted by Daniel Gomez 2 months, 3 weeks ago
On 11/07/2025 15.51, Thomas WeiÃschuh wrote:
> On Fri, Jul 11, 2025 at 03:39:04PM +0200, Daniel Gomez wrote:
>>
>> On Fri, 11 Jul 2025 15:31:35 +0200, Thomas Weißschuh wrote:
>>> Code using IS_ENABLED(CONFIG_MODULES) as a C expression may need access
>>> to the module structure definitions to compile.
>>> Make sure these structure definitions are always visible.
>>>
>>> This will conflict with commit 6bb37af62634 ("module: Move modprobe_path
>>> and modules_disabled ctl_tables into the module subsys") from the sysctl
>>> tree, but the resolution is trivial.
>>>
>>> [...]
>>
>> Applied, thanks!
>>
>> [1/3] module: move 'struct module_use' to internal.h
>>       commit: bb02f22eaabc4d878577e2b8c46ed7b6be5f5459
>> [2/3] module: make structure definitions always visible
>>       commit: 02281b559cd1fdfdc8f7eb05bbbe3ab7b35246f0
>> [3/3] kunit: test: Drop CONFIG_MODULE ifdeffery
>>       commit: dffcba8acea3a80b3478750ac32f17bd5345b68e
> 
> Thanks!
> 
> FYI If you apply a patch you need to add yourself to the Signed-off-by chain.
> And Link tags are nice. For example:
> 
> b4 shazam --add-my-sob --add-link

You're correct. I had a lapse there. Branch updated. Thanks!

[1/3] module: move 'struct module_use' to internal.h
      commit: 6633d3a45a8c075193304d12ba10a1771d1dbf10
[2/3] module: make structure definitions always visible
      commit: a55842991352a8b512f40d1424b65c911ffbf6fa
[3/3] kunit: test: Drop CONFIG_MODULE ifdeffery
      commit: 699657e8e50ae967ae26f704f6fbfa598fcb0cef