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: <546EB5A2.5050604@huawei.com>
Date:	Fri, 21 Nov 2014 11:46:42 +0800
From:	leizhen <thunder.leizhen@...wei.com>
To:	Andrew Morton <akpm@...ux-foundation.org>,
	Geert Uytterhoeven <geert@...ux-m68k.org>,
	Josh Triplett <josh@...htriplett.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Paul Gortmaker <paul.gortmaker@...driver.com>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	linux-kernel <linux-kernel@...r.kernel.org>
CC:	Zefan Li <lizefan@...wei.com>, Xinwei Hu <huxinwei@...wei.com>,
	Zhen Lei <thunder.leizhen@...wei.com>
Subject: Fwd: [PATCH 1/1] init:add boot option "initramfs_packnum"

Hi erverbody! What about your opinion?

I run "scripts/get_maintainer.pl -f init/", but it displays no maintainer.
So this time, I added all people the result listed and added famous Linus Torvalds.

This patch is useful and no harmful.


-------- Original Message --------
Subject: [PATCH 1/1] init:add boot option "initramfs_packnum"
Date: Tue, 11 Nov 2014 09:42:14 +0800
From: Zhen Lei <thunder.leizhen@...wei.com>
To: Andrew Morton <akpm@...ux-foundation.org>, Yinghai Lu <yinghai@...nel.org>, Mark Rustad <mark.d.rustad@...el.com>, linux-kernel <linux-kernel@...r.kernel.org>
CC: Zefan Li <lizefan@...wei.com>, Xinwei Hu <huxinwei@...wei.com>, Zhen Lei <thunder.leizhen@...wei.com>

During the development phase, we usually enlarge initrd-end to reserve more
memory than the initfs zip exactly occupied. Then we can easily add or delete
files in zip package, without generate fdt again and again. But unfortunately,
if too many zeros followed initfs zip, it will take a long time to break the
loop.

while (!message && len) {
        ... ...
        if (!*buf) {
		buf++;
                ... ...
                continue;
        }

So, use the boot option "initramfs_packnum" to specify how many zip packages
in each initrd area. When the specified number of packages decompressed in one
area, immediately terminate the loop. Have no impact on current use by default.

Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
---
 init/initramfs.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/init/initramfs.c b/init/initramfs.c
index ad1bd77..356764f 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -446,12 +446,24 @@ static unsigned long my_inptr; /* index of next byte to be processed in inbuf */

 #include <linux/decompress/generic.h>

+/* zero and negative means packages number is unlimited */
+static int initramfs_packnum __initdata;
+
+static __init int setup_initramfs_packnum(char *str)
+{
+	get_option(&str, &initramfs_packnum);
+
+	return 0;
+}
+early_param("initramfs_packnum", setup_initramfs_packnum);
+
 static char * __init unpack_to_rootfs(char *buf, unsigned long len)
 {
 	long written;
 	decompress_fn decompress;
 	const char *compress_name;
 	static __initdata char msg_buf[64];
+	int packnum = initramfs_packnum;

 	header_buf = kmalloc(110, GFP_KERNEL);
 	symlink_buf = kmalloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1, GFP_KERNEL);
@@ -500,6 +512,9 @@ static char * __init unpack_to_rootfs(char *buf, unsigned long len)
 		this_header = saved_offset + my_inptr;
 		buf += my_inptr;
 		len -= my_inptr;
+
+		if (!(--packnum))
+			break;
 	}
 	dir_utime();
 	kfree(name_buf);
--
1.8.0



.




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ