Skip to contentSkip to conversation

BUG: fdisk, gpt broken on 32bit big endian systems

DISCUSSION Ruediger Meier 2 participants 4 messages May 30, 2014 Util-Linux package

lore
Share & tools
lore
#0 lore raw

Hi,

This ...

$ rm -f xxx; truncate -s 10M xxx
$ echo -ne "g\nx\ni\n26841E90-46E0-4205-B012-4B8AEC35C088\nr\nw\nq\n" | fdisk xxx

... creates a broken gpt image on 32bit big endian systems.

"hexdiff" xxx-broken xxx-good:
00000260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| *

 009ffe00  45 46 49 20 50 41 52 54  00 00 01 00 00 02 00 00  |EFI PART........|
-009ffe10  68 a5 49 d1 00 00 00 00  ff ff ff ff ff ff ff ff  |h.I.............|
+009ffe10  15 b9 f3 7e 00 00 00 00  ff 4f 00 00 00 00 00 00  |...~.....O......|
 009ffe20  01 00 00 00 00 00 00 00  00 08 00 00 00 00 00 00  |................|
 009ffe30  de 4f 00 00 00 00 00 00  90 1e 84 26 e0 46 05 42  |.O.........&.F.B|
 009ffe40  b0 12 4b 8a ec 35 c0 88  df 4f 00 00 00 00 00 00  |..K..5...O......|

Looks like the backup header is broken.

Notes:
- I only used fixed uuid to have better diff.
- 64bit big endian systems are not broken

cu,
Rudi

maintainer
#1 lore raw
Quoted 7 lines · Ruediger Meier

Hi,

This ...

$ rm -f xxx; truncate -s 10M xxx
$ echo -ne "g\nx\ni\n26841E90-46E0-4205-B012-4B8AEC35C088\nr\nw\nq\n" | fdisk xxx
Quoted 8 lines

... creates a broken gpt image on 32bit big endian systems.

"hexdiff" xxx-broken xxx-good:
00000260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| *

 009ffe00  45 46 49 20 50 41 52 54  00 00 01 00 00 02 00 00  |EFI PART........|
-009ffe10  68 a5 49 d1 00 00 00 00  ff ff ff ff ff ff ff ff  |h.I.............|
+009ffe10  15 b9 f3 7e 00 00 00 00  ff 4f 00 00 00 00 00 00  |...~.....O......|

^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^
crc32 reserved header LBA

The problem is the LBA, "ff ff ff ff ff ff ff ff" seems strange :-)

(Correct is ff4f, (means 0x4fff * 512 + 512 = 10485760, 10MiB).

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
maintainer
#2 lore raw
In reply to Ruediger Meier
Quoted 8 lines · Ruediger Meier
$ rm -f xxx; truncate -s 10M xxx
$ echo -ne "g\nx\ni\n26841E90-46E0-4205-B012-4B8AEC35C088\nr\nw\nq\n" | fdisk xxx

... creates a broken gpt image on 32bit big endian systems.

"hexdiff" xxx-broken xxx-good:
00000260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| *

Quoted 6 lines
 009ffe00  45 46 49 20 50 41 52 54  00 00 01 00 00 02 00 00  |EFI PART........|
-009ffe10  68 a5 49 d1 00 00 00 00  ff ff ff ff ff ff ff ff  |h.I.............|
+009ffe10  15 b9 f3 7e 00 00 00 00  ff 4f 00 00 00 00 00 00  |...~.....O......|
 009ffe20  01 00 00 00 00 00 00 00  00 08 00 00 00 00 00 00  |................|
 009ffe30  de 4f 00 00 00 00 00 00  90 1e 84 26 e0 46 05 42  |.O.........&.F.B|
 009ffe40  b0 12 4b 8a ec 35 c0 88  df 4f 00 00 00 00 00 00  |..K..5...O......|

Fixed now, I hope (not tested on 32bit BE, but the code was so stupid that it has to be the problem :-)

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#3 lore raw
Quoted 20 lines · Karel Zak
Quoted 9 lines · Ruediger Meier
$ rm -f xxx; truncate -s 10M xxx
$ echo -ne
"g\nx\ni\n26841E90-46E0-4205-B012-4B8AEC35C088\nr\nw\nq\n" | fdisk
xxx

... creates a broken gpt image on 32bit big endian systems.

"hexdiff" xxx-broken xxx-good:
00000260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Quoted 9 lines
|................| *
 009ffe00  45 46 49 20 50 41 52 54  00 00 01 00 00 02 00 00  |EFI
PART........| -009ffe10  68 a5 49 d1 00 00 00 00  ff ff ff ff ff ff
ff ff  |h.I.............| +009ffe10  15 b9 f3 7e 00 00 00 00  ff 4f
00 00 00 00 00 00  |...~.....O......| 009ffe20  01 00 00 00 00 00
00 00  00 08 00 00 00 00 00 00  |................| 009ffe30  de 4f
00 00 00 00 00 00  90 1e 84 26 e0 46 05 42  |.O.........&.F.B|
009ffe40  b0 12 4b 8a ec 35 c0 88  df 4f 00 00 00 00 00 00 
|..K..5...O......|
Quoted 2 lines

Fixed now, I hope (not tested on 32bit BE, but the code was so stupid that it has to be the problem :-)

Thanks! This works.

cu,
Rudi