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: <20250321101029-8a3a1fea-223a-42c3-8528-a3239fb4b24e@linutronix.de>
Date: Fri, 21 Mar 2025 10:16:41 +0100
From: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
To: Julian Stecklina <julian.stecklina@...erus-technology.de>
Cc: Christoph Hellwig <hch@....de>, Al Viro <viro@...iv.linux.org.uk>, 
	Linus Torvalds <torvalds@...ux-foundation.org>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
	"Rafael J. Wysocki" <rafael@...nel.org>, linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] initrd: support erofs as initrd

On Thu, Mar 20, 2025 at 08:28:23PM +0100, Julian Stecklina via B4 Relay wrote:
> From: Julian Stecklina <julian.stecklina@...erus-technology.de>
> 
> Add erofs detection to the initrd mount code. This allows systems to
> boot from an erofs-based initrd in the same way as they can boot from
> a squashfs initrd.
> 
> Just as squashfs initrds, erofs images as initrds are a good option
> for systems that are memory-constrained.
> 
> Signed-off-by: Julian Stecklina <julian.stecklina@...erus-technology.de>
> ---
>  init/do_mounts_rd.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
> index ac021ae6e6fa78c7b7828a78ab2fa3af3611bef3..7c3f8b45b5ed2eea3c534d7f2e65608542009df5 100644
> --- a/init/do_mounts_rd.c
> +++ b/init/do_mounts_rd.c
> @@ -11,6 +11,7 @@
>  
>  #include "do_mounts.h"
>  #include "../fs/squashfs/squashfs_fs.h"
> +#include "../fs/erofs/erofs_fs.h"
>  
>  #include <linux/decompress/generic.h>
>  
> @@ -47,6 +48,7 @@ static int __init crd_load(decompress_fn deco);
>   *	romfs
>   *	cramfs
>   *	squashfs
> + *	erofs
>   *	gzip
>   *	bzip2
>   *	lzma
> @@ -63,6 +65,7 @@ identify_ramdisk_image(struct file *file, loff_t pos,
>  	struct romfs_super_block *romfsb;
>  	struct cramfs_super *cramfsb;
>  	struct squashfs_super_block *squashfsb;
> +	struct erofs_super_block *erofsb;
>  	int nblocks = -1;
>  	unsigned char *buf;
>  	const char *compress_name;
> @@ -77,6 +80,7 @@ identify_ramdisk_image(struct file *file, loff_t pos,
>  	romfsb = (struct romfs_super_block *) buf;
>  	cramfsb = (struct cramfs_super *) buf;
>  	squashfsb = (struct squashfs_super_block *) buf;
> +	erofsb = (struct erofs_super_block *) buf;
>  	memset(buf, 0xe5, size);
>  
>  	/*
> @@ -165,6 +169,21 @@ identify_ramdisk_image(struct file *file, loff_t pos,
>  		goto done;
>  	}
>  
> +	/* Try erofs */
> +	pos = (start_block * BLOCK_SIZE) + EROFS_SUPER_OFFSET;
> +	kernel_read(file, buf, size, &pos);
> +
> +	if (erofsb->magic == EROFS_SUPER_MAGIC_V1) {

le32_to_cpu(erofsb->magic)

> +		printk(KERN_NOTICE
> +		       "RAMDISK: erofs filesystem found at block %d\n",
> +		       start_block);
> +
> +		nblocks = ((erofsb->blocks << erofsb->blkszbits) + BLOCK_SIZE - 1)
> +			>> BLOCK_SIZE_BITS;

le32_to_cpu(erofsb->blocks)

> +
> +		goto done;
> +	}
> +
>  	printk(KERN_NOTICE
>  	       "RAMDISK: Couldn't find valid RAM disk image starting at %d.\n",
>  	       start_block);
> 

This seems to be broken for cramfs and minix, too.


Thomas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ