mbox series

[v4,0/8] initramfs: kunit tests and cleanups

Message ID 20250304061020.9815-1-ddiss@suse.de (mailing list archive)
Headers show
Series initramfs: kunit tests and cleanups | expand

Message

David Disseldorp March 4, 2025, 5:57 a.m. UTC
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

Comments

Christian Brauner March 4, 2025, 8:54 a.m. UTC | #1
On Tue, 04 Mar 2025 16:57:43 +1100, David Disseldorp wrote:
> 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
> 
> [...]

Ok, let's see if this breaks any testsuites.

---

Applied to the vfs-6.15.initramfs branch of the vfs/vfs.git tree.
Patches in the vfs-6.15.initramfs branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.15.initramfs

[1/8] init: add initramfs_internal.h
      https://git.kernel.org/vfs/vfs/c/5f469c4f7167
[2/8] initramfs_test: kunit tests for initramfs unpacking
      https://git.kernel.org/vfs/vfs/c/b6736cfccb58
[3/8] vsprintf: add simple_strntoul
      https://git.kernel.org/vfs/vfs/c/dfa63602367a
[4/8] initramfs: avoid memcpy for hex header fields
      https://git.kernel.org/vfs/vfs/c/2c4babf8d182
[5/8] initramfs: allocate heap buffers together
      https://git.kernel.org/vfs/vfs/c/b40c5e61f940
[6/8] initramfs: reuse name_len for dir mtime tracking
      https://git.kernel.org/vfs/vfs/c/aeff5090a5ea
[7/8] initramfs: fix hardlink hash leak without TRAILER
      https://git.kernel.org/vfs/vfs/c/15e2de59de08
[8/8] initramfs: avoid static buffer for error message
      https://git.kernel.org/vfs/vfs/c/154c1e422ffe