Skip to content

initramfs: kunit tests and cleanups

David Disseldorp linux-fsdevel linux-kselftest 4 versions – Applied

Status from this message: Applied to the vfs-6.15.initramfs branch of the vfs/vfs.git tree.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest8 patches 1 replyApplied
  2. v39 patches 1 replySuperseded
  3. v2 posting 2/20 of 9 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v2 posting 1/29 patches2 repliesSuperseded

Changes in v4 from the cover letter

- 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

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/8init: add initramfs_internal.hinit/initramfs.c init/initramfs_internal.h+21 -30 replies
2/8initramfs_test: kunit tests for initramfs unpackinginit/.kunitconfig init/Kconfig init/Makefile +1 more+418 -00 replies
3/8vsprintf: add simple_strntoulinclude/linux/kstrtox.h lib/vsprintf.c+8 -00 replies
4/8initramfs: avoid memcpy for hex header fieldsinit/initramfs.c+3 -60 replies
5/8initramfs: allocate heap buffers togetherinit/initramfs.c+11 -80 replies
6/8initramfs: reuse name_len for dir mtime trackinginit/initramfs.c+3 -40 replies
7/8initramfs: fix hardlink hash leak without TRAILERinit/initramfs.c+6 -10 replies
8/8initramfs: avoid static buffer for error messageinit/initramfs.c+3 -70 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/8] initramfs: kunit tests and cleanups

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/[email protected]
- 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