On Thu, Dec 23, 2021 at 07:28:19PM -0300, Crystal Kolipe wrote:
> On Thu, Dec 23, 2021 at 04:15:50PM -0500, Rob Whitlock wrote:
> > On Thu, Dec 23, 2021 at 3:24 PM Crystal Kolipe <[email protected]>
> > wrote:
> > 
> > > Again, there is nothing there that would stop it working.
> > >
> > > You have an MBR partition of type EE starting on sector 1, which is what 
> > > is
> > > checked for in gpt_chk_mbr, so unless I'm overlooking something it's
> > > probably chocking in gpt_chk_hdr due to something unexpected in the GPT
> > > header,
> > > (LBA block 1).
> > >
> > 
> > Here is LBA block 1:
> 
> OK, I now know why it's not working :-).
> 
> Either:
> 
> * Upgrade to OpenBSD 7.0
> 
> or
> 
> * Change line 610 of /usr/src/kern/subr_disk.c as it changed between
> version 1.241 and version 1.242:
> 
> https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/kern/subr_disk.c.diff?r1=1.241&r2=1.242&f=h
> 
> ... and recompile the kernel.
> 
> Either way, the spoofed disklabel will then include your non-OpenBSD 
> partitions.
> 
> And in future, please test the latest version of the code before reporting a 
> bug ;-).

Hang on, that's only part of the problem, there is something else wrong too...

I was testing with a slightly different GPT header, (block 1), when I observed
the issue I described above.  The fix I gave does indeed work for the GPT
header that I was using for testing.

However, I just tested it with your exact GPT header block, and it still fails
to see the non-OpenBSD partitions.

But looking at the two, the only fields that are different are the four bytes
at offset 0x10, which are a CRC, the 16 bytes at offset 0x38, which are the
disk GUID, and the four bytes at offset 0x58, which are another CRC.

I won't have time to look in to this further for the next couple of days,
which is why I'm posting this in case somebody else wants to step up and
resolve it.

--- works.hex   Thu Dec 23 20:02:08 2021
+++ doesnt.hex  Thu Dec 23 20:02:02 2021
@@ -6,11 +6,11 @@
 *
 000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
 00000200  45 46 49 20 50 41 52 54  00 00 01 00 5c 00 00 00  |EFI PART....\...|
-00000210  c2 7d c2 16 00 00 00 00  01 00 00 00 00 00 00 00  |.}..............|
+00000210  34 b3 c1 18 00 00 00 00  01 00 00 00 00 00 00 00  |4...............|
 00000220  ae d9 30 46 02 00 00 00  22 00 00 00 00 00 00 00  |..0F....".......|
-00000230  8d d9 30 46 02 00 00 00  07 8f ed 99 ec 89 df 45  |..0F...........E|
-00000240  a5 38 96 c6 05 d7 c5 e9  02 00 00 00 00 00 00 00  |.8..............|
-00000250  80 00 00 00 80 00 00 00  52 9e e8 0b 00 00 00 00  |........R.......|
+00000230  8d d9 30 46 02 00 00 00  69 b0 0a 57 69 18 ed 44  |..0F....i..Wi..D|
+00000240  91 1b a5 68 af 12 75 ff  02 00 00 00 00 00 00 00  |...h..u.........|
+00000250  80 00 00 00 80 00 00 00  6c 88 7a 3f 00 00 00 00  |........l.z?....|
 00000260  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 *
 00000400  28 73 2a c1 1f f8 d2 11  ba 4b 00 a0 c9 3e c9 3b  |(s*......K...>.;|

Reply via email to