From: Eric Biggers <ebiggers@kernel.org>
To: Alberto Garcia <berto@igalia.com>
Cc: Baokun Li <libaokun@linux.alibaba.com>,
Theodore Ts'o <tytso@mit.edu>,
Andreas Dilger <adilger.kernel@dilger.ca>,
Jan Kara <jack@suse.cz>, Ojaswin Mujoo <ojaswin@linux.ibm.com>,
"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
Zhang Yi <yi.zhang@huawei.com>,
linux-ext4@vger.kernel.org
Subject: Re: [REGRESSION] ext4: oops in ext4_finish_bio() after enabling encryption on a mounted fs
Date: Fri, 25 Sep 2026 12:07:51 -0700 [thread overview]
Message-ID: <20260925190751.GB2060@quark> (raw)
In-Reply-To: <arZVoP0GGSNXYBLC@igalia.com>
On Fri, Sep 25, 2026 at 01:06:08PM +0200, Alberto Garcia wrote:
> On Thu, Sep 24, 2026 at 11:04:38AM -0700, Eric Biggers wrote:
> > * And maybe a check in __ext4_iget() to prevent existing encrypted
> > inodes from being loaded when fs_block_size > PAGE_SIZE. This would
> > be needed for fuzzing robustness, where a fuzzer generates a
> > filesystem that has encrypted files without the encrypt feature flag.
>
> Does the kernel reject encrypted files on a fs without the encrypt
> flag? I'm asking in general, regardless of the block size. Should it?
On a filesystem without the encrypt flag, ext4 rejects creating new
encrypted directories, but it doesn't reject accessing existing
encrypted directories.
It *should* reject accessing existing encrypted directories. I think
the fact that it doesn't is a holdout from the bug that ext4 originally
had where it didn't enforce the encrypt feature flag at all.
ext4 encryption was first supported in Linux v4.1. ext4 incorrectly
allowed creating new encrypted directories on filesystems without the
encrypt feature flag until commit 9a200d075e5 ("ext4: require encryption
feature for EXT4_IOC_SET_ENCRYPTION_POLICY") in Linux v4.9. ext4 also
allowed the FS_IOC_GET_ENCRYPTION_POLICY ioctl on filesystems without
the encrypt feature flag until commit 0642ea2409f3bf ("ext4 crypto: fix
to check feature status before get policy") in Linux v5.4.
Since v5.4 (7 years ago), ext4 has enforced ext4_has_feature_encrypt(sb)
for all encryption ioctls.
I think at this point would be pretty safe for ext4_iget() to reject any
encrypted inodes when the filesystem doesn't have the encrypt flag. The
only caveat is that, technically, if an existing encrypted directory is
using the old policy version (which before v5.4 was the only option), it
can be unlocked and accessed without executing any of the encryption
ioctls. So in theory someone could be depending on that on a filesystem
without the encrypt flag. I think it's unlikely at this point, though.
(Android for example certainly isn't depending on that, since I updated
it to use 'tune2fs -O encrypt' many years ago. Also, its keyctl() based
unlocking code was removed and only the ioctls are used now.)
So I would suggest we just fix this as well.
- Eric
next prev parent reply other threads:[~2026-09-25 19:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 11:12 [REGRESSION] ext4: oops in ext4_finish_bio() after enabling encryption on a mounted fs Alberto Garcia
2026-09-23 11:43 ` sashiko-bot
2026-09-23 12:12 ` Baokun Li
2026-09-23 12:40 ` Alberto Garcia
2026-09-23 13:28 ` Baokun Li
2026-09-23 18:01 ` Eric Biggers
2026-09-24 10:19 ` Baokun Li
2026-09-24 15:15 ` Alberto Garcia
2026-09-24 18:04 ` Eric Biggers
2026-09-25 11:06 ` Alberto Garcia
2026-09-25 19:07 ` Eric Biggers [this message]
2026-09-27 22:12 ` Alberto Garcia
2026-09-29 11:18 ` Jan Kara
2026-09-23 13:29 ` Jan Kara
2026-09-23 13:39 ` Alberto Garcia
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=20260925190751.GB2060@quark \
--to=ebiggers@kernel.org \
--cc=adilger.kernel@dilger.ca \
--cc=berto@igalia.com \
--cc=jack@suse.cz \
--cc=libaokun@linux.alibaba.com \
--cc=linux-ext4@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=tytso@mit.edu \
--cc=yi.zhang@huawei.com \
/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