* [ptxdist] [PATCH] kernel: fix modules.builtin.modinfo being executable
@ 2025-12-10 16:22 Fabian Pfitzner
2025-12-12 14:52 ` [ptxdist] [APPLIED] " Michael Olbrich
0 siblings, 1 reply; 7+ messages in thread
From: Fabian Pfitzner @ 2025-12-10 16:22 UTC (permalink / raw)
To: ptxdist; +Cc: Fabian Pfitzner
Since kernel commit a26a6c93edfe ("kbuild: Strip trailing padding bytes from
modules.builtin.modinfo") [1], the resulting modules.builtin.modinfo file gets
copied by objcopy resulting in an executable file.
It seems, that objcopy detects this file as executable even though
the file is not executable at all.
Fix this problem by removing the execution bit afterwards.
I also send a patch upstream to the kernel [2].
[1] https://lore.kernel.org/all/20251105-kbuild-fix-builtin-modinfo-for-kmod-v1-1-b419d8ad4606@kernel.org
[2] https://lore.kernel.org/all/20251209-modinfo-executable-v1-1-ed0c553a4390@pengutronix.de/#t
Signed-off-by: Fabian Pfitzner <f.pfitzner@pengutronix.de>
---
rules/kernel.make | 1 +
1 file changed, 1 insertion(+)
diff --git a/rules/kernel.make b/rules/kernel.make
index 9cdc95a91b8b19bc1b5c19e9790bd9eb1c8c6d7c..e974304043f634add332dce10c7c2553f56b30a4 100644
--- a/rules/kernel.make
+++ b/rules/kernel.make
@@ -274,6 +274,7 @@ $(STATEDIR)/kernel.install:
@$(call targetinfo)
ifdef PTXCONF_KERNEL_MODULES_INSTALL
@$(call world/install, KERNEL)
+ @chmod -x $(KERNEL_PKGDIR)/lib/modules/*/modules.builtin.modinfo
endif
@$(call world/dtb, KERNEL)
@$(call world/dtbo, KERNEL)
---
base-commit: fd0dc47b258aac09ab961199a3c00ecddf98f244
change-id: 20251210-modinfo-executable-c6985ef6da30
Best regards,
--
Fabian Pfitzner <f.pfitzner@pengutronix.de>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [APPLIED] kernel: fix modules.builtin.modinfo being executable
2025-12-10 16:22 [ptxdist] [PATCH] kernel: fix modules.builtin.modinfo being executable Fabian Pfitzner
@ 2025-12-12 14:52 ` Michael Olbrich
2026-01-12 15:30 ` ruggero rossi via ptxdist
0 siblings, 1 reply; 7+ messages in thread
From: Michael Olbrich @ 2025-12-12 14:52 UTC (permalink / raw)
To: ptxdist; +Cc: Fabian Pfitzner
Thanks, applied as 844408110d046a967ec1d588dd038d95a6065514.
Michael
[sent from post-receive hook]
On Fri, 12 Dec 2025 15:52:10 +0100, Fabian Pfitzner <f.pfitzner@pengutronix.de> wrote:
> Since kernel commit a26a6c93edfe ("kbuild: Strip trailing padding bytes from
> modules.builtin.modinfo") [1], the resulting modules.builtin.modinfo file gets
> copied by objcopy resulting in an executable file.
>
> It seems, that objcopy detects this file as executable even though
> the file is not executable at all.
>
> Fix this problem by removing the execution bit afterwards.
>
> I also send a patch upstream to the kernel [2].
>
> [1] https://lore.kernel.org/all/20251105-kbuild-fix-builtin-modinfo-for-kmod-v1-1-b419d8ad4606@kernel.org
> [2] https://lore.kernel.org/all/20251209-modinfo-executable-v1-1-ed0c553a4390@pengutronix.de/#t
>
> Signed-off-by: Fabian Pfitzner <f.pfitzner@pengutronix.de>
> Message-Id: <20251210-modinfo-executable-v1-1-23c6f3fc999e@pengutronix.de>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
>
> diff --git a/rules/kernel.make b/rules/kernel.make
> index 9cdc95a91b8b..e974304043f6 100644
> --- a/rules/kernel.make
> +++ b/rules/kernel.make
> @@ -274,6 +274,7 @@ $(STATEDIR)/kernel.install:
> @$(call targetinfo)
> ifdef PTXCONF_KERNEL_MODULES_INSTALL
> @$(call world/install, KERNEL)
> + @chmod -x $(KERNEL_PKGDIR)/lib/modules/*/modules.builtin.modinfo
> endif
> @$(call world/dtb, KERNEL)
> @$(call world/dtbo, KERNEL)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [APPLIED] kernel: fix modules.builtin.modinfo being executable
2025-12-12 14:52 ` [ptxdist] [APPLIED] " Michael Olbrich
@ 2026-01-12 15:30 ` ruggero rossi via ptxdist
2026-01-13 9:05 ` Michael Olbrich
2026-01-13 14:57 ` Uwe Kleine-König
0 siblings, 2 replies; 7+ messages in thread
From: ruggero rossi via ptxdist @ 2026-01-12 15:30 UTC (permalink / raw)
To: ptxdist; +Cc: ruggero rossi, Michael Olbrich, Fabian Pfitzner
Hello Everybody,
migrating to PTXDIST 2026.01.0, I found a problem compiling the kernel.
In my (quite old) kernel, there are no modules.builtin.modinfo files,
and ptxdist install fails.
It seems that the reason is this patch.
The following patch solved my problem:
--- /usr/local/lib/ptxdist-2026.01.0/rules/kernel.make 2025-12-12
09:44:06.000000000 +0100 +++ kernel.make 2026-01-12
16:14:44.223920509 +0100 @@ -285,7 +285,11 @@
@$(call targetinfo)
ifdef PTXCONF_KERNEL_MODULES_INSTALL
@$(call world/install, KERNEL)
- @chmod -x $(KERNEL_PKGDIR)/lib/modules/*/modules.builtin.modinfo
+ @for fileName in
$(KERNEL_PKGDIR)/lib/modules/*/modules.builtin.modinfo; do \
+ if "$fileName" ; then \
+ chmod -x "$filename" ; \
+ fi ;\
+ done
endif
@$(call world/dtb, KERNEL)
@$(call world/dtbo, KERNEL)
Best regards,
Ruggero Rossi
On Fri, 12 Dec 2025 15:52:10 +0100
Michael Olbrich <m.olbrich@pengutronix.de> wrote:
> Thanks, applied as 844408110d046a967ec1d588dd038d95a6065514.
>
> Michael
>
> [sent from post-receive hook]
>
> On Fri, 12 Dec 2025 15:52:10 +0100, Fabian Pfitzner
> <f.pfitzner@pengutronix.de> wrote:
> > Since kernel commit a26a6c93edfe ("kbuild: Strip trailing padding
> > bytes from modules.builtin.modinfo") [1], the resulting
> > modules.builtin.modinfo file gets copied by objcopy resulting in an
> > executable file.
> >
> > It seems, that objcopy detects this file as executable even though
> > the file is not executable at all.
> >
> > Fix this problem by removing the execution bit afterwards.
> >
> > I also send a patch upstream to the kernel [2].
> >
> > [1]
> > https://lore.kernel.org/all/20251105-kbuild-fix-builtin-modinfo-for-kmod-v1-1-b419d8ad4606@kernel.org
> > [2]
> > https://lore.kernel.org/all/20251209-modinfo-executable-v1-1-ed0c553a4390@pengutronix.de/#t
> >
> > Signed-off-by: Fabian Pfitzner <f.pfitzner@pengutronix.de>
> > Message-Id:
> > <20251210-modinfo-executable-v1-1-23c6f3fc999e@pengutronix.de>
> > Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> >
> > diff --git a/rules/kernel.make b/rules/kernel.make
> > index 9cdc95a91b8b..e974304043f6 100644
> > --- a/rules/kernel.make
> > +++ b/rules/kernel.make
> > @@ -274,6 +274,7 @@ $(STATEDIR)/kernel.install:
> > @$(call targetinfo)
> > ifdef PTXCONF_KERNEL_MODULES_INSTALL
> > @$(call world/install, KERNEL)
> > + @chmod -x
> > $(KERNEL_PKGDIR)/lib/modules/*/modules.builtin.modinfo endif
> > @$(call world/dtb, KERNEL)
> > @$(call world/dtbo, KERNEL)
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [APPLIED] kernel: fix modules.builtin.modinfo being executable
2026-01-12 15:30 ` ruggero rossi via ptxdist
@ 2026-01-13 9:05 ` Michael Olbrich
2026-01-13 9:48 ` ruggero rossi via ptxdist
2026-01-13 14:57 ` Uwe Kleine-König
1 sibling, 1 reply; 7+ messages in thread
From: Michael Olbrich @ 2026-01-13 9:05 UTC (permalink / raw)
To: ruggero rossi via ptxdist; +Cc: Fabian Pfitzner, ruggero rossi
Hi,
On Mon, Jan 12, 2026 at 04:30:53PM +0100, ruggero rossi via ptxdist wrote:
> migrating to PTXDIST 2026.01.0, I found a problem compiling the kernel.
> In my (quite old) kernel, there are no modules.builtin.modinfo files,
> and ptxdist install fails.
Older than 5.2, right? That's the version the file was introduced from what
I can tell from the git history.
> It seems that the reason is this patch.
>
> The following patch solved my problem:
>
> --- /usr/local/lib/ptxdist-2026.01.0/rules/kernel.make 2025-12-12
> 09:44:06.000000000 +0100 +++ kernel.make 2026-01-12
> 16:14:44.223920509 +0100 @@ -285,7 +285,11 @@
> @$(call targetinfo)
> ifdef PTXCONF_KERNEL_MODULES_INSTALL
> @$(call world/install, KERNEL)
> - @chmod -x $(KERNEL_PKGDIR)/lib/modules/*/modules.builtin.modinfo
> + @for fileName in
> $(KERNEL_PKGDIR)/lib/modules/*/modules.builtin.modinfo; do \
> + if "$fileName" ; then \
> + chmod -x "$filename" ; \
> + fi ;\
> + done
I don't like patterns like this, because it silently fails if there is a
typo. And we know, that this is only needed for 6.18 or later. And all 6.x
versions install this file. So maybe wrap it with:
ifeq ($(KERNEL_VERSION_MAJOR),6)
...
endif
Michael
> endif
> @$(call world/dtb, KERNEL)
> @$(call world/dtbo, KERNEL)
>
> Best regards,
>
> Ruggero Rossi
>
>
> On Fri, 12 Dec 2025 15:52:10 +0100
> Michael Olbrich <m.olbrich@pengutronix.de> wrote:
>
> > Thanks, applied as 844408110d046a967ec1d588dd038d95a6065514.
> >
> > Michael
> >
> > [sent from post-receive hook]
> >
> > On Fri, 12 Dec 2025 15:52:10 +0100, Fabian Pfitzner
> > <f.pfitzner@pengutronix.de> wrote:
> > > Since kernel commit a26a6c93edfe ("kbuild: Strip trailing padding
> > > bytes from modules.builtin.modinfo") [1], the resulting
> > > modules.builtin.modinfo file gets copied by objcopy resulting in an
> > > executable file.
> > >
> > > It seems, that objcopy detects this file as executable even though
> > > the file is not executable at all.
> > >
> > > Fix this problem by removing the execution bit afterwards.
> > >
> > > I also send a patch upstream to the kernel [2].
> > >
> > > [1]
> > > https://lore.kernel.org/all/20251105-kbuild-fix-builtin-modinfo-for-kmod-v1-1-b419d8ad4606@kernel.org
> > > [2]
> > > https://lore.kernel.org/all/20251209-modinfo-executable-v1-1-ed0c553a4390@pengutronix.de/#t
> > >
> > > Signed-off-by: Fabian Pfitzner <f.pfitzner@pengutronix.de>
> > > Message-Id:
> > > <20251210-modinfo-executable-v1-1-23c6f3fc999e@pengutronix.de>
> > > Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> > >
> > > diff --git a/rules/kernel.make b/rules/kernel.make
> > > index 9cdc95a91b8b..e974304043f6 100644
> > > --- a/rules/kernel.make
> > > +++ b/rules/kernel.make
> > > @@ -274,6 +274,7 @@ $(STATEDIR)/kernel.install:
> > > @$(call targetinfo)
> > > ifdef PTXCONF_KERNEL_MODULES_INSTALL
> > > @$(call world/install, KERNEL)
> > > + @chmod -x
> > > $(KERNEL_PKGDIR)/lib/modules/*/modules.builtin.modinfo endif
> > > @$(call world/dtb, KERNEL)
> > > @$(call world/dtbo, KERNEL)
> >
>
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [APPLIED] kernel: fix modules.builtin.modinfo being executable
2026-01-13 9:05 ` Michael Olbrich
@ 2026-01-13 9:48 ` ruggero rossi via ptxdist
0 siblings, 0 replies; 7+ messages in thread
From: ruggero rossi via ptxdist @ 2026-01-13 9:48 UTC (permalink / raw)
To: Michael Olbrich; +Cc: ruggero rossi, Fabian Pfitzner, ruggero rossi via ptxdist
Hi,
>
> I don't like patterns like this, because it silently fails if there is a
> typo. And we know, that this is only needed for 6.18 or later. And all
> 6.x versions install this file. So maybe wrap it with:
>
> ifeq ($(KERNEL_VERSION_MAJOR),6)
> ...
> endif
>
> Michael
>
In this case the patch is much simpler:
-- /usr/local/lib/ptxdist-2026.01.0/rules/kernel.make 2025-12-12
09:44:06.000000000 +0100
+++ kernel.make 2026-01-13 10:36:36.840222985 +0100
@@ -285,8 +285,10 @@
@$(call targetinfo)
ifdef PTXCONF_KERNEL_MODULES_INSTALL
@$(call world/install, KERNEL)
+ifeq ($(KERNEL_VERSION_MAJOR),6)
@chmod -x $(KERNEL_PKGDIR)/lib/modules/*/modules.builtin.modinfo
endif
+endif
@$(call world/dtb, KERNEL)
@$(call world/dtbo, KERNEL)
@$(call touch)
Ín my case I tested it successfully, and I think it would be nice to have
it included in the future.
Best regards,
Ruggero
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [APPLIED] kernel: fix modules.builtin.modinfo being executable
2026-01-12 15:30 ` ruggero rossi via ptxdist
2026-01-13 9:05 ` Michael Olbrich
@ 2026-01-13 14:57 ` Uwe Kleine-König
2026-01-16 8:31 ` ruggero rossi via ptxdist
1 sibling, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2026-01-13 14:57 UTC (permalink / raw)
To: ruggero rossi via ptxdist; +Cc: Michael Olbrich, Fabian Pfitzner, ruggero rossi
[-- Attachment #1: Type: text/plain, Size: 1147 bytes --]
Hello,
On Mon, Jan 12, 2026 at 04:30:53PM +0100, ruggero rossi via ptxdist wrote:
> migrating to PTXDIST 2026.01.0, I found a problem compiling the kernel.
> In my (quite old) kernel, there are no modules.builtin.modinfo files,
> and ptxdist install fails.
>
> It seems that the reason is this patch.
>
> The following patch solved my problem:
>
> --- /usr/local/lib/ptxdist-2026.01.0/rules/kernel.make 2025-12-12
> 09:44:06.000000000 +0100 +++ kernel.make 2026-01-12
> 16:14:44.223920509 +0100 @@ -285,7 +285,11 @@
> @$(call targetinfo)
> ifdef PTXCONF_KERNEL_MODULES_INSTALL
> @$(call world/install, KERNEL)
> - @chmod -x $(KERNEL_PKGDIR)/lib/modules/*/modules.builtin.modinfo
> + @for fileName in
> $(KERNEL_PKGDIR)/lib/modules/*/modules.builtin.modinfo; do \
> + if "$fileName" ; then \
if "$fileName"
looks wrong to me. Either this gives you a "Permission denied" error, or
the file already has the x bit set :-)
The side effect is however that $? is 0 because the if swallows the
error code, so it indeed fixes the build (but probably with an error
message in the log).
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [APPLIED] kernel: fix modules.builtin.modinfo being executable
2026-01-13 14:57 ` Uwe Kleine-König
@ 2026-01-16 8:31 ` ruggero rossi via ptxdist
0 siblings, 0 replies; 7+ messages in thread
From: ruggero rossi via ptxdist @ 2026-01-16 8:31 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: ruggero rossi, Michael Olbrich, Fabian Pfitzner,
ruggero rossi via ptxdist
On Tue, 13 Jan 2026 15:57:29 +0100
Uwe Kleine-König <u.kleine-koenig@baylibre.com> wrote:
> Hello,
>
> if "$fileName"
>
> looks wrong to me. Either this gives you a "Permission denied" error, or
> the file already has the x bit set :-)
you are right. For some reason the [ -f ... ] disappeared.
However the observation of Michael Olbrich
> I don't like patterns like this, because it silently fails if there is a
> typo. And we know, that this is only needed for 6.18 or later. And all
> 6.x versions install this file. So maybe wrap it with:
>
> ifeq ($(KERNEL_VERSION_MAJOR),6)
> ...
> endif
>
made this workaround unnecessary. The patch now should be:
-- /usr/local/lib/ptxdist-2026.01.0/rules/kernel.make 2025-12-12
09:44:06.000000000 +0100
+++ kernel.make 2026-01-13 10:36:36.840222985 +0100
@@ -285,8 +285,10 @@
@$(call targetinfo)
ifdef PTXCONF_KERNEL_MODULES_INSTALL
@$(call world/install, KERNEL)
+ifeq ($(KERNEL_VERSION_MAJOR),6)
@chmod -x $(KERNEL_PKGDIR)/lib/modules/*/modules.builtin.modinfo
endif
+endif
@$(call world/dtb, KERNEL)
@$(call world/dtbo, KERNEL)
@$(call touch)
reducing the changes against the original to a very minimum.
Best regards
Ruggero
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-01-16 8:31 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-10 16:22 [ptxdist] [PATCH] kernel: fix modules.builtin.modinfo being executable Fabian Pfitzner
2025-12-12 14:52 ` [ptxdist] [APPLIED] " Michael Olbrich
2026-01-12 15:30 ` ruggero rossi via ptxdist
2026-01-13 9:05 ` Michael Olbrich
2026-01-13 9:48 ` ruggero rossi via ptxdist
2026-01-13 14:57 ` Uwe Kleine-König
2026-01-16 8:31 ` ruggero rossi via ptxdist
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox