[PATCH v2 2/3] test/py: test kernel_noload decompression buffer overflow
Aristo Chen
aristo.chen at canonical.com
Thu Jun 4 05:40:42 CEST 2026
Hi Simon,
On Thu, Jun 4, 2026 at 12:52 AM Simon Glass <sjg at chromium.org> wrote:
>
> Hi Aristo,
>
> On 2026-05-27T15:04:32, Aristo Chen <aristo.chen at canonical.com> wrote:
> > test/py: test kernel_noload decompression buffer overflow
> >
> > Add sandbox tests that exercise the per-image decompression buffer that
> > bootm_load_os() allocates for a compressed kernel_noload image
> > (ALIGN(image_len * 4, SZ_1M)).
> >
> > The overflow test builds a FIT whose decompressed size far exceeds the
> > per-image buffer and asserts that 'bootm loados' rejects it with a
> > decompression error rather than overflowing.
> >
> > The boundary test builds a FIT whose decompressed size equals the
> > per-image buffer exactly and asserts that 'bootm loados' succeeds,
> > guarding against an off-by-one rejection at the buffer limit.
> >
> > Signed-off-by: Aristo Chen <aristo.chen at canonical.com>
> >
> > test/py/tests/test_fit.py | 126 ++++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 126 insertions(+)
>
> You didn't pick up my review tag so I hope you don't mind a few more nits
Sure, I don't mind, I will fix them :)
>
> > diff --git a/test/py/tests/test_fit.py b/test/py/tests/test_fit.py
> > @@ -426,3 +456,99 @@ class TestFitImage:
> > + ubman.run_command('bootm loados', wait_for_prompt=False)
> > + matched = ubman.p.expect(['Image too large', ubman.prompt_compiled])
>
> Please use ubman.expect() rather than reaching into ubman.p directly
>
> > diff --git a/test/py/tests/test_fit.py b/test/py/tests/test_fit.py
> > @@ -117,6 +117,36 @@ host save hostfs 0 %(loadables1_addr)x %(loadables1_out)s %(loadables1_size)x
> > +# A minimal ITS for a compressed 'kernel_noload' kernel. bootm allocates a
> > +# per-image decompression buffer for this image type, sized as a multiple of
> > +# the compressed length; see the test_fit_kernel_noload_decomp_* tests.
> > +NOLOAD_ITS = '''
>
> The test could use a buildconfigspec('gzip')
>
> Regards,
> Simon
Regards,
Aristo
More information about the U-Boot
mailing list