[PATCH] udf: reject VAT extents on virtual partitions
From: Kyuwon Cho
Date: Thu Dec 03 2026 - 11:39:45 EST
A VAT inode is addressed through a physical partition. Its recorded data
extents can still name a virtual partition, however. Translating such an
extent reads the VAT itself and recursively re-enters udf_map_block() until
the kernel stack overflows.
Reject virtual-partition extents while mapping the VAT inode.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Kyuwon Cho <kyuwon.cho@xxxxxxxx>
---
The issue was found by an LLM-guided test generator that we are
developing as a research prototype.
The reproducers create and mount crafted UDF images whose VAT inode has
a recorded extent on its own virtual partition. Mounting either image
requires root in the initial namespace. Both the UDF 1.50 and UDF 2.00
translation paths recurse until the kernel stack is exhausted.
The decoded UDF 1.50 trace is:
BUG: TASK stack guard page was hit at ffa0000000e87f68
RIP: udf_map_block (fs/udf/inode.c:349)
Call Trace:
udf_bread (fs/udf/inode.c:1252)
udf_get_pblock_virt15 (fs/udf/partition.c:79)
udf_map_block (fs/udf/inode.c:370)
udf_bread (fs/udf/inode.c:1252)
udf_get_pblock_virt15 (fs/udf/partition.c:79)
udf_map_block (fs/udf/inode.c:370)
udf_read_ptagged (fs/udf/misc.c:256)
udf_fill_super (fs/udf/super.c:2392)
get_tree_bdev_flags (fs/super.c:1821)
The patch was tested on v7.4-rc5 and rebased onto linux-fs commit
ffe1e23e5036 ("Pull udf partition freeing fix.").
fs/udf/inode.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 8f1f7c3da725..c3a54f32847c 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -369,6 +369,21 @@ static int udf_map_block(struct inode *inode, struct udf_map_rq *map)
if (ret < 0)
goto out_read;
if (ret > 0 && etype == (EXT_RECORDED_ALLOCATED >> 30)) {
+ struct udf_sb_info *sbi = UDF_SB(inode->i_sb);
+ u16 partition = eloc.partitionReferenceNum;
+
+ if (inode == sbi->s_vat_inode &&
+ partition < sbi->s_partitions &&
+ (sbi->s_partmaps[partition].s_partition_type ==
+ UDF_VIRTUAL_MAP15 ||
+ sbi->s_partmaps[partition].s_partition_type ==
+ UDF_VIRTUAL_MAP20)) {
+ udf_err(inode->i_sb,
+ "VAT data extent uses virtual partition %u\n",
+ partition);
+ ret = -EFSCORRUPTED;
+ goto out_read;
+ }
map->pblk = udf_get_lb_pblock(inode->i_sb, &eloc,
offset);
map->oflags |= UDF_BLK_MAPPED;
--
2.43.0