Hi Karl,
On Sun, 30 Aug 2026 at 05:05, Karl Mehltretter <[email protected]> wrote:
> Add table-driven tests for the 842 decompressor's output and history
> validation.
>
> Three malformed streams cover an indexed copy larger than the remaining
> output, short data larger than the remaining output, and a repeat after
> fewer than eight output bytes. Every case checks the return value, output
> length and fixed guard bands on both sides of the output. Successful cases
> also check complete contents from a poison-filled destination. The repeat
> vector's CRC includes the leading guard byte, so the unfixed decoder
> successfully validates the CRC after reading before the buffer.
>
> Three valid streams cover the same boundaries at equality: an I8 index
> consuming the final eight bytes, five short-data bytes consuming the final
> five, and a repeat with exactly one block of history.
>
> On an unmodified baseline the malformed cases fail and the boundary cases
> pass; with the preceding fixes all six pass.
>
> Assisted-by: LLM
> Signed-off-by: Karl Mehltretter <[email protected]>
Thanks for your patch, which is now commit cca072cb1423191c
("lib/842: add KUnit tests for the decompressor") in crypto/master
> ---
> Review notes:
>
> - CONFIG_842_DECOMPRESS_KUNIT_TEST=m selects 842_DECOMPRESS=m.
> - A fixed x86_64 CONFIG_PROVE_LOCKING=y run passes all six cases without
> a lockdep report.
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -2225,6 +2225,21 @@ menuconfig RUNTIME_TESTING_MENU
>
> if RUNTIME_TESTING_MENU
>
> +config 842_DECOMPRESS_KUNIT_TEST
> + tristate "KUnit tests for the 842 decompressor" if !KUNIT_ALL_TESTS
> + depends on KUNIT
> + select 842_DECOMPRESS
Enabling a (modular) test should not silently enable additional kernel
functionality, as that may increase the attack vector for a product.
> + default KUNIT_ALL_TESTS
> + help
> + Enable stream-validation and boundary tests for the software 842
> + decompressor. The tests exercise indexed copies, short data and
> + repeat operations at valid and invalid output or history boundaries.
> +
> + For more information on KUnit and unit tests in general, refer to
> + Documentation/dev-tools/kunit/.
> +
> + If unsure, say N.
> +
> config TEST_DHRY
> tristate "Dhrystone benchmark test"
> help
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds