mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Initially cryptsetup expected underlying device that was, by definition, always aligned to a sector size (and length was always multiple of sectors). For the images in file, we can now access the image directly. Expecting that the image is always aligned to the whole block is now false (the last block in file image can be incomplete). Moreover, we cannot easily detect underlying block device sector (block) size (the storage stack can be complex with various RAID and loop block sizes), so code uses systyem PAGE_SIZE in this situation (should be the safest way). Unfortunately, PAGE_SIZE can be bigger (1MB) than device sector (4k) and the blockwise functions then fails because the image in file is not aligned to PAGE_SIZE multiple.. Fix it by checking that read/write for the last part of an image is the exact requested size and not a full block. (The problem is for example for an unaligned hidden Truecrypt header on PPC64LE systems, where page size is 64k.)
7.4 KiB
7.4 KiB