All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] fs/squashfs: fix directory table integer overflow
@ 2026-07-28  6:55 Shahriyar Jalayeri
  2026-07-28  6:55 ` [PATCH v2 1/2] fs/squashfs: fix integer overflow in directory table allocation Shahriyar Jalayeri
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Shahriyar Jalayeri @ 2026-07-28  6:55 UTC (permalink / raw)
  To: u-boot, Thomas Petazzoni, Miquel Raynal, Joao Marcos Costa,
	u-boot
  Cc: Richard Genoud, Tom Rini, Michael Zimmermann, Eric Kilmer, Argus,
	Shahriyar Jalayeri

This fixes an integer overflow in the SquashFS directory-table reader
that leads to a heap out-of-bounds write, and adds a regression test.

sqfs_read_directory_table() sizes the directory table with an int
multiply (metablks_count * SQFS_METADATA_BLOCK_SIZE) that wraps for a
crafted image, under-allocating the buffer that the fill loop then
overruns. It is reached by listing or reading the image (sqfsls /
sqfsload). Patch 1 guards the allocation with __builtin_mul_overflow();
patch 2 adds a test that a crafted image is rejected.

Based on v2026.07 (fdfe2ec48d5c). A reproducer is available on request.

Signed-off-by: Shahriyar Jalayeri <shahriyar@byteray.co.uk>
---
Changes in v2:
- Use my real name in the From and Signed-off-by

---
Shahriyar Jalayeri (2):
      fs/squashfs: fix integer overflow in directory table allocation
      test: squashfs: add directory table overflow regression test

 fs/squashfs/sqfs.c                                 | 23 +++++--
 .../test_fs/test_squashfs/test_sqfs_overflow.py    | 75 ++++++++++++++++++++++
 2 files changed, 94 insertions(+), 4 deletions(-)
---
base-commit: fdfe2ec48d5c1c2ed03073d73edd3fdd3fe1ffa1
change-id: 20260723-sqfs-oob-fix-e202a643c3d8

Best regards,
--  
Shahriyar Jalayeri <shahriyar@byteray.co.uk>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-08-27 23:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28  6:55 [PATCH v2 0/2] fs/squashfs: fix directory table integer overflow Shahriyar Jalayeri
2026-07-28  6:55 ` [PATCH v2 1/2] fs/squashfs: fix integer overflow in directory table allocation Shahriyar Jalayeri
2026-07-28  6:55 ` [PATCH v2 2/2] test: squashfs: add directory table overflow regression test Shahriyar Jalayeri
2026-08-26 22:32 ` [PATCH v2 0/2] fs/squashfs: fix directory table integer overflow Tom Rini
2026-08-27  7:25   ` Richard GENOUD
2026-08-27 23:53 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.