From: Phillip Lougher <phillip@squashfs.org.uk>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Christian Loehle <christian.loehle@arm.com>
Subject: Re: [PATCH v2 17/22] Squashfs: don't store large export table indexes in memory
Date: Mon, 23 Nov 2026 03:24:02 +0000 [thread overview]
Message-ID: <20261123032402.2ef0f237cbc3fd677b048a11@squashfs.org.uk> (raw)
In-Reply-To: <20261112110927.6add17b0552922c5b6b93515@linux-foundation.org>
On Thu, 12 Nov 2026 11:09:27 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Wed, 11 Nov 2026 23:43:57 +0000 Phillip Lougher <phillip@squashfs.org.uk> wrote:
>
> > When mounting a Squashfs filesystem, the code reads the entire
> > export table indexes into memory. Their size is determined by the
> > number of inodes in the filesystem. For the maximum inode
> > count of 2^32, this will allocate and read 32 MiB.
> >
> > This is an excessive and unnecessary amount of memory because the
> > indexes do not need to be read into memory in their entirety. In
> > addition kmalloc() is used to allocate memory, and this can fail when
> > large amounts of memory are requested. Kmalloc() on modern kernels is
> > usually limited to 4096 KiB. If panic-on-warn is set, then failure to
> > allocate memory will result in a kernel panic.
> >
> > This commit uses a 4 page cache if the size of the export table indexes
> > are 4 pages in size or larger. A simple and fast lookup array is
> > retained where the total index size is less than 4 pages in size, which
> > is the vast majority of Squashfs filesystems.
>
> Thanks. This patch didn't anticipate the presence of Christian's
> "squashfs: identify device in mount errors". To make life easier I've
> staged Christian's patch behind this 22-patch series.
>
> This required a bit of rework of Christian's patch. While in there I
> filled in a few more places which needed Christian's treatment and I
> made the whole thing more 80-column friendly where that made sense.
>
> Please check:
Thanks. It looks good to me.
Phillip
next prev parent reply other threads:[~2026-11-23 3:24 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 23:43 [PATCH v2 00/22] Squashfs: fix a lot of AI issues and AI style issues Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 01/22] Squashfs: convert SQUASHFS_COMPRESSED_* to inline functions Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 02/22] Squashfs: convert SQUASHFS_INODE_* and SQUASHFS_MKINODE " Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 03/22] Squashfs: convert SQUASHFS_FRAGMENT_* " Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 04/22] Squashfs: convert SQUASHFS_LOOKUP_* " Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 05/22] Squashfs: convert SQUASHFS_ID_* " Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 06/22] Squashfs: convert SQUASHFS_XATTR_* " Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 07/22] Squashfs: fix offset in squashfs_read_inode() TRACE statements Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 08/22] Squashfs: fix fragment bytes overflow on 32-bit architectures Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 09/22] Squashfs: fix fragment index table length too large exploit Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 10/22] Squashfs: sanity check inode metadata block location Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 11/22] Squashfs: sanity check directory " Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 12/22] Squashfs: widen xattr count variables and add sanity check Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 13/22] Squashfs: very large files can exceed an int block count Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 14/22] Squashfs: add more sanity checking to squashfs_block_size() Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 15/22] Squashfs: sanity check fragment block location and range Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 16/22] Squashfs: sanity check block list sizes " Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 17/22] Squashfs: don't store large export table indexes in memory Phillip Lougher
2026-11-12 19:09 ` Andrew Morton
2026-11-23 3:24 ` Phillip Lougher [this message]
2026-11-11 23:43 ` [PATCH v2 18/22] Squashfs: don't store large fragment " Phillip Lougher
2026-11-11 23:43 ` [PATCH v2 19/22] Squashfs: don't store large xattr id " Phillip Lougher
2026-11-11 23:44 ` [PATCH v2 20/22] Squashfs: fix variables in directory code and add more sanity checks Phillip Lougher
2026-11-11 23:44 ` [PATCH v2 21/22] Squashfs: fix regression in squashfs_copy_cache() Phillip Lougher
2026-11-11 23:44 ` [PATCH v2 22/22] Squashfs: check index isn't greater than S64_MAX in squashfs_read_data() Phillip Lougher
2026-11-16 6:49 ` [syzbot ci] Re: Squashfs: fix a lot of AI issues and AI style issues syzbot ci
2026-11-16 7:28 ` Andrew Morton
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=20261123032402.2ef0f237cbc3fd677b048a11@squashfs.org.uk \
--to=phillip@squashfs.org.uk \
--cc=akpm@linux-foundation.org \
--cc=christian.loehle@arm.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®