mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] squashfs: harden fragment index table sizing
@ 2026-08-22 14:33 Karl Mehltretter
  2026-08-22 14:33 ` [PATCH 1/2] squashfs: fix fragment index table sizing overflow on 32-bit Karl Mehltretter
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Karl Mehltretter @ 2026-08-22 14:33 UTC (permalink / raw)
  To: Phillip Lougher
  Cc: Karl Mehltretter, Andrew Morton, linux-fsdevel, linux-kernel

Two integer overflows undermine fragment index table handling.  One is
in the original fragment sizing macros.  The other is in a bounds check
added by commit 1cac63cc9b2f ("Squashfs: add sanity checks to fragment
reading at mount time").

Patch 1: the fragment byte count wraps on 32-bit, so the index table
is allocated too small and squashfs_frag_lookup() reads out of bounds.
A crafted image triggers a KASAN out-of-bounds read on a 32-bit build.
With the fix the same image fails cleanly at mount.

Patch 2: the check that the table fits before the next one adds two u64
values controlled by the filesystem image and can wrap.

Built W=1 with gcc (x86_64, i386) and clang (x86_64).  Strict
checkpatch is clean.

Karl Mehltretter (2):
  squashfs: fix fragment index table sizing overflow on 32-bit
  squashfs: make the fragment index table bounds check overflow-safe

 fs/squashfs/fragment.c    | 6 ++++--
 fs/squashfs/squashfs_fs.h | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

-- 
2.53.0

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

end of thread, other threads:[~2026-08-29 17:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-22 14:33 [PATCH 0/2] squashfs: harden fragment index table sizing Karl Mehltretter
2026-08-22 14:33 ` [PATCH 1/2] squashfs: fix fragment index table sizing overflow on 32-bit Karl Mehltretter
2026-08-22 14:33 ` [PATCH 2/2] squashfs: make the fragment index table bounds check overflow-safe Karl Mehltretter
2026-08-28 23:37 ` [PATCH 0/2] squashfs: harden fragment index table sizing Andrew Morton
2026-08-29  2:48   ` Phillip Lougher
2026-08-29 17:52     ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®