From: Michael Schmitz <schmitzmic@gmail.com>
To: Christian Zigotzky <chzigotzky@xenosoft.de>, linux-block@vger.kernel.org
Cc: axboe@kernel.dk, linux-m68k@vger.kernel.org,
geert@linux-m68k.org, hch@lst.de, martin@lichtvoll.de,
stable@vger.kernel.org, "R.T.Dickinson" <rtd2@xtra.co.nz>,
Darren Stevens <darren@stevens-zone.net>,
mad skateman <madskateman@gmail.com>,
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
Christian Zigotzky <info@xenosoft.de>
Subject: Re: [PATCH] block: bugfix for Amiga partition overflow check patch
Date: Sun, 2 Jul 2023 14:17:23 +1200 [thread overview]
Message-ID: <afe14b08-7bab-d81b-fce6-e6408741760a@gmail.com> (raw)
In-Reply-To: <b9600d91-6a25-746e-0769-4d0e31038da5@xenosoft.de>
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
next prev parent reply other threads:[~2023-07-02 2:17 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-01 2:35 [PATCH] block: bugfix for Amiga partition overflow check patch Michael Schmitz
2023-07-01 6:40 ` Christian Zigotzky
2023-07-01 8:11 ` Michael Schmitz
2023-07-01 9:48 ` Christian Zigotzky
2023-07-02 2:17 ` Michael Schmitz [this message]
2023-07-02 3:45 ` Michael Schmitz
2023-07-02 4:37 ` Christian Zigotzky
2023-07-02 7:55 ` Martin Steigerwald
2023-07-02 8:56 ` Christian Zigotzky
2023-07-02 9:34 ` Christian Zigotzky
2023-07-02 9:51 ` John Paul Adrian Glaubitz
2023-07-02 10:34 ` Martin Steigerwald
2023-07-03 1:57 ` Michael Schmitz
2023-07-02 20:22 ` Michael Schmitz
2023-07-03 7:05 ` Martin Steigerwald
2023-07-03 14:19 ` Christian Zigotzky
2023-07-03 14:59 ` Christian Zigotzky
2023-07-03 21:24 ` Michael Schmitz
2023-07-03 21:27 ` Jens Axboe
2023-07-03 22:43 ` Michael Schmitz
2023-07-04 5:06 ` John Paul Adrian Glaubitz
2023-07-04 5:44 ` Michael Schmitz
2023-07-04 5:48 ` John Paul Adrian Glaubitz
2023-07-04 5:58 ` Michael Schmitz
2023-07-04 7:28 ` Martin Steigerwald
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=afe14b08-7bab-d81b-fce6-e6408741760a@gmail.com \
--to=schmitzmic@gmail.com \
--cc=axboe@kernel.dk \
--cc=chzigotzky@xenosoft.de \
--cc=darren@stevens-zone.net \
--cc=geert@linux-m68k.org \
--cc=glaubitz@physik.fu-berlin.de \
--cc=hch@lst.de \
--cc=info@xenosoft.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-m68k@vger.kernel.org \
--cc=madskateman@gmail.com \
--cc=martin@lichtvoll.de \
--cc=rtd2@xtra.co.nz \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox