linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/6] initramfs: reduce buffer footprint
@ 2024-10-15 13:11 David Disseldorp
  2024-10-15 13:11 ` [RFC PATCH 1/6] vsprintf: add simple_strntoul David Disseldorp
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: David Disseldorp @ 2024-10-15 13:11 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Al Viro, Christian Brauner

There are a number of stack, heap and data-segment buffers which are
unnecessary for initramfs unpacking. This patchset attempts to remove
them by:
- parsing cpio hex strings in place, instead of copying them for
  nul-termination. (Patches 1 & 2).
- reusing a single heap buffer for cpio header, file and symlink paths,
  instead of three separate buffers. (Patches 3 & 4).
- reusing the heap-allocated cpio buffer across both builtin and
  bootloader-provided unpack attempts. (Patch 5).
- reusing the heap-allocated cpio buffer for error messages on
  FSM-exit, instead of a data-segment buffer. (Patch 6).

I've flagged this as an RFC as I'd like to improve the commit messages
and also provide more thorough testing, likely via kunit / kselftest
integration.

Feedback appreciated.

David Disseldorp (6):
      vsprintf: add simple_strntoul
      initramfs: avoid memcpy for hex header fields
      initramfs: remove extra symlink path buffer
      initramfs: merge header_buf and name_buf
      initramfs: reuse buf for built-in and bootloader initramfs
      initramfs: avoid static buffer for error message

 include/linux/kstrtox.h |  1 +
 init/initramfs.c        | 50 +++++++++++++++++++++--------------------
 lib/vsprintf.c          |  7 ++++++
 3 files changed, 34 insertions(+), 24 deletions(-)


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-10-16  2:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-15 13:11 [RFC PATCH 0/6] initramfs: reduce buffer footprint David Disseldorp
2024-10-15 13:11 ` [RFC PATCH 1/6] vsprintf: add simple_strntoul David Disseldorp
2024-10-15 13:11 ` [RFC PATCH 2/6] initramfs: avoid memcpy for hex header fields David Disseldorp
2024-10-15 13:12 ` [RFC PATCH 3/6] initramfs: remove extra symlink path buffer David Disseldorp
2024-10-15 13:12 ` [RFC PATCH 4/6] initramfs: merge header_buf and name_buf David Disseldorp
2024-10-15 13:12 ` [RFC PATCH 5/6] initramfs: reuse buf for built-in and bootloader initramfs David Disseldorp
2024-10-15 13:12 ` [RFC PATCH 6/6] initramfs: avoid static buffer for error message David Disseldorp
2024-10-15 23:34 ` [RFC PATCH 0/6] initramfs: reduce buffer footprint Al Viro
2024-10-16  2:42   ` David Disseldorp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).