- 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 (9):
init: add initramfs_internal.h
The new header only exports a single unpack function and a CPIO_HDRLEN
constant for future test use.
Signed-off-by: David Disseldorp
---
init/initramfs.c | 16 +---
init/initramfs_internal.h | 8
2 files changed, 21 insertions(+), 3 deletions(-)
create mode
Provide some basic initramfs unpack sanity tests covering:
- simple file / dir extraction
- filename field overrun, as reported and fixed separately via
https://lore.kernel.org/r/20241030035509.20194-2-dd...@suse.de
- "070702" cpio data checksums
- hardlinks
Signed-off-by: David
cpio extraction currently does a memcpy to ensure that the archive hex
fields are null terminated for simple_strtoul(). simple_strntoul() will
allow us to avoid the memcpy.
Signed-off-by: David Disseldorp
---
include/linux/kstrtox.h | 1 +
lib/vsprintf.c | 7 +++
2 files changed, 8
.
Signed-off-by: David Disseldorp
---
init/initramfs.c | 26 +++---
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/init/initramfs.c b/init/initramfs.c
index 59b4a43fa491b..4e2506a4bc76f 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -250,11 +250,11
We already have a nulterm-inclusive, checked name_len for the directory
name, so use that instead of calling strlen().
Signed-off-by: David Disseldorp
---
init/initramfs.c | 7 +++
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/init/initramfs.c b/init/initramfs.c
index
cpio entries.
Separate symlink / non-symlink buffers are unnecessary, so just extend
the size of name_buf and use it for both.
Signed-off-by: David Disseldorp
---
init/initramfs.c | 12 +---
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/init/initramfs.c b/init/initramfs.c
76951102 888052265 ./init/initramfs.o
After:
textdata bss dec hex filename
76831006 8869721f9 ./init/initramfs.o
Signed-off-by: David Disseldorp
---
init/initramfs.c | 10 +++---
1 file changed, 3 insertions(+), 7 deletions(-)
diff --
newc/crc cpio headers contain a bunch of 8-character hexadecimal fields
which we convert via simple_strtoul(), following memcpy() into a
zero-terminated stack buffer. The new simple_strntoul() helper allows us
to pass in max_chars=8 to avoid zero-termination and memcpy().
Signed-off-by: David
cing side-effect of this fix: hardlinks can
currently be associated across built-in and external initramfs archives,
*if* the built-in initramfs archive lacks a "TRAILER!!!" terminator. I'd
consider this cross-archive association broken, but perhaps it's used.
Signed-off-by: David Diss
[adding kunit lists to cc, see lore link below for context]
https://lore.kernel.org/linux-fsdevel/20241104141750.16119-3-dd...@suse.de/
On Wed, 6 Nov 2024 07:04:21 +0800, kernel test robot wrote:
...
> All warnings (new ones prefixed by >>, old ones prefixed by <<):
>
> >> WARNING: modpost: vmli
On Thu, 7 Nov 2024 11:17:27 +1100, David Disseldorp wrote:
> Covered in Documentation/driver-api/early-userspace/buffer-format.rst ,
> initramfs archives can carry an optional "TRAILER!!!" entry which serves
> as a boundary for collecting and associating hardlinks with matchin
[cc'ing linux-kselftest and kunit-dev]
Hi,
On Wed, 5 Mar 2025 01:47:55 +0800, kernel test robot wrote:
> tree: https://github.com/brauner/linux.git vfs.all
> head: ea47e99a3a234837d5fea0d1a20bb2ad1eaa6dd4
> commit: b6736cfccb582b7c016cba6cd484fbcf30d499af [205/231] initramfs_test:
> kunit t
cing side-effect of this fix: hardlinks can
currently be associated across built-in and external initramfs archives,
*if* the built-in initramfs archive lacks a "TRAILER!!!" terminator. I'd
consider this cross-archive association broken, but perhaps it's used.
Signed-off-by: David
uring early boot
isn't really worth the extra review complexity.
Link: https://lore.kernel.org/all/20241107002044.16477-7-dd...@suse.de/
Signed-off-by: David Disseldorp
---
init/initramfs.c | 19 +++
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/init/initramf
ew modpost warnings for initramfs_test_cases
section=.data -> section=.init.text run_case() hooks. The
kunit_case/_suite struct cannot be marked as __initdata as this
will be used in debugfs to retrieve results after a test has run.
Signed-off-by: David Disseldorp
---
init/.kunitconfig
The new header only exports a single unpack function and a CPIO_HDRLEN
constant for future test use.
Signed-off-by: David Disseldorp
---
init/initramfs.c | 16 +---
init/initramfs_internal.h | 8
2 files changed, 21 insertions(+), 3 deletions(-)
create mode
newc/crc cpio headers contain a bunch of 8-character hexadecimal fields
which we convert via simple_strtoul(), following memcpy() into a
zero-terminated stack buffer. The new simple_strntoul() helper allows us
to pass in max_chars=8 to avoid zero-termination and memcpy().
Signed-off-by: David
80061118 8913223ac init/initramfs.o
After:
textdata bss dec hex filename
79381022 889682308 init/initramfs.o
Signed-off-by: David Disseldorp
---
init/initramfs.c | 10 +++---
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a
tch: 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):
i
We already have a nulterm-inclusive, checked name_len for the directory
name, so use that instead of calling strlen().
Signed-off-by: David Disseldorp
---
init/initramfs.c | 7 +++
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/init/initramfs.c b/init/initramfs.c
index
cpio extraction currently does a memcpy to ensure that the archive hex
fields are null terminated for simple_strtoul(). simple_strntoul() will
allow us to avoid the memcpy.
Signed-off-by: David Disseldorp
---
include/linux/kstrtox.h | 1 +
lib/vsprintf.c | 7 +++
2 files changed, 8
On Wed, 5 Mar 2025 11:47:01 +1100, David Disseldorp wrote:
> [cc'ing linux-kselftest and kunit-dev]
>
> Hi,
>
> On Wed, 5 Mar 2025 01:47:55 +0800, kernel test robot wrote:
>
> > tree: https://github.com/brauner/linux.git vfs.all
> > head: ea47e99a3a234837
hen Rothwell
Signed-off-by: David Disseldorp
---
@Christian: feel free to squash this in with commit b6736cfccb582
("initramfs_test: kunit tests for initramfs unpacking") in your
vfs-6.15.initramfs branch if you like (and remove "These tests introduce
new modpost warnings..." from
24 matches
Mail list logo