* [PATCH] kbuild: fix modules.builtin.modinfo being executable
@ 2025-12-09 15:59 Fabian Pfitzner
2025-12-09 18:02 ` Randy Dunlap
2025-12-10 0:28 ` Nathan Chancellor
0 siblings, 2 replies; 3+ messages in thread
From: Fabian Pfitzner @ 2025-12-09 15:59 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier
Cc: linux-kbuild, linux-kernel, Fabian Pfitzner
Since commit a26a6c93edfe ("kbuild: Strip trailing padding bytes from
modules.builtin.modinfo") 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.
This problem arises on x86_64 and arm-v7a, but for some reason does not
happen on aarch64.
Fix this problem by removing the execution bit afterwards.
Signed-off-by: Fabian Pfitzner <f.pfitzner@pengutronix.de>
---
scripts/Makefile.vmlinux | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux
index cd788cac9d91dadcf4e83a39142f9d7bc61ffed0..7ee6aad760495ac5357132954c32ff879d24f72e 100644
--- a/scripts/Makefile.vmlinux
+++ b/scripts/Makefile.vmlinux
@@ -113,6 +113,7 @@ vmlinux: vmlinux.unstripped FORCE
# what kmod expects to parse.
quiet_cmd_modules_builtin_modinfo = GEN $@
cmd_modules_builtin_modinfo = $(cmd_objcopy); \
+ chmod -x $@; \
sed -i 's/\x00\+$$/\x00/g' $@
OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary
---
base-commit: cb015814f8b6eebcbb8e46e111d108892c5e6821
change-id: 20251209-modinfo-executable-2d2af74150c0
Best regards,
--
Fabian Pfitzner <f.pfitzner@pengutronix.de>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] kbuild: fix modules.builtin.modinfo being executable
2025-12-09 15:59 [PATCH] kbuild: fix modules.builtin.modinfo being executable Fabian Pfitzner
@ 2025-12-09 18:02 ` Randy Dunlap
2025-12-10 0:28 ` Nathan Chancellor
1 sibling, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2025-12-09 18:02 UTC (permalink / raw)
To: Fabian Pfitzner, Nathan Chancellor, Nicolas Schier
Cc: linux-kbuild, linux-kernel
On 12/9/25 7:59 AM, Fabian Pfitzner wrote:
> Since commit a26a6c93edfe ("kbuild: Strip trailing padding bytes from
> modules.builtin.modinfo") 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.
>
> This problem arises on x86_64 and arm-v7a, but for some reason does not
> happen on aarch64.
>
> Fix this problem by removing the execution bit afterwards.
>
> Signed-off-by: Fabian Pfitzner <f.pfitzner@pengutronix.de>
WFM. Thanks.
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
> ---
> scripts/Makefile.vmlinux | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux
> index cd788cac9d91dadcf4e83a39142f9d7bc61ffed0..7ee6aad760495ac5357132954c32ff879d24f72e 100644
> --- a/scripts/Makefile.vmlinux
> +++ b/scripts/Makefile.vmlinux
> @@ -113,6 +113,7 @@ vmlinux: vmlinux.unstripped FORCE
> # what kmod expects to parse.
> quiet_cmd_modules_builtin_modinfo = GEN $@
> cmd_modules_builtin_modinfo = $(cmd_objcopy); \
> + chmod -x $@; \
> sed -i 's/\x00\+$$/\x00/g' $@
>
> OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary
>
> ---
> base-commit: cb015814f8b6eebcbb8e46e111d108892c5e6821
> change-id: 20251209-modinfo-executable-2d2af74150c0
>
> Best regards,
--
~Randy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kbuild: fix modules.builtin.modinfo being executable
2025-12-09 15:59 [PATCH] kbuild: fix modules.builtin.modinfo being executable Fabian Pfitzner
2025-12-09 18:02 ` Randy Dunlap
@ 2025-12-10 0:28 ` Nathan Chancellor
1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2025-12-10 0:28 UTC (permalink / raw)
To: Fabian Pfitzner; +Cc: Nicolas Schier, linux-kbuild, linux-kernel
On Tue, Dec 09, 2025 at 04:59:45PM +0100, Fabian Pfitzner wrote:
> Since commit a26a6c93edfe ("kbuild: Strip trailing padding bytes from
> modules.builtin.modinfo") the resulting modules.builtin.modinfo file gets
> copied by objcopy resulting in an executable file.
objcopy has been used to generate modules.builtin.modinfo since its
introduction in commit 898490c010b5 ("moduleparam: Save information
about built-in modules in separate file"). This would seem to indicate
some issue with the sed command in that change if it is indeed the
culprit of introducing this behavior? Or is there something else going
on here?
> It seems, that objcopy detects this file as executable even though
> the file is not executable at all.
This section comes from vmlinux.unstripped, which is executable, perhaps
that is related?
> This problem arises on x86_64 and arm-v7a, but for some reason does not
> happen on aarch64.
This file is executable for me on an aarch64 machine:
$ uname -m
aarch64
$ ls -al /usr/lib/modules/6.18.0-next-20251205-00002-g8e6af29eba24/modules.builtin.modinfo
.rwxr-xr-x@ 197k root 5 Dec 09:39 /usr/lib/modules/6.18.0-next-20251205-00002-g8e6af29eba24/modules.builtin.modinfo
> Fix this problem by removing the execution bit afterwards.
This seems obviously correct since there is no reason for this file to
be executable but does this result in any other problems?
> Signed-off-by: Fabian Pfitzner <f.pfitzner@pengutronix.de>
> ---
> scripts/Makefile.vmlinux | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux
> index cd788cac9d91dadcf4e83a39142f9d7bc61ffed0..7ee6aad760495ac5357132954c32ff879d24f72e 100644
> --- a/scripts/Makefile.vmlinux
> +++ b/scripts/Makefile.vmlinux
> @@ -113,6 +113,7 @@ vmlinux: vmlinux.unstripped FORCE
> # what kmod expects to parse.
> quiet_cmd_modules_builtin_modinfo = GEN $@
> cmd_modules_builtin_modinfo = $(cmd_objcopy); \
> + chmod -x $@; \
> sed -i 's/\x00\+$$/\x00/g' $@
>
> OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary
>
> ---
> base-commit: cb015814f8b6eebcbb8e46e111d108892c5e6821
> change-id: 20251209-modinfo-executable-2d2af74150c0
>
> Best regards,
> --
> Fabian Pfitzner <f.pfitzner@pengutronix.de>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-10 0:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-09 15:59 [PATCH] kbuild: fix modules.builtin.modinfo being executable Fabian Pfitzner
2025-12-09 18:02 ` Randy Dunlap
2025-12-10 0:28 ` Nathan Chancellor
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).