[PATCH v4] erofs-utils: lib: fix 48bit addressing detection for chunk-based format
Gao Xiang
hsiangkao at linux.alibaba.com
Wed Feb 25 19:19:46 AEDT 2026
On 2026/2/25 15:39, puneeth_aditya_5656 wrote:
> The 48-bit chunk format flag was being set inside
> erofs_blob_write_chunked_file right after erofs_blob_getchunk returns.
> At that point chunk->blkaddr is the chunk's offset in the temporary
> blob buffer, not the final image address. The real address is only
> known after erofs_mkfs_dump_blobs applies remapped_base, so a chunk
> that lands above UINT32_MAX after remapping may not get flagged at all,
> producing a corrupt image.
>
> Fix this by introducing erofs_inode_fixup_chunkformat() which walks
> the chunk array after remapped_base is finalized and sets the 48-bit
> flag if any chunk address exceeds UINT32_MAX. The fixup is called from
> erofs_iflush so that the correct chunkformat is written into the
> on-disk inode header. Both blob chunks (remapped_base + chunk->blkaddr)
> and device chunks (chunk->blkaddr directly) are handled.
>
> Signed-off-by: Puneeth Aditya <myakampuneeth at gmail.com>
LGTM, will apply, although I still wonder how to add a reasonable
testcase since it needs to generate a huge image.)
Thanks,
Gao Xiang
More information about the Linux-erofs
mailing list