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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aApm-lvBjREPOW47@gmail.com>
Date: Thu, 24 Apr 2025 18:29:46 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Ard Biesheuvel <ardb+git@...gle.com>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org,
	Ard Biesheuvel <ardb@...nel.org>, phasta@...nel.org,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] x86/boot: Work around broken busybox truncate tool


* Ard Biesheuvel <ardb+git@...gle.com> wrote:

> From: Ard Biesheuvel <ardb@...nel.org>
> 
> The GNU coreutils version of truncate, which is the original, accepts a
> % prefix for the -s size argument which means the file in question
> should be padded to a multiple of the given size. This is currently used
> to pad the setup block of bzImage to a multiple of 4k before appending
> the decompressor.
> 
> busybux reimplements truncate but does not support this idiom, and
> therefore fails the build since commit
> 
>   9c54baab4401 ("x86/boot: Drop CRC-32 checksum and the build tool that generates it")
> 
> Work around this by avoiding truncate altogether, and relying on dd to
> perform the padding.
> 
> Reported-by: <phasta@...nel.org>
> Signed-off-by: Ard Biesheuvel <ardb@...nel.org>
> ---
> I personally think using a busybox environment for building the kernel
> is a terrible idea, and does not satisfy the build tool requirements
> listed in the documentation. But apparently, it used to work and now it
> doesn't, and the workaround is rather straight-forward.
> 
> IOW, I don't care whether this gets applied or not, so I will leave it
> to others to make the argument.

>  quiet_cmd_image = BUILD   $@
> -      cmd_image = cp $< $@; truncate -s %4K $@; cat $(obj)/vmlinux.bin >>$@
> +      cmd_image = (dd if=$< bs=4k conv=sync status=none; cat $(filter-out $<,$(real-prereqs))) >$@

So the workaround isn't too terrible, and since someone did trigger the 
bug, debugged it and reported it to us, it costs us very little to 
apply the workaround and (re-)enable someone's Linux build environment.

Also there's almost no existing usage of 'truncate' within the kernel 
build system. Found one only:

   drivers/firmware/efi/libstub/Makefile.zboot:			 truncate -s $$(hexdump -s16 -n4 -e '"%u"' $<) $@

Thanks,

	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ