mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Patrick J. LoPresti" <patl@users.sourceforge.net>
To: Andrew Clausen <clausen@gnu.org>
Cc: Szakacsits Szabolcs <szaka@sienet.hu>,
	Andries Brouwer <Andries.Brouwer@cwi.nl>,
	Steffen Winterfeldt <snwint@suse.de>,
	linux-kernel@vger.kernel.org, Thomas Fehr <fehr@suse.de>,
	bug-parted@gnu.org
Subject: Re: [RFC] Restoring HDIO_GETGEO semantics (was: Re: workaround for BIOS / CHS stuff)
Date: 03 Jul 2004 10:42:28 -0400	[thread overview]
Message-ID: <s5g3c49qiqr.fsf@patl=users.sf.net> (raw)
In-Reply-To: <20040703025457.GC630@gnu.org>

Andrew Clausen <clausen@gnu.org> writes:

> On Fri, Jul 02, 2004 at 02:45:50PM -0400, Patrick J. LoPresti wrote:
>
> > Using EDD to deduce the geometry is the "right" answer.  But this
> > is sufficiently complex and special-purpose that it has no place
> > in the kernel.
> 
> You think it should be in user-space?  I don't think talking to the
> BIOS should ever be in user-space.

The kernel already makes the relevant BIOS calls at startup and
stashes the results away (see arch/i386/boot/edd.S).  The edd.o module
exposes these values to userspace under /sys/firmware/edd.

But again, none of this should be Parted's concern.

> > Why does this stupid idea keep coming up?  Inferring the geometry from
> > the existing partition table is just plain wrong.  It is even more
> > wrong than the old 2.4 behavior, because it is still a guess, just a
> > worse guess.
> 
> Didn't the old 2.4 behaviour include BIOS queries?

Or it parsed the CMOS tables directly; I am not sure.  It was a
"guess" in the sense that mapping from BIOS devices to Linux devices
is tricky.

But I still maintain it was a better guess than the current suggestion
of relying on the existing partition table.

> In any case, I don't have any evidence that anything is wrong.  On
> my computer, I can tell the BIOS to use CHS geometry, (as opposed to
> "Auto", "LBA" or "Large") modify the partition table to set the CHS
> start/end of the Windows partition to 0, 1024, or anything I like,
> and Windows STILL works.  I can't get anything to break!
> 
> So, can anyone break Windows?

I believe there are several things going on here, which is why this is
so confusing.

When I first encountered this problem, it was when I used Parted to
create a partition table on a blank disk and then ran the Windows
installer under dosemu.  After the first reboot, I got "NTLDR is
missing".

I believe this was an instance of
<http://support.microsoft.com/?id=314057>, which afflicts FAT
filesystems.  (Installing Windows from DOS starts with a FAT
filesystem which is later converted to NTFS.)

When I forced Parted's notion of the geometry to be the "legacy BIOS"
values and re-created the partition table, the problem went away.
This is what my code does now, and it works fine...  But it relies on
/proc/ide/hdX/settings and HDIO_GETGEO, because Parted has no proper
interface for forcing the geometry.

The Fedora/Suse/Mandrake installer problem is a little different.  It
affects people using NTFS.  But it does not affect everybody.  Here is
my current theory.

We now know that some BIOSes examine the partition table at boot and
*adapt* their notion of the geometry to match.  Yes, really.  You can
partition the drive using some geometry, reboot, query the (legacy)
BIOS interface, and get values which match the partition table.  If
you repeat with a different partition table, you will get a different
legacy geometry from the BIOS.

Not all BIOSes do this.  In fact, most do not.  The report I saw was
from someone using a modern Asus motherboard.

So, when this user installed Fedora Core 2, Parted scrambled the
partition table geometry and the BIOS adapted at the next reboot.  But
the Windows BPB still had the original geometry encoded in it.  Since
it no longer matched the BIOS geometry, the boot loader failed.

In other words, I believe the BPB must match the BIOS geometry, not
necessarily the partition table geometry.  But on some machines, the
BIOS *adapts* to match the partition table, allowing you to break
Windows booting by messing with the partition table.

If you want to get into direct contact with someone actually
experiencing this problem, track down Sean Estabrooks.  He was
collecting reports from Fedora Core 2 users, and he was the one who
noticed that the "legacy" geometry could actually change between
reboots based on the contents of the partition table.

 - Pat

  parent reply	other threads:[~2004-07-03 14:42 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <s5gwu1mwpus.fsf@patl=users.sf.net>
2004-07-02 16:17 ` Szakacsits Szabolcs
2004-07-02 16:50   ` Andries Brouwer
2004-07-02 18:28     ` dwm
2004-07-02 21:12       ` parted maintainership Andries Brouwer
2004-07-02 17:04   ` [RFC] Restoring HDIO_GETGEO semantics (was: Re: workaround for BIOS / CHS stuff) Andries Brouwer
2004-07-02 18:12     ` Szakacsits Szabolcs
2004-07-02 18:45       ` Patrick J. LoPresti
     [not found]         ` <Pine.LNX.4.60.0407022025200.28638@hermes-1.csi.cam.ac.uk>
2004-07-02 19:57           ` Patrick J. LoPresti
2004-07-03  0:17             ` Szakacsits Szabolcs
2004-07-03  0:42               ` Bartlomiej Zolnierkiewicz
2004-07-03  0:56                 ` Andries Brouwer
2004-07-03  1:57                   ` Szakacsits Szabolcs
2004-07-03 13:59                   ` Patrick J. LoPresti
2004-07-05 12:14                   ` Restoring HDIO_GETGEO semantics for 2.6 (was: Re: [RFC] Restoring HDIO_GETGEO semantics) Szakacsits Szabolcs
2004-07-05 13:10                     ` Steffen Winterfeldt
2004-07-05 13:12                     ` Andries Brouwer
2004-07-05 13:13                     ` Bartlomiej Zolnierkiewicz
2004-07-05 14:00                       ` Andries Brouwer
2004-07-05 19:05                         ` Bartlomiej Zolnierkiewicz
2004-07-05 21:08                           ` Andries Brouwer
2004-07-05 21:52                             ` Bartlomiej Zolnierkiewicz
2004-07-06  0:17                               ` Szakacsits Szabolcs
2004-07-06  1:56                                 ` Andries Brouwer
2004-07-06 18:56                                   ` Szakacsits Szabolcs
2004-07-07  1:28                                     ` Andries Brouwer
2004-07-07 11:14                                       ` Roman Zippel
2004-07-07 11:51                                         ` Szakacsits Szabolcs
2004-07-06  8:33                                 ` Steffen Winterfeldt
2004-07-05 18:09                       ` Szakacsits Szabolcs
2004-07-05 18:58                         ` Bartlomiej Zolnierkiewicz
2004-07-03  3:00             ` [RFC] Restoring HDIO_GETGEO semantics (was: Re: workaround for BIOS / CHS stuff) Andrew Clausen
2004-07-02 23:55         ` Szakacsits Szabolcs
2004-07-03 13:56           ` Patrick J. LoPresti
2004-07-03  2:54         ` Andrew Clausen
     [not found]           ` <Pine.LNX.4.60.0407030843400.2415@hermes-1.csi.cam.ac.uk>
2004-07-03 12:44             ` Andrew Clausen
     [not found]               ` <Pine.LNX.4.60.0407031535230.6149@hermes-1.csi.cam.ac.uk>
2004-07-03 15:02                 ` Andrew Clausen
2004-07-03 14:42           ` Patrick J. LoPresti [this message]
2004-07-03  1:35   ` Andrew Clausen
2004-07-03 12:33     ` Andries Brouwer
2004-07-03 14:15     ` Patrick J. LoPresti
2004-07-03 14:45       ` Andrew Clausen
2004-07-03 15:00         ` Patrick J. LoPresti
2004-07-03 20:12         ` Andries Brouwer

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='s5g3c49qiqr.fsf@patl=users.sf.net' \
    --to=patl@users.sourceforge.net \
    --cc=Andries.Brouwer@cwi.nl \
    --cc=bug-parted@gnu.org \
    --cc=clausen@gnu.org \
    --cc=fehr@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=snwint@suse.de \
    --cc=szaka@sienet.hu \
    /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

all inboxes | Powered by JetHome®