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] [day] [month] [year] [list]
Message-ID: <CA+icZUXBvA4T-3UoNt6+Jt=V8jrd2rzxgRr4Ey6czkUip=asxw@mail.gmail.com>
Date: Tue, 30 Jul 2024 03:23:49 +0200
From: Sedat Dilek <sedat.dilek@...il.com>
To: Emil Renner Berthing <emil.renner.berthing@...onical.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>, 
	Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>, 
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [v2] arm64: Rename to KERNEL_IMAGE_COMPRESSED_INSTALL kconfig for
 compressed kernel image

On Sat, Jul 27, 2024 at 1:50 PM Emil Renner Berthing
<emil.renner.berthing@...onical.com> wrote:
>
> Linus Torvalds wrote:
> > On Fri, 26 Jul 2024 at 13:54, Sedat Dilek <sedat.dilek@...il.com> wrote:
> > >
> > > And when you check a diff of two of your ARM64 .config?
> > > What says COMPRESSED_INSTALL to other than the author w/o context :-)?
> >
> > Even without any context, I think it says "compressed install".
> >
> > Which seems sensible. Because THAT'S EXACTLY WHAT IT IS.
> >
> > Now, admittedly I would have preferred not having a config option for
> > this at all, but we have a sad historical situation of doing something
> > odd on arm (and parisc).
> >
> > The RISC-V people used to do the same, but they decided to just make
> > 'install' do whatever image was built, so they base it on a
> > combination of different config variables: CONFIG_XIP_KERNEL,
> > CONFIG_RISCV_M_MODE, CONFIG_SOC_CANAAN_K210, and CONFIG_EFI_ZBOOT.
>
> With the approach taken by RISC-V you can choose which compression you want
> (including uncompressed) and not just gzip. For arm64 it would look something
> like this:
>

Hi Emil,

That sounds straight-forward than discussing a single KCONFIG variable name.

Is that kconfig/kbuild tested?

> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index ae527d1d409f..a99864491703 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -234,6 +234,13 @@ config ARM64
>         select HAVE_RUST if CPU_LITTLE_ENDIAN
>         select HAVE_STACKPROTECTOR
>         select HAVE_SYSCALL_TRACEPOINTS
> +       select HAVE_KERNEL_BZIP2 if !EFI_ZBOOT
> +       select HAVE_KERNEL_GZIP if !EFI_ZBOOT
> +       select HAVE_KERNEL_LZ4 if !EFI_ZBOOT
> +       select HAVE_KERNEL_LZMA if !EFI_ZBOOT
> +       select HAVE_KERNEL_LZO if !EFI_ZBOOT
> +       select HAVE_KERNEL_UNCOMPRESSED if !EFI_ZBOOT
> +       select HAVE_KERNEL_ZSTD if !EFI_ZBOOT

Better embed these selects in a block
if !EFI_ZBOOT
...
endif # !EFI_ZBOOT

Do you really want to use HAVE_KERNEL_UNCOMPRESSED (see below)?

x86_64 does not have XXX_KERNEL_UNCOMPRESSED.

>         select HAVE_KPROBES
>         select HAVE_KRETPROBES
>         select HAVE_GENERIC_VDSO
> @@ -2337,17 +2344,6 @@ config EFI
>           allow the kernel to be booted as an EFI application. This
>           is only useful on systems that have UEFI firmware.
>
> -config COMPRESSED_INSTALL
> -       bool "Install compressed image by default"
> -       help
> -         This makes the regular "make install" install the compressed
> -         image we built, not the legacy uncompressed one.
> -
> -         You can check that a compressed image works for you by doing
> -         "make zinstall" first, and verifying that everything is fine
> -         in your environment before making "make install" do this for
> -         you.
> -
>  config DMI
>         bool "Enable support for SMBIOS (DMI) tables"
>         depends on EFI
> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> index f6bc3da1ef11..b798875311aa 100644
> --- a/arch/arm64/Makefile
> +++ b/arch/arm64/Makefile
> @@ -159,18 +159,21 @@ libs-y            := arch/arm64/lib/ $(libs-y)
>  libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
>
>  # Default target when executing plain make
> -boot           := arch/arm64/boot
> +boot                                   := arch/arm64/boot
> +boot-image-y                           := Image

^^ boot-image-$(CONFIG_KERNEL_UNCOMPRESSED)  := Image ?

> +boot-image-$(CONFIG_KERNEL_BZIP2)      := Image.bz2
> +boot-image-$(CONFIG_KERNEL_GZIP)       := Image.gz
> +boot-image-$(CONFIG_KERNEL_LZ4)                := Image.lz4
> +boot-image-$(CONFIG_KERNEL_LZMA)       := Image.lzma
> +boot-image-$(CONFIG_KERNEL_LZO)                := Image.lzo
> +boot-image-$(CONFIG_KERNEL_ZSTD)       := Image.zst
> +boot-image-$(CONFIG_EFI_ZBOOT)         := vmlinuz.efi
>
> -BOOT_TARGETS   := Image vmlinuz.efi image.fit
> +KBUILD_IMAGE := $(boot)/$(boot-image-y)
> +BOOT_TARGETS := Image Image.bz2 Image.gz Image.lz4 Image.lzma
> Image.lzo Image.zst vmlinuz.efi image.fit
>
>  PHONY += $(BOOT_TARGETS)
>
> -ifeq ($(CONFIG_EFI_ZBOOT),)
> -KBUILD_IMAGE   := $(boot)/Image.gz
> -else
> -KBUILD_IMAGE   := $(boot)/vmlinuz.efi
> -endif
> -
>  all:   $(notdir $(KBUILD_IMAGE))
>
>  image.fit: dtbs
> @@ -182,13 +185,8 @@ $(BOOT_TARGETS): vmlinux
>  Image.%: Image
>         $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
>
> -ifeq ($(CONFIG_COMPRESSED_INSTALL),y)
> - DEFAULT_KBUILD_IMAGE = $(KBUILD_IMAGE)
> -else
> - DEFAULT_KBUILD_IMAGE = $(boot)/Image
> -endif
> -
> -install: KBUILD_IMAGE := $(DEFAULT_KBUILD_IMAGE)
> +# the install target always installs KBUILD_IMAGE (which may be compressed)
> +# but keep the zinstall target for compatibility with older releases
>  install zinstall:
>         $(call cmd,install)
>
> @@ -232,11 +230,15 @@ virtconfig:
>         $(call merge_into_defconfig_override,defconfig,virt)
>
>  define archhelp
> -  echo  '* Image.gz      - Compressed kernel image
> (arch/$(ARCH)/boot/Image.gz)'
>    echo  '  Image         - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
> +  echo  '  Image.bz2     - Compressed kernel image
> (arch/$(ARCH)/boot/Image.bz2)'
> +  echo  '* Image.gz      - Compressed kernel image
> (arch/$(ARCH)/boot/Image.gz)'
> +  echo  '  Image.lz4     - Compressed kernel image
> (arch/$(ARCH)/boot/Image.lz4)'
> +  echo  '  Image.lzma    - Compressed kernel image
> (arch/$(ARCH)/boot/Image.lzma)'
> +  echo  '  Image.lzo     - Compressed kernel image
> (arch/$(ARCH)/boot/Image.lzo)'
> +  echo  '  Image.zst     - Compressed kernel image
> (arch/$(ARCH)/boot/Image.zst)'
>    echo  '  image.fit     - Flat Image Tree (arch/$(ARCH)/boot/image.fit)'
> -  echo  '  install       - Install kernel (compressed if
> COMPRESSED_INSTALL set)'
> -  echo  '  zinstall      - Install compressed kernel'
> +  echo  '  install       - Install kernel'
>    echo  '                  Install using (your) ~/bin/installkernel or'
>    echo  '                  (distribution) /sbin/installkernel or'
>    echo  '                  install to $$(INSTALL_PATH) and run lilo'

Does ARM64 arch support kernel-decompression for all these compressors?

Thanks for that vital contribution and your ideas!

Best regards,
-Sedat-

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ