* Re: [PATCH 7.2.y] ext4: don't enable large folios on encrypted inodes
2026-09-25 15:31 [PATCH 7.2.y] ext4: don't enable large folios on encrypted inodes Alberto Garcia
@ 2026-09-25 15:47 ` sashiko-bot
2026-09-25 20:08 ` Eric Biggers
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-09-25 15:47 UTC (permalink / raw)
To: Alberto Garcia; +Cc: tytso, linux-ext4
> Commit 709f0f1f1bf5 ("ext4: add checks for large folio
> incompatibilities when BS > PS") disables large folios at mount time
> if the "encrypt" feature is set. However, enabling that feature on a
> mounted filesystem circumvents that check, and writing encrypted data
> results in a crash:
>
> BUG: kernel NULL pointer dereference, address: 0000000000000028
> Workqueue: ext4-rsv-conversion ext4_end_io_rsv_work
> RIP: 0010:ext4_finish_bio+0xf7/0x3e0
> Call Trace:
> ext4_release_io_end+0x51/0x110
> ext4_end_io_end+0x4c/0xe0
> ext4_end_io_rsv_work+0xb3/0x100
>
> Fix this by disabling large folios on encrypted inodes, as is
> already done for inodes that use data journaling.
>
> This affects all kernels between v6.19 and v7.2, but it is not needed
> in v7.3, where the code was significantly refactored.
>
> Fixes: 709f0f1f1bf5 ("ext4: add checks for large folio incompatibilities when BS > PS")
> Signed-off-by: Alberto Garcia <berto@igalia.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260925153127.1472301-1-berto@igalia.com?part=1
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 7.2.y] ext4: don't enable large folios on encrypted inodes
2026-09-25 15:31 [PATCH 7.2.y] ext4: don't enable large folios on encrypted inodes Alberto Garcia
2026-09-25 15:47 ` sashiko-bot
@ 2026-09-25 20:08 ` Eric Biggers
2026-09-26 15:26 ` Sasha Levin
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Eric Biggers @ 2026-09-25 20:08 UTC (permalink / raw)
To: Alberto Garcia
Cc: stable, Theodore Ts'o, Andreas Dilger, Baokun Li, Jan Kara,
Ojaswin Mujoo, Ritesh Harjani, Zhang Yi, linux-ext4,
linux-fscrypt, regressions
On Fri, Sep 25, 2026 at 05:31:25PM +0200, Alberto Garcia wrote:
> Commit 709f0f1f1bf5 ("ext4: add checks for large folio
> incompatibilities when BS > PS") disables large folios at mount time
> if the "encrypt" feature is set. However, enabling that feature on a
> mounted filesystem circumvents that check, and writing encrypted data
> results in a crash:
>
> BUG: kernel NULL pointer dereference, address: 0000000000000028
> Workqueue: ext4-rsv-conversion ext4_end_io_rsv_work
> RIP: 0010:ext4_finish_bio+0xf7/0x3e0
> Call Trace:
> ext4_release_io_end+0x51/0x110
> ext4_end_io_end+0x4c/0xe0
> ext4_end_io_rsv_work+0xb3/0x100
>
> Fix this by disabling large folios on encrypted inodes, as is
> already done for inodes that use data journaling.
>
> This affects all kernels between v6.19 and v7.2, but it is not needed
> in v7.3, where the code was significantly refactored.
>
> Fixes: 709f0f1f1bf5 ("ext4: add checks for large folio incompatibilities when BS > PS")
> Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
- Eric
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 7.2.y] ext4: don't enable large folios on encrypted inodes
2026-09-25 15:31 [PATCH 7.2.y] ext4: don't enable large folios on encrypted inodes Alberto Garcia
2026-09-25 15:47 ` sashiko-bot
2026-09-25 20:08 ` Eric Biggers
@ 2026-09-26 15:26 ` Sasha Levin
2026-10-02 21:10 ` Sasha Levin
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2026-09-26 15:26 UTC (permalink / raw)
To: stable
Cc: Sasha Levin, Alberto Garcia, Theodore Ts'o, Andreas Dilger,
Baokun Li, Jan Kara, Ojaswin Mujoo, Ritesh Harjani, Zhang Yi,
Eric Biggers, linux-ext4, linux-fscrypt, regressions
> This patch has no upstream equivalent: in v7.3 the code was
> significantly refactored and the problem no longer happens, see commit
> b4e409c18c79 ("ext4: Remove fs-layer file contents en/decryption
> code").
Since this is a stable-only change, I'd like an ack from the ext4 side
before queuing it. Eric's Reviewed-by is already in.
Ted, could you ack this for 7.2.y? I'll queue it once you do.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 7.2.y] ext4: don't enable large folios on encrypted inodes
2026-09-25 15:31 [PATCH 7.2.y] ext4: don't enable large folios on encrypted inodes Alberto Garcia
` (2 preceding siblings ...)
2026-09-26 15:26 ` Sasha Levin
@ 2026-10-02 21:10 ` Sasha Levin
2026-10-03 15:07 ` Baokun Li
2026-10-04 16:29 ` Sasha Levin
5 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2026-10-02 21:10 UTC (permalink / raw)
To: stable
Cc: Sasha Levin, Alberto Garcia, Theodore Ts'o, Andreas Dilger,
Baokun Li, Jan Kara, Ojaswin Mujoo, Ritesh Harjani, Zhang Yi,
Eric Biggers, linux-ext4, linux-fscrypt, regressions
> This affects all kernels between v6.19 and v7.2 but only the latter is
> still maintained, so I think that it only needs to be applied there.
Ted, Jan, Baokun: could one of you ack this for 7.2.y? Eric has already
reviewed it. If there's no objection from the ext4 side by October 9,
I'll queue it on Eric's Reviewed-by.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 7.2.y] ext4: don't enable large folios on encrypted inodes
2026-09-25 15:31 [PATCH 7.2.y] ext4: don't enable large folios on encrypted inodes Alberto Garcia
` (3 preceding siblings ...)
2026-10-02 21:10 ` Sasha Levin
@ 2026-10-03 15:07 ` Baokun Li
2026-10-04 16:29 ` Sasha Levin
5 siblings, 0 replies; 7+ messages in thread
From: Baokun Li @ 2026-10-03 15:07 UTC (permalink / raw)
To: Alberto Garcia, stable
Cc: Theodore Ts'o, Andreas Dilger, Jan Kara, Ojaswin Mujoo,
Ritesh Harjani, Zhang Yi, Eric Biggers, linux-ext4, linux-fscrypt,
regressions
On 2026/9/25 23:31, Alberto Garcia wrote:
> Commit 709f0f1f1bf5 ("ext4: add checks for large folio
> incompatibilities when BS > PS") disables large folios at mount time
> if the "encrypt" feature is set. However, enabling that feature on a
> mounted filesystem circumvents that check, and writing encrypted data
> results in a crash:
>
> BUG: kernel NULL pointer dereference, address: 0000000000000028
> Workqueue: ext4-rsv-conversion ext4_end_io_rsv_work
> RIP: 0010:ext4_finish_bio+0xf7/0x3e0
> Call Trace:
> ext4_release_io_end+0x51/0x110
> ext4_end_io_end+0x4c/0xe0
> ext4_end_io_rsv_work+0xb3/0x100
>
> Fix this by disabling large folios on encrypted inodes, as is
> already done for inodes that use data journaling.
>
> This affects all kernels between v6.19 and v7.2, but it is not needed
> in v7.3, where the code was significantly refactored.
>
> Fixes: 709f0f1f1bf5 ("ext4: add checks for large folio incompatibilities when BS > PS")
> Signed-off-by: Alberto Garcia <berto@igalia.com>
Looks good, thanks for the fix.
Reviewed-by: Baokun Li <libaokun@linux.alibaba.com>
> ---
> This affects all kernels between v6.19 and v7.2 but only the latter is
> still maintained, so I think that it only needs to be applied there.
>
> This patch has no upstream equivalent: in v7.3 the code was
> significantly refactored and the problem no longer happens, see commit
> b4e409c18c79 ("ext4: Remove fs-layer file contents en/decryption
> code").
>
> To reproduce the bug:
>
> # mkfs.ext4 /dev/vdb
> # mount /dev/vdb /mnt/
> # tune2fs -O encrypt /dev/vdb
> # mkdir /mnt/foo
> # fscrypt setup /mnt
> # fscrypt encrypt /mnt/foo/
> # head -c 20M /dev/urandom > /mnt/foo/data
> # sync
> BUG: kernel NULL pointer dereference, address: 0000000000000028
> Workqueue: ext4-rsv-conversion ext4_end_io_rsv_work
> [...]
>
> fs/ext4/inode.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index a33629b397b0..32f79f48a9dd 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -5287,7 +5287,8 @@ void ext4_set_inode_mapping_order(struct inode *inode)
> if (!min_order && !S_ISREG(inode->i_mode))
> return;
>
> - if (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA))
> + if (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA) ||
> + ext4_test_inode_flag(inode, EXT4_INODE_ENCRYPT))
> max_order = min_order;
>
> mapping_set_folio_order_range(inode->i_mapping, min_order, max_order);
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 7.2.y] ext4: don't enable large folios on encrypted inodes
2026-09-25 15:31 [PATCH 7.2.y] ext4: don't enable large folios on encrypted inodes Alberto Garcia
` (4 preceding siblings ...)
2026-10-03 15:07 ` Baokun Li
@ 2026-10-04 16:29 ` Sasha Levin
5 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2026-10-04 16:29 UTC (permalink / raw)
To: stable
Cc: Sasha Levin, Alberto Garcia, Theodore Ts'o, Andreas Dilger,
Baokun Li, Jan Kara, Ojaswin Mujoo, Ritesh Harjani, Zhang Yi,
Eric Biggers, linux-ext4, linux-fscrypt, regressions
> Fix this by disabling large folios on encrypted inodes, as is
> already done for inodes that use data journaling.
Queued for 7.2, thanks.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 7+ messages in thread