lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aOd6QzKQKcYoxMf0@levanger>
Date: Thu, 9 Oct 2025 11:02:59 +0200
From: Nicolas Schier <nsc@...nel.org>
To: HONG Yifan <elsk@...gle.com>
Cc: Nathan Chancellor <nathan@...nel.org>,
	Masahiro Yamada <masahiroy@...nel.org>, kernel-team@...roid.com,
	linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kbuild: use $(obj)/ instead of $(src)/ for COPY

On Mon, Oct 06, 2025 at 07:38:38PM +0000, HONG Yifan wrote:
> Similar to
> commit 9a0ebe5011f4 ("kbuild: use $(obj)/ instead of $(src)/ for common pattern rules")
> 
> This change updates the COPY rule to use $(obj) instead of $(src). This
> makes Kbuild rules like
> 
>     always-y += libfoo/.foo.o.cmd

This is a strange example.  Why should we ship any prebuilt .*.o.cmd file?

> 
> work when the user provides libfoo/.foo.o.cmd_shipped, even when obj and
> src is different and src is an absolute path. This is useful when foo.o
> and .foo.o.cmd are checked-in as prebuilts.
> 
> (Admittedly, `always-y += libfoo/.foo.o.cmd` is not recommended in
> kbuild/modules.rst, "Several Subdirectories".)
> 
> For example, if
> 
>     obj=.
>     src=/some/path
> 
> then the original rule
> 
>     $(obj)/%: $(src)/%_shipped
> 
> expands to
> 
>     ./%: /some/path/%_shipped
> 
> And when matching against the above example, the stem is just `bar.o`
> [^1] so the following is looked up:
> 
>     libfoo/.foo.o.cmd: libfoo//some/path/.foo.o.cmd_shipped
> 
> ... and it cannot be matched.
> 
> With this change, the rule expands to
> 
>     ./%: ./%_shipped
> 
> ... and it should work, at least for files that does not have a more
> specific pattern rule.
> 
> NOTE: that after this change, code like
> 
>     bar-y += libfoo/foo.o
> 
> ... with libfoo/foo.o_shipped provided still DOES NOT work, because
> the pattern rule $(obj)/%.o takes priority. For .o_shipped files,
> the user still needs an explicit `$(obj)/%.o: $(obj)/%.o_shipped` rule
> in its own Kbuild file.
> 
> [^1]: https://www.gnu.org/software/make/manual/html_node/Pattern-Match.html
> 
> Signed-off-by: HONG Yifan <elsk@...gle.com>
> ---
>  scripts/Makefile.lib | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 1d581ba5df66..e066b7b00bcc 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -272,7 +272,7 @@ endef
>  quiet_cmd_copy = COPY    $@
>        cmd_copy = cat $< > $@
>  
> -$(obj)/%: $(src)/%_shipped
> +$(obj)/%: $(obj)/%_shipped
>  	$(call cmd,copy)

No, I don't see a reason to support *_shipped files from the build tree.
The purpose of *_shipped is to deliver prebuilt files with the source
tree to allow or simplify building the corresponding output files.

Kind regards,
Nicolas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ