grub-devel
[Top][All Lists]
Advanced

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

Re: grub-probe fails to find PC partition due to Apple disklabel


From: Pavel Roskin
Subject: Re: grub-probe fails to find PC partition due to Apple disklabel
Date: Tue, 15 Apr 2008 11:17:07 -0400

On Tue, 2008-04-15 at 15:15 +0200, Robert Millan wrote:

> > partmap/apple.c starts reading with the second sector (unsigned pos =
> > GRUB_DISK_SECTOR_SIZE).  Perhaps it should read the first sector to
> > check the magic.
> 
> Are you sure checking for the code part would be a good idea?  One could be
> using i8088 bootstrap code in an Apple first sector, or vice-versa.

Apple partition table requires the magic in the first two bytes of the
first sector, followed by the sector size.  Even if those instructions
are survivable by x86 processors, executing data is a very bad hack.

> Btw, how does Linux handle this?  Maybe this issue has been beaten to death
> already.

fs/partitions/mac.c checks the magic in the first sector in
mac_partition()

fs/partitions/msdos.c doesn't check for the Apple magic, but it makes
some other sanity checks.  It rejects the partition table if any boot
flags is not 0x00 or 0x80.  It also refuses to accept the table if there
is an EFI GPT partition.

To fix the issue at hand (PC partition mistaken as Apple), all we need
is to check the Apple magic in the Apple partition code.

-- 
Regards,
Pavel Roskin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]