<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/init/initramfs.c, branch v6.8</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.8</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.8'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2023-12-15T16:23:00Z</updated>
<entry>
<title>initramfs: Expose retained initrd as sysfs file</title>
<updated>2023-12-15T16:23:00Z</updated>
<author>
<name>Alexander Graf</name>
<email>graf@amazon.com</email>
</author>
<published>2023-12-07T23:56:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2678fd2fe9ee2c569e9cb6b17e786bc8f0753538'/>
<id>urn:sha1:2678fd2fe9ee2c569e9cb6b17e786bc8f0753538</id>
<content type='text'>
When the kernel command line option "retain_initrd" is set, we do not
free the initrd memory. However, we also don't expose it to anyone for
consumption. That leaves us in a weird situation where the only user of
this feature is ppc64 and arm64 specific kexec tooling.

To make it more generally useful, this patch adds a kobject to the
firmware object that contains the initrd context when "retain_initrd"
is set. That way, we can access the initrd any time after boot from
user space and for example hand it into kexec as --initrd parameter
if we want to reboot the same initrd. Or inspect it directly locally.

With this patch applied, there is a new /sys/firmware/initrd file when
the kernel was booted with an initrd and "retain_initrd" command line
option is set.

Signed-off-by: Alexander Graf &lt;graf@amazon.com&gt;
Tested-by: Bagas Sanjaya &lt;bagasdotme@gmail.com&gt;
Link: https://lore.kernel.org/r/20231207235654.16622-1-graf@amazon.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>mm: remove arguments of show_mem()</title>
<updated>2023-08-18T17:12:02Z</updated>
<author>
<name>Kefeng Wang</name>
<email>wangkefeng.wang@huawei.com</email>
</author>
<published>2023-06-30T06:22:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=527ed4f7d902d362471a93e1a4afb604c18ceb48'/>
<id>urn:sha1:527ed4f7d902d362471a93e1a4afb604c18ceb48</id>
<content type='text'>
All callers of show_mem() pass 0 and NULL, so we can remove the two
arguments by directly calling __show_mem(0, NULL, MAX_NR_ZONES - 1) in
show_mem().

Link: https://lkml.kernel.org/r/20230630062253.189440-1-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang &lt;wangkefeng.wang@huawei.com&gt;
Cc: Christophe Leroy &lt;christophe.leroy@csgroup.eu&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Matthew Wilcox &lt;willy@infradead.org&gt;
Cc: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Cc: Nicholas Piggin &lt;npiggin@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>init/initramfs: Fix argument forwarding to panic() in panic_show_mem()</title>
<updated>2023-04-16T08:37:01Z</updated>
<author>
<name>Benjamin Gray</name>
<email>bgray@linux.ibm.com</email>
</author>
<published>2023-03-20T23:05:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=735faf92fb06d083ddcf6cfcf6665666dea5dcc1'/>
<id>urn:sha1:735faf92fb06d083ddcf6cfcf6665666dea5dcc1</id>
<content type='text'>
Forwarding variadic argument lists can't be done by passing a va_list
to a function with signature foo(...) (as panic() has). It ends up
interpreting the va_list itself as a single argument instead of
iterating it. printf() happily accepts it of course, leading to corrupt
output.

Convert panic_show_mem() to a macro to allow forwarding the arguments.
The function is trivial enough that it's easier than trying to introduce
a vpanic() variant.

Signed-off-by: Benjamin Gray &lt;bgray@linux.ibm.com&gt;
Reviewed-by: Andrew Donnellan &lt;ajd@linux.ibm.com&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>initramfs: use kstrtobool() instead of strtobool()</title>
<updated>2023-02-03T06:50:05Z</updated>
<author>
<name>Christophe JAILLET</name>
<email>christophe.jaillet@wanadoo.fr</email>
</author>
<published>2023-01-14T17:21:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f3296f80c8065b26a27eb8ab686d0c1d67880524'/>
<id>urn:sha1:f3296f80c8065b26a27eb8ab686d0c1d67880524</id>
<content type='text'>
strtobool() is the same as kstrtobool().  However, the latter is more used
within the kernel.

In order to remove strtobool() and slightly simplify kstrtox.h, switch to
the other function name.

While at it, include the corresponding header file (&lt;linux/kstrtox.h&gt;)

Link: https://lkml.kernel.org/r/2597e80cb7059ec6ad63a01b77d7c944dcc99195.1673716768.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Christophe JAILLET &lt;christophe.jaillet@wanadoo.fr&gt;
Cc: Christian Brauner &lt;brauner@kernel.org&gt;
Cc: David Disseldorp &lt;ddiss@suse.de&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Cc: Martin Wilck &lt;mwilck@suse.com&gt;
Cc: wuchi &lt;wuchi.zero@gmail.com&gt;
Cc: XU pengfei &lt;xupengfei@nfschina.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>initramfs: remove unnecessary (void*) conversion</title>
<updated>2022-11-18T21:55:08Z</updated>
<author>
<name>XU pengfei</name>
<email>xupengfei@nfschina.com</email>
</author>
<published>2022-10-26T08:05:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4197530bf167d5f15e68c4e4e982368c3d0a0112'/>
<id>urn:sha1:4197530bf167d5f15e68c4e4e982368c3d0a0112</id>
<content type='text'>
Remove unnecessary void* type casting.

Link: https://lkml.kernel.org/r/20221026080517.3221-1-xupengfei@nfschina.com
Signed-off-by: XU pengfei &lt;xupengfei@nfschina.com&gt;
Cc: Christian Brauner &lt;brauner@kernel.org&gt;
Cc: David Disseldorp &lt;ddiss@suse.de&gt;
Cc: "Eric W . Biederman" &lt;ebiederm@xmission.com&gt;
Cc: Martin Wilck &lt;mwilck@suse.com&gt;
Cc: Mike Rapoport &lt;rppt@kernel.org&gt;
Cc: wuchi &lt;wuchi.zero@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>initramfs: mark my_inptr as __initdata</title>
<updated>2022-09-12T04:55:11Z</updated>
<author>
<name>wuchi</name>
<email>wuchi.zero@gmail.com</email>
</author>
<published>2022-08-27T07:11:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=199cda13534f4c676d7e4601665e971f4f0582c4'/>
<id>urn:sha1:199cda13534f4c676d7e4601665e971f4f0582c4</id>
<content type='text'>
As my_inptr is only used in __init function unpack_to_rootfs(), mark it as
__initdata to allow it be freed after boot.

Link: https://lkml.kernel.org/r/20220827071116.83078-1-wuchi.zero@gmail.com
Signed-off-by: wuchi &lt;wuchi.zero@gmail.com&gt;
Reviewed-by: David Disseldorp &lt;ddiss@suse.de&gt;
Cc: Alexander Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Martin Wilck &lt;mwilck@suse.com&gt;
Cc: Matthew Wilcox &lt;willy@infradead.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'kthread-cleanups-for-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace</title>
<updated>2022-06-03T23:03:05Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2022-06-03T23:03:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1ec6574a3c0a22c130c08e8c36c825cb87d68f8e'/>
<id>urn:sha1:1ec6574a3c0a22c130c08e8c36c825cb87d68f8e</id>
<content type='text'>
Pull kthread updates from Eric Biederman:
 "This updates init and user mode helper tasks to be ordinary user mode
  tasks.

  Commit 40966e316f86 ("kthread: Ensure struct kthread is present for
  all kthreads") caused init and the user mode helper threads that call
  kernel_execve to have struct kthread allocated for them. This struct
  kthread going away during execve in turned made a use after free of
  struct kthread possible.

  Here, commit 343f4c49f243 ("kthread: Don't allocate kthread_struct for
  init and umh") is enough to fix the use after free and is simple
  enough to be backportable.

  The rest of the changes pass struct kernel_clone_args to clean things
  up and cause the code to make sense.

  In making init and the user mode helpers tasks purely user mode tasks
  I ran into two complications. The function task_tick_numa was
  detecting tasks without an mm by testing for the presence of
  PF_KTHREAD. The initramfs code in populate_initrd_image was using
  flush_delayed_fput to ensuere the closing of all it's file descriptors
  was complete, and flush_delayed_fput does not work in a userspace
  thread.

  I have looked and looked and more complications and in my code review
  I have not found any, and neither has anyone else with the code
  sitting in linux-next"

* tag 'kthread-cleanups-for-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
  sched: Update task_tick_numa to ignore tasks without an mm
  fork: Stop allowing kthreads to call execve
  fork: Explicitly set PF_KTHREAD
  init: Deal with the init process being a user mode process
  fork: Generalize PF_IO_WORKER handling
  fork: Explicity test for idle tasks in copy_thread
  fork: Pass struct kernel_clone_args into copy_thread
  kthread: Don't allocate kthread_struct for init and umh
</content>
</entry>
<entry>
<title>initramfs: support cpio extraction with file checksums</title>
<updated>2022-05-10T01:29:20Z</updated>
<author>
<name>David Disseldorp</name>
<email>ddiss@suse.de</email>
</author>
<published>2022-05-10T01:29:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=800c24dc34b93d2014f3952683f8d5e9309e1b73'/>
<id>urn:sha1:800c24dc34b93d2014f3952683f8d5e9309e1b73</id>
<content type='text'>
Add support for extraction of checksum-enabled "070702" cpio archives,
specified in Documentation/driver-api/early-userspace/buffer-format.rst. 
Fail extraction if the calculated file data checksum doesn't match the
value carried in the header.

Link: https://lkml.kernel.org/r/20220404093429.27570-7-ddiss@suse.de
Signed-off-by: David Disseldorp &lt;ddiss@suse.de&gt;
Suggested-by: Matthew Wilcox (Oracle) &lt;willy@infradead.org&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Cc: Martin Wilck &lt;mwilck@suse.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>initramfs: add INITRAMFS_PRESERVE_MTIME Kconfig option</title>
<updated>2022-05-10T01:29:19Z</updated>
<author>
<name>David Disseldorp</name>
<email>ddiss@suse.de</email>
</author>
<published>2022-05-10T01:29:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1274aea127b2e8c9a4b9cbcc3ea6baf78990a958'/>
<id>urn:sha1:1274aea127b2e8c9a4b9cbcc3ea6baf78990a958</id>
<content type='text'>
initramfs cpio mtime preservation, as implemented in commit 889d51a10712
("initramfs: add option to preserve mtime from initramfs cpio images"),
uses a linked list to defer directory mtime processing until after all
other items in the cpio archive have been processed.  This is done to
ensure that parent directory mtimes aren't overwritten via subsequent
child creation.

The lkml link below indicates that the mtime retention use case was for
embedded devices with applications running exclusively out of initramfs,
where the 32-bit mtime value provided a rough file version identifier. 
Linux distributions which discard an extracted initramfs immediately after
the root filesystem has been mounted may want to avoid the unnecessary
overhead.

This change adds a new INITRAMFS_PRESERVE_MTIME Kconfig option, which can
be used to disable on-by-default mtime retention and in turn speed up
initramfs extraction, particularly for cpio archives with large directory
counts.

Benchmarks with a one million directory cpio archive extracted 20 times
demonstrated:
				mean extraction time (s)	std dev
INITRAMFS_PRESERVE_MTIME=y		3.808			 0.006
INITRAMFS_PRESERVE_MTIME unset		3.056			 0.004

The above extraction times were measured using ftrace (initcall_finish -
initcall_start) values for populate_rootfs() with initramfs_async
disabled.

[ddiss@suse.de: rebase atop dir_entry.name flexible array member and drop separate initramfs_mtime.h header]
Link: https://lkml.org/lkml/2008/9/3/424
Link: https://lkml.kernel.org/r/20220404093429.27570-4-ddiss@suse.de
Signed-off-by: David Disseldorp &lt;ddiss@suse.de&gt;
Reviewed-by: Martin Wilck &lt;mwilck@suse.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Cc: Matthew Wilcox (Oracle) &lt;willy@infradead.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>initramfs: make dir_entry.name a flexible array member</title>
<updated>2022-05-10T01:29:19Z</updated>
<author>
<name>David Disseldorp</name>
<email>ddiss@suse.de</email>
</author>
<published>2022-05-10T01:29:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fcb7aedd2e90c4ad43f7f01827014df8c6f034a5'/>
<id>urn:sha1:fcb7aedd2e90c4ad43f7f01827014df8c6f034a5</id>
<content type='text'>
dir_entry.name is currently allocated via a separate kstrdup().  Change it
to a flexible array member and allocate it along with struct dir_entry.

Link: https://lkml.kernel.org/r/20220404093429.27570-3-ddiss@suse.de
Signed-off-by: David Disseldorp &lt;ddiss@suse.de&gt;
Acked-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Martin Wilck &lt;mwilck@suse.com&gt;
Cc: Matthew Wilcox (Oracle) &lt;willy@infradead.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
</feed>
