All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Ethan Zuo <yuxuan.zuo@outlook.com>
Cc: nsc@kernel.org, masahiroy@kernel.org,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kbuild: Fix permissions of modules.builtin.modinfo
Date: Tue, 27 Jan 2026 13:59:15 -0700	[thread overview]
Message-ID: <20260127205915.GA3856796@ax162> (raw)
In-Reply-To: <SY0P300MB0609BE844D61B504AB2013C99C90A@SY0P300MB0609.AUSP300.PROD.OUTLOOK.COM>

Hi Ethan,

On Wed, Jan 28, 2026 at 03:23:23AM +0800, Ethan Zuo wrote:
> Currently, modules.builtin.modinfo is created with executable permissions
> (0755). This is because after commit 39cfd5b12160 ("kbuild: extract
> modules.builtin.modinfo from vmlinux.unstripped"), modules.builtin.modinfo
> is extracted from vmlinux.unstripped using objcopy. When extracting
> sections, objcopy inherits attributes from the source ELF file.

Ah, that explains why this is only visble after 39cfd5b12160, as
vmlinux.o was just a regular object file, whereas vmlinux.unstripped is
an executable. There was another patch submitted to address this issue
that did not explain that bit well:

https://lore.kernel.org/20251209-modinfo-executable-v1-1-ed0c553a4390@pengutronix.de/

> Since modules.builtin.modinfo is a data file and not an executable,
> it should have 0644 permissions. The executable bit can trigger
> warnings in Debian's Lintian tool.

I had asked on that previous submission what sort of issues could be
expected from being executable and warnings from tools is a reasonable
answer to that. Thanks for including that.

> Explicitly set the permissions to 0644 after generation.

Would it be better to do what the previous submission did and just
remove the execute bit via 'chmod -x'? That seems to be slightly more
common in the kernel (even though there are very few uses of 'chmod'
throughout Makefile instances) and seems to get at the issue a little
bit more. Not sure if the creation of these files respects umask, in
case someone had a more restrictive one, but that might be contrived.

> Fixes: 39cfd5b12160 ("kbuild: extract modules.builtin.modinfo from vmlinux.unstripped")
> Signed-off-by: Ethan Zuo <yuxuan.zuo@outlook.com>

Nicolas, do you want to take this as a fix for 6.19 or should I take it
via kbuild-next for 6.20/7.0?

> ---
>  scripts/Makefile.vmlinux | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux
> index cd788cac9d91..c5305619b1d3 100644
> --- a/scripts/Makefile.vmlinux
> +++ b/scripts/Makefile.vmlinux
> @@ -113,7 +113,8 @@ vmlinux: vmlinux.unstripped FORCE
>  # what kmod expects to parse.
>  quiet_cmd_modules_builtin_modinfo = GEN     $@
>        cmd_modules_builtin_modinfo = $(cmd_objcopy); \
> -                                    sed -i 's/\x00\+$$/\x00/g' $@
> +                                    sed -i 's/\x00\+$$/\x00/g' $@; \
> +                                    chmod 644 $@
>  
>  OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary
>  
> -- 
> 2.51.0
> 

  reply	other threads:[~2026-01-27 20:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-27 19:23 [PATCH] kbuild: Fix permissions of modules.builtin.modinfo Ethan Zuo
2026-01-27 20:59 ` Nathan Chancellor [this message]
2026-01-28  6:15   ` Ethan Zuo
2026-01-28  6:35   ` Ethan Zuo
2026-01-28  6:37   ` [PATCH v2] " Ethan Zuo
2026-01-28 11:27     ` Nicolas Schier
2026-01-28  8:16   ` [PATCH] " Nicolas Schier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260127205915.GA3856796@ax162 \
    --to=nathan@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nsc@kernel.org \
    --cc=yuxuan.zuo@outlook.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.