Re: [PATCH] block: bugfix for Amiga partition overflow check patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Christian,

Am 01.07.2023 um 21:48 schrieb Christian Zigotzky:
Can you please send a copy of the RDB (first few kB of the disk,
something like dd if=/dev/sda of=rdb-sda.img bs=512 count=16 should
do), and the output of cat /proc/partitions when running a kernel from
before my RDB patches?


Copy of the RDB: https://www.xenosoft.de/rdb-sda.img

Thanks, casual inspection of this RDB does show that indeed a value of -1 is used as pb_next in partition slot 4 (and 5).

The disk geometry is defined as 3 heads, 16 sectors per track (48 sectors per cylinder) and 81396441 cylinders which matches your 2 TB disk size.

The first partition begins at cylinder 43 and ends at cylinder 5004, matching the 119088 k (k == 1024 bytes) below.

Partition 2 begins at cylinder 5005, ends at 92508, size 2100096 again as below.

Partition 3 begins at cylinder 92509, ends at 28120463, size 672670920 as below.

Partition 4 begins at cylinder 28120464, ends at 81068868, size 1270041720, different from the size shown in your /proc/partitions log.

The disk ends at cylinder 81396440, so a partition 4 extending to the end of the disk would have size 1278623448, which is what your log shows.


cat /proc/partitions:

major minor  #blocks  name

   8        0 1953514584 sda
   8        1     119088 sda1
   8        2    2100096 sda2
   8        3  672670920 sda3
   8        4 1278623448 sda4

I have (disk image on sdb, patches applied):
     8       20 1270761720 sdb4

which matches what I calculated by hand above.

With an old kernel that does not have the RDB fixes, I get the same partition size as you report. That size is the result of truncation to EOD (the miscalculated size of 18446744071956107760 exceeds the device size).

Creating the filesystem on an unpatched kernel will use that incorrect partition size. I'm sorry to say I cannot see a new RDB partition bug her, just the result of undefined behaviour due to overflowing a 32 bit nr_sect size calculation in the old RDB code.


If you cannot shrink the filesystem, you will have to edit the partition table to extend p4 to the end of the disk. Just replace the partition 4 pb->pb_Environment[10] (at offset 0x8a8, current value 0x04d50344) by 0x04da02d8. As far as I can see, there is no adjustment to the partition block checksum required, as the checksummed block of 160 bytes ends just before the location of the partition's low and high cylinder addresses....

I'd best verify that a patched RDB actually works...

Cheers,

	Michael



  11        0    1048575 sr0
   8       32     250880 sdc
   8       33     249856 sdc1
   8       16  234431064 sdb
   8       17  144364512 sdb1
   8       18          1 sdb2
   8       19   18500608 sdb3
   8       20   40717312 sdb4
   8       21   14684160 sdb5
   8       22   16161792 sdb6
   8       48       1440 sdd
   8       49       1439 sdd1




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux