<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/init/initramfs.c, branch v4.11.5</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.11.5</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.11.5'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2017-05-20T12:49:49+00:00</updated>
<entry>
<title>initramfs: avoid "label at end of compound statement" error</title>
<updated>2017-05-20T12:49:49+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2017-05-06T17:27:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=602f8911c7dc9e54aaef1c3cd3ef31855dc270e3'/>
<id>urn:sha1:602f8911c7dc9e54aaef1c3cd3ef31855dc270e3</id>
<content type='text'>
commit 394e4f5d5834b610ee032cceb20a1b1f45b01d28 upstream.

Commit 17a9be317475 ("initramfs: Always do fput() and load modules after
rootfs populate") introduced an error for the

    CONFIG_BLK_DEV_RAM=y

case, because even though the code looks fine, the compiler really wants
a statement after a label, or you'll get complaints:

  init/initramfs.c: In function 'populate_rootfs':
  init/initramfs.c:644:2: error: label at end of compound statement

That commit moved the subsequent statements to outside the compound
statement, leaving the label without any associated statements.

Reported-by: Jörg Otte &lt;jrg.otte@gmail.com&gt;
Fixes: 17a9be317475 ("initramfs: Always do fput() and load modules after rootfs populate")
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Stafford Horne &lt;shorne@gmail.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>initramfs: Always do fput() and load modules after rootfs populate</title>
<updated>2017-05-20T12:49:49+00:00</updated>
<author>
<name>Stafford Horne</name>
<email>shorne@gmail.com</email>
</author>
<published>2017-05-04T12:15:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e54af78e1a74dc3d77a0da1d5a2889ab621cfc49'/>
<id>urn:sha1:e54af78e1a74dc3d77a0da1d5a2889ab621cfc49</id>
<content type='text'>
commit 17a9be31747535184f2af156b1f080ec4c92a952 upstream.

In OpenRISC we do not have a bootloader passed initrd, but the built in
initramfs does contain the /init and other binaries, including modules.
The previous commit 08865514805d2 ("initramfs: finish fput() before
accessing any binary from initramfs") made a change to only call fput()
if the bootloader initrd was available, this caused intermittent crashes
for OpenRISC.

This patch changes the fput() to happen unconditionally if any rootfs is
loaded. Also, I added some comments to make it a bit more clear why we
call unpack_to_rootfs() multiple times.

Fixes: 08865514805d2 ("initramfs: finish fput() before accessing any binary from initramfs")
Cc: Lokesh Vutla &lt;lokeshvutla@ti.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Acked-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Stafford Horne &lt;shorne@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>initramfs: finish fput() before accessing any binary from initramfs</title>
<updated>2017-02-28T02:43:46+00:00</updated>
<author>
<name>Lokesh Vutla</name>
<email>lokeshvutla@ti.com</email>
</author>
<published>2017-02-27T22:28:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=08865514805d2de8e7002fa8149c5de3e391f412'/>
<id>urn:sha1:08865514805d2de8e7002fa8149c5de3e391f412</id>
<content type='text'>
Commit 4a9d4b024a31 ("switch fput to task_work_add") implements a
schedule_work() for completing fput(), but did not guarantee calling
__fput() after unpacking initramfs.  Because of this, there is a
possibility that during boot a driver can see ETXTBSY when it tries to
load a binary from initramfs as fput() is still pending on that binary.

This patch makes sure that fput() is completed after unpacking initramfs
and removes the call to flush_delayed_fput() in kernel_init() which
happens very late after unpacking initramfs.

Link: http://lkml.kernel.org/r/20170201140540.22051-1-lokeshvutla@ti.com
Signed-off-by: Lokesh Vutla &lt;lokeshvutla@ti.com&gt;
Reported-by: Murali Karicheri &lt;m-karicheri2@ti.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Tero Kristo &lt;t-kristo@ti.com&gt;
Cc: Sekhar Nori &lt;nsekhar@ti.com&gt;
Cc: Nishanth Menon &lt;nm@ti.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>kexec: split kexec_load syscall from kexec core code</title>
<updated>2015-09-10T20:29:01+00:00</updated>
<author>
<name>Dave Young</name>
<email>dyoung@redhat.com</email>
</author>
<published>2015-09-09T22:38:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2965faa5e03d1e71e9ff9aa143fff39e0a77543a'/>
<id>urn:sha1:2965faa5e03d1e71e9ff9aa143fff39e0a77543a</id>
<content type='text'>
There are two kexec load syscalls, kexec_load another and kexec_file_load.
 kexec_file_load has been splited as kernel/kexec_file.c.  In this patch I
split kexec_load syscall code to kernel/kexec.c.

And add a new kconfig option KEXEC_CORE, so we can disable kexec_load and
use kexec_file_load only, or vice verse.

The original requirement is from Ted Ts'o, he want kexec kernel signature
being checked with CONFIG_KEXEC_VERIFY_SIG enabled.  But kexec-tools use
kexec_load syscall can bypass the checking.

Vivek Goyal proposed to create a common kconfig option so user can compile
in only one syscall for loading kexec kernel.  KEXEC/KEXEC_FILE selects
KEXEC_CORE so that old config files still work.

Because there's general code need CONFIG_KEXEC_CORE, so I updated all the
architecture Kconfig with a new option KEXEC_CORE, and let KEXEC selects
KEXEC_CORE in arch Kconfig.  Also updated general kernel code with to
kexec_load syscall.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Dave Young &lt;dyoung@redhat.com&gt;
Cc: Eric W. Biederman &lt;ebiederm@xmission.com&gt;
Cc: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Cc: Petr Tesarik &lt;ptesarik@suse.cz&gt;
Cc: Theodore Ts'o &lt;tytso@mit.edu&gt;
Cc: Josh Boyer &lt;jwboyer@fedoraproject.org&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Cc: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>init/initramfs.c: resolve shadow warnings</title>
<updated>2014-10-14T00:18:22+00:00</updated>
<author>
<name>Mark Rustad</name>
<email>mark.d.rustad@intel.com</email>
</author>
<published>2014-10-13T22:54:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c34d85aca91729596f876604e147892b81ecbbe9'/>
<id>urn:sha1:c34d85aca91729596f876604e147892b81ecbbe9</id>
<content type='text'>
Resolve shadow warnings that are produced in W=2 builds by renaming a
global with a too-generic name and renaming a formal parameter.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Mark Rustad &lt;mark.d.rustad@intel.com&gt;
Signed-off-by: Jeff Kirsher &lt;jeffrey.t.kirsher@intel.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>initramfs: add write error checks</title>
<updated>2014-08-08T22:57:26+00:00</updated>
<author>
<name>David Engraf</name>
<email>david.engraf@sysgo.com</email>
</author>
<published>2014-08-08T21:23:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9687fd9101afaa1c4b1de7ffd2f9d7e53f45b29f'/>
<id>urn:sha1:9687fd9101afaa1c4b1de7ffd2f9d7e53f45b29f</id>
<content type='text'>
On a system with low memory extracting the initramfs may fail.  If this
happens the user gets "Failed to execute /init" instead of an initramfs
error.

Check return value of sys_write and call error() when the write was
incomplete or failed.

Signed-off-by: David Engraf &lt;david.engraf@sysgo.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>initramfs: support initramfs that is bigger than 2GiB</title>
<updated>2014-08-08T22:57:26+00:00</updated>
<author>
<name>Yinghai Lu</name>
<email>yinghai@kernel.org</email>
</author>
<published>2014-08-08T21:23:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d97b07c54f34e88352ebe676beb798c8f59ac588'/>
<id>urn:sha1:d97b07c54f34e88352ebe676beb798c8f59ac588</id>
<content type='text'>
Now with 64bit bzImage and kexec tools, we support ramdisk that size is
bigger than 2g, as we could put it above 4G.

Found compressed initramfs image could not be decompressed properly.  It
turns out that image length is int during decompress detection, and it
will become &lt; 0 when length is more than 2G.  Furthermore, during
decompressing len as int is used for inbuf count, that has problem too.

Change len to long, that should be ok as on 32 bit platform long is
32bits.

Tested with following compressed initramfs image as root with kexec.
	gzip, bzip2, xz, lzma, lzop, lz4.
run time for populate_rootfs():
   size        name       Nehalem-EX  Westmere-EX  Ivybridge-EX
 9034400256 root_img     :   26s           24s          30s
 3561095057 root_img.lz4 :   28s           27s          27s
 3459554629 root_img.lzo :   29s           29s          28s
 3219399480 root_img.gz  :   64s           62s          49s
 2251594592 root_img.xz  :  262s          260s         183s
 2226366598 root_img.lzma:  386s          376s         277s
 2901482513 root_img.bz2 :  635s          599s

Signed-off-by: Yinghai Lu &lt;yinghai@kernel.org&gt;
Cc: "H. Peter Anvin" &lt;hpa@zytor.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Rashika Kheria &lt;rashika.kheria@gmail.com&gt;
Cc: Josh Triplett &lt;josh@joshtriplett.org&gt;
Cc: Kyungsik Lee &lt;kyungsik.lee@lge.com&gt;
Cc: P J P &lt;ppandit@redhat.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Tetsuo Handa &lt;penguin-kernel@i-love.sakura.ne.jp&gt;
Cc: "Daniel M. Weeks" &lt;dan@danweeks.net&gt;
Cc: Alexandre Courbot &lt;acourbot@nvidia.com&gt;
Cc: Jan Beulich &lt;JBeulich@suse.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>initramfs: support initrd that is bigger than 2GiB</title>
<updated>2014-08-08T22:57:26+00:00</updated>
<author>
<name>Yinghai Lu</name>
<email>yinghai@kernel.org</email>
</author>
<published>2014-08-08T21:23:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=38747439914c468ecba70b492b54dc4ef0b50453'/>
<id>urn:sha1:38747439914c468ecba70b492b54dc4ef0b50453</id>
<content type='text'>
When initrd (compressed or not) is used, kernel report data corrupted with
/dev/ram0.

The root cause:
During initramfs checking, if it is initrd, it will be transferred to
/initrd.image with sys_write.
sys_write only support 2G-4K write, so if the initrd ram is more than
that, /initrd.image will not complete at all.

Add local xwrite to loop calling sys_write to workaround the problem.

Also need to use xwrite in write_buffer() to handle:
image is uncompressed cpio and there is one big file (&gt;2G) in it.
   unpack_to_rootfs ===&gt; write_buffer ===&gt; actions[]/do_copy

At the same time, we don't need to worry about sys_read/sys_write in
do_mounts_rd.c::crd_load.  As decompressor will have fill/flush and local
buffer that is smaller than 2G.

Test with uncompressed initrd, and compressed ones with gz, bz2, lzma,xz,
lzop.

Signed-off-by: Yinghai Lu &lt;yinghai@kernel.org&gt;
Acked-by: H. Peter Anvin &lt;hpa@zytor.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Cc: Tetsuo Handa &lt;penguin-kernel@i-love.sakura.ne.jp&gt;
Cc: "Daniel M. Weeks" &lt;dan@danweeks.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>initramfs: debug detected compression method</title>
<updated>2014-04-07T23:36:11+00:00</updated>
<author>
<name>Daniel M. Weeks</name>
<email>dan@danweeks.net</email>
</author>
<published>2014-04-07T22:39:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6aa7a29aa8378fa868fabef6a84b0a40d5d9d677'/>
<id>urn:sha1:6aa7a29aa8378fa868fabef6a84b0a40d5d9d677</id>
<content type='text'>
This can greatly aid in narrowing down the real source of initramfs
problems such as failures related to the compression of the in-kernel
initramfs when an external initramfs is in use as well.  Existing errors
are ambiguous as to which initramfs is a problem and why.

[akpm@linux-foundation.org: use pr_debug()]
Signed-off-by: Daniel M. Weeks &lt;dan@danweeks.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>init: fix possible format string bug</title>
<updated>2014-01-24T00:36:58+00:00</updated>
<author>
<name>Tetsuo Handa</name>
<email>penguin-kernel@i-love.sakura.ne.jp</email>
</author>
<published>2014-01-23T23:54:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=499a4584d7f817d43d09ccfc6bb26315eeaab6bc'/>
<id>urn:sha1:499a4584d7f817d43d09ccfc6bb26315eeaab6bc</id>
<content type='text'>
Use constant format string in case message changes.

Signed-off-by: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
