From: Samuel Moelius <sam.moelius@trailofbits.com>
To: kees@kernel.org
Cc: brauner@kernel.org, iwasbaeyz@gmail.com,
linux-kernel@vger.kernel.org, rmk+kernel@armlinux.org.uk,
sam.moelius@trailofbits.com, viro@zeniv.linux.org.uk
Subject: [PATCH v2 0/2] adfs: reject disc records smaller than one filesystem block
Date: Sun, 28 Jun 2026 22:01:24 +0000 [thread overview]
Message-ID: <20260628220126.94212-1-sam.moelius@trailofbits.com> (raw)
In-Reply-To: <202606101323.0DFB06B054@keescook>
Hi,
This v2 splits the ADFS fix and the requested selftest into separate
patches.
Patch 1 rejects ADFS disc records whose declared disc size is smaller
than one filesystem block. Such an image can otherwise mount and later
hit a divide-by-zero in statfs because f_blocks is zero.
Patch 2 adds a filesystems/adfs selftest that generates two minimal ADFS
images: a valid image with a one-block disc size, and an otherwise
identical invalid image whose disc size is smaller than one filesystem
block. The test verifies that the valid image mounts and statfs succeeds,
and that the invalid image is rejected at mount time.
Changes since v1:
- Split the selftest into a separate patch.
- Added a tools/testing/selftests/filesystems/adfs test target.
- Added generated-good-image and generated-bad-image mount validation.
Thanks,
Sam
Samuel Moelius (2):
adfs: reject disc records smaller than one filesystem block
selftests: filesystems: add ADFS mount validation test
fs/adfs/super.c | 4 +
tools/testing/selftests/Makefile | 1 +
.../selftests/filesystems/adfs/Makefile | 5 +
.../filesystems/adfs/adfs_mount_check.sh | 113 ++++++++++++++++++
.../testing/selftests/filesystems/adfs/config | 2 +
5 files changed, 125 insertions(+)
create mode 100644 tools/testing/selftests/filesystems/adfs/Makefile
create mode 100755 tools/testing/selftests/filesystems/adfs/adfs_mount_check.sh
create mode 100644 tools/testing/selftests/filesystems/adfs/config
--
2.43.0
next prev parent reply other threads:[~2026-06-28 22:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-05 18:37 [PATCH] adfs: reject disc records smaller than one filesystem block Samuel Moelius
2026-06-10 20:24 ` Kees Cook
2026-06-28 22:01 ` Samuel Moelius [this message]
2026-06-28 22:01 ` [PATCH v2 1/2] " Samuel Moelius
2026-06-28 23:16 ` Russell King
2026-06-28 22:01 ` [PATCH v2 2/2] selftests: filesystems: add ADFS mount validation test Samuel Moelius
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=20260628220126.94212-1-sam.moelius@trailofbits.com \
--to=sam.moelius@trailofbits.com \
--cc=brauner@kernel.org \
--cc=iwasbaeyz@gmail.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk+kernel@armlinux.org.uk \
--cc=viro@zeniv.linux.org.uk \
/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