⬢ DragonFlyBSD Kernel Audit
DF-3159 / run_guest.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-3159: ftruncate past MSDOSFS_FILESIZE_MAX on 64-KiB-cluster FAT32.
# msdosfs_setattr -> detrunc -> deextend accepts va_size > 0xFFFFFFFF;
# DE_EXTERNALIZE putulong()s the dirent size field -> silent shrink.
echo "===== DF-3159: ftruncate to 0x100010000 (4 GiB + 64 KiB)"
vnconfig -c -S 4831838208 /dev/vn0 /root/w/fat32big.img
mkdir -p /mnt/df3159
mount_msdos /dev/vn0 /mnt/df3159 || { echo MOUNT-FAIL; vnconfig -u vn0; exit 1; }
mount | grep df3159
/root/w/DF-3159/trunc /mnt/df3159/BIG 0x100010000
sync
echo "--- stat BEFORE unmount:"
stat -f "size=%z" /mnt/df3159/BIG
umount /mnt/df3159
echo "--- remount and stat again (dirent field is 32-bit):"
mount_msdos /dev/vn0 /mnt/df3159
stat -f "size=%z" /mnt/df3159/BIG
ls -l /mnt/df3159/BIG
umount /mnt/df3159
vnconfig -u vn0
echo "DONE-DF3159"