All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Disseldorp <ddiss@suse.de>
To: linux-fsdevel@vger.kernel.org
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>
Subject: [RFC PATCH 0/6] initramfs: reduce buffer footprint
Date: Tue, 15 Oct 2024 13:11:57 +0000	[thread overview]
Message-ID: <20241015133016.23468-1-ddiss@suse.de> (raw)

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(-)


             reply	other threads:[~2024-10-15 13:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-15 13:11 David Disseldorp [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241015133016.23468-1-ddiss@suse.de \
    --to=ddiss@suse.de \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.