From: Pranav Rajendran <pranavkasthuri@gmail.com>
To: u-boot@lists.u-boot-project.org
Cc: joaomarcos.costa@bootlin.com, richard.genoud@bootlin.com,
thomas.petazzoni@bootlin.com, miquel.raynal@bootlin.com,
trini@konsulko.com, Pranav Rajendran <pranavkasthuri@gmail.com>
Subject: [PATCH v1 0/2] fs/squashfs: bounds checks on image-controlled offsets
Date: Sat, 15 Aug 2026 23:01:13 +0100 [thread overview]
Message-ID: <20260815220115.11335-1-pranavkasthuri@gmail.com> (raw)
Two out-of-bounds reads reachable from a crafted SquashFS image, found
while auditing fs/squashfs for image-controlled values used as buffer
offsets without validation. Both were reported to the list earlier; these
are the fixes.
Patch 1 covers sqfs_frag_lookup(), where the fragment index is checked
only against a superblock field that is itself part of the image, and
every subsequent access derived from it is unchecked against the buffer
that was actually read.
Patch 2 covers sqfs_dir_offset(). Commit 57e0bb7bf00d ("fs/squashfs: add
sqfs_dir_offset() error checks") addressed the negative return value; the
positive range is still unbounded, and the callers use it to index the
directory table.
Neither patch changes behaviour for well-formed images: the rejected
cases all describe inodes that reference data outside the tables the
superblock declares.
checkpatch-clean, builds for sandbox with no new warnings at W=1, and
test_sqfs_ls and test_sqfs_load both pass against images generated by
mksquashfs 4.6.1 (the default plus the three lzo fragment variants).
Review of the exact bounds is welcome, in particular whether patch 2 is
too strict in rejecting a directory header that would start within the
last SQFS_DIR_HEADER_SIZE bytes of the directory table.
Pranav Rajendran (2):
fs/squashfs: bound fragment table accesses in sqfs_frag_lookup()
fs/squashfs: bound the offset returned by sqfs_dir_offset()
fs/squashfs/sqfs.c | 50 ++++++++++++++++++++++++++++++++++++++++--
fs/squashfs/sqfs_dir.c | 42 ++++++++++++++++++++++++++++++-----
2 files changed, 84 insertions(+), 8 deletions(-)
--
2.50.1 (Apple Git-155)
next reply other threads:[~2026-08-15 22:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-15 22:01 Pranav Rajendran [this message]
2026-08-15 22:01 ` [PATCH v1 1/2] fs/squashfs: bound fragment table accesses in sqfs_frag_lookup() Pranav Rajendran
2026-08-15 22:01 ` [PATCH v1 2/2] fs/squashfs: bound the offset returned by sqfs_dir_offset() Pranav Rajendran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260815220115.11335-1-pranavkasthuri@gmail.com \
--to=pranavkasthuri@gmail.com \
--cc=joaomarcos.costa@bootlin.com \
--cc=miquel.raynal@bootlin.com \
--cc=richard.genoud@bootlin.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox