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: <20250114181359.4192564-3-masahiroy@kernel.org>
Date: Wed, 15 Jan 2025 03:13:53 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Michal Simek <monstr@...str.eu>
Cc: linux-kernel@...r.kernel.org,
	Masahiro Yamada <masahiroy@...nel.org>
Subject: [PATCH 3/4] microblaze: prevent linux.bin from containing a built-in DTB

MicroBlaze is the only architecture that specifies the built-in DTB
directly via the command line (i.e., 'make simpleImage.*').

All other architectures supporting a builtin DTB use a CONFIG option
to specify the DTB.

Kbuild supports building multiple targets in a single command. Running
'make foo bar' should produce the same output as executing 'make foo'
and 'make bar' separately.

The oddity in MicroBlaze does not align with the Kbuild philosophy.

For example:

  $ make all simpleImage.foo

This creates both linux.bin (since 'all' depends on linux.bin) and
simpleImage.foo.

It generates linux.bin containing foo.dtb, while linux.bin generated
by 'make all' contains no DTB.

Michal Simek requires that linux.bin contain no built-in DTB. [1]
Therefore, the linux.bin generated in the example above is considered
invalid.

This commit introduces a sanity check to avoid creating such an invalid
linux.bin.

Similarly, you cannot do 'make simpleImage.foo simpleImage.bar' since
it is unclear which DTB (foo.dtb or bar.dtb) should be included. This
command will fail without an explicit check.

[1]: https://lore.kernel.org/all/d2bdfbfd-3721-407f-991e-566d48392add@amd.com/

Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
---

 arch/microblaze/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
index 02e6be9c5b0d..670a1690aa73 100644
--- a/arch/microblaze/Makefile
+++ b/arch/microblaze/Makefile
@@ -66,6 +66,7 @@ PHONY += linux.bin linux.bin.gz linux.bin.ub
 linux.bin.ub linux.bin.gz: linux.bin
 linux.bin: vmlinux
 linux.bin linux.bin.gz linux.bin.ub:
+	$(if $(filter simpleImage.%, $(MAKECMDGOALS)),$(error You cannot build linux.bin and simpleImage.* at the same time))
 	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 	@echo 'Kernel: $(boot)/$@ is ready' ' (#'$(or $(KBUILD_BUILD_VERSION),`cat .version`)')'
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ