Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: David Disseldorp <ddiss@suse.de>
To: linux-fsdevel@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org,
	Al Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>
Subject: [PATCH v4 0/8] initramfs: kunit tests and cleanups
Date: Tue,  4 Mar 2025 16:57:43 +1100	[thread overview]
Message-ID: <20250304061020.9815-1-ddiss@suse.de> (raw)

This patchset adds basic kunit test coverage for initramfs unpacking
and cleans up some minor buffer handling issues / inefficiencies.

Changes since v3:
- Drop shared unpack buffer changes
  + rework into initramfs: allocate heap buffers together (patch 5/8)
  + extra review complexity wasn't worth the tiny boot-time heap saving
- move hardlink hash leak repro into first initramfs_test patch
- add note regarding kunit section=.data -> section=.init.text warning

Changes since v2 (patch 2 only):
- fix !CONFIG_INITRAMFS_PRESERVE_MTIME kunit test checks
- add test MODULE_DESCRIPTION(), as suggested by Jeff Johnson
- add some missing headers, reported by kernel test robot

Changes since v1 (RFC):
- rebase atop v6.12-rc6 and filename field overrun fix from
  https://lore.kernel.org/r/20241030035509.20194-2-ddiss@suse.de
- add unit test coverage (new patches 1 and 2)
- add patch: fix hardlink hash leak without TRAILER
- rework patch: avoid static buffer for error message
  + drop unnecessary message propagation
- drop patch: cpio_buf reuse for built-in and bootloader initramfs
  + no good justification for the change

Feedback appreciated.

David Disseldorp (8):
      init: add initramfs_internal.h
      initramfs_test: kunit tests for initramfs unpacking
      vsprintf: add simple_strntoul
      initramfs: avoid memcpy for hex header fields
      initramfs: allocate heap buffers together
      initramfs: reuse name_len for dir mtime tracking
      initramfs: fix hardlink hash leak without TRAILER
      initramfs: avoid static buffer for error message

 include/linux/kstrtox.h   |   1 +
 init/.kunitconfig         |   3 +
 init/Kconfig              |   7 +
 init/Makefile             |   1 +
 init/initramfs.c          |  66 ++++----
 init/initramfs_internal.h |   8 +
 init/initramfs_test.c     | 407 ++++++++++++++++++++++++++++++++++++++++++++++
 lib/vsprintf.c            |   7 +
 8 files changed, 472 insertions(+), 28 deletions(-)
 create mode 100644 init/.kunitconfig
 create mode 100644 init/initramfs_internal.h
 create mode 100644 init/initramfs_test.c

             reply	other threads:[~2025-03-04  6:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-04  5:57 David Disseldorp [this message]
2025-03-04  5:57 ` [PATCH v4 1/8] init: add initramfs_internal.h David Disseldorp
2025-03-04  5:57 ` [PATCH v4 2/8] initramfs_test: kunit tests for initramfs unpacking David Disseldorp
2025-03-04  5:57 ` [PATCH v4 3/8] vsprintf: add simple_strntoul David Disseldorp
2025-03-04  5:57 ` [PATCH v4 4/8] initramfs: avoid memcpy for hex header fields David Disseldorp
2025-03-04  5:57 ` [PATCH v4 5/8] initramfs: allocate heap buffers together David Disseldorp
2025-03-04  5:57 ` [PATCH v4 6/8] initramfs: reuse name_len for dir mtime tracking David Disseldorp
2025-03-04  5:57 ` [PATCH v4 7/8] initramfs: fix hardlink hash leak without TRAILER David Disseldorp
2025-03-04  5:57 ` [PATCH v4 8/8] initramfs: avoid static buffer for error message David Disseldorp
2025-03-04  8:54 ` [PATCH v4 0/8] initramfs: kunit tests and cleanups Christian Brauner
2025-03-05 13:09   ` [PATCH] initramfs_test: flag kunit_case __refdata to suppress warning David Disseldorp
2025-03-06  7:13     ` Christian Brauner

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=20250304061020.9815-1-ddiss@suse.de \
    --to=ddiss@suse.de \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kselftest@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox