All of lore.kernel.org
 help / color / mirror / Atom feed
* IDE disk and HPA
@ 2005-07-22 12:17 Oliver Tennert
  2005-07-22 14:47 ` Alan Cox
  0 siblings, 1 reply; 9+ messages in thread
From: Oliver Tennert @ 2005-07-22 12:17 UTC (permalink / raw)
  To: linux-kernel

Hello,

I have a question concerning the handling of HPA (Host-protected areas) in 
current Linux kernels.

Have a look at drivers/ide/ide-disk.c:


static inline void idedisk_check_hpa(ide_drive_t *drive)
{
        unsigned long long capacity, set_max;
        int lba48 = idedisk_supports_lba48(drive->id);

        capacity = drive->capacity64;
        if (lba48)
                set_max = idedisk_read_native_max_address_ext(drive);
        else
                set_max = idedisk_read_native_max_address(drive);

        if (set_max <= capacity)
                return;

        printk(KERN_INFO "%s: Host Protected Area detected.\n"
                         "\tcurrent capacity is %llu sectors (%llu MB)\n"
                         "\tnative  capacity is %llu sectors (%llu MB)\n",
                         drive->name,
                         capacity, sectors_to_MB(capacity),
                         set_max, sectors_to_MB(set_max));

        if (lba48)
                set_max = idedisk_set_max_address_ext(drive, set_max);
        else
                set_max = idedisk_set_max_address(drive, set_max);
        if (set_max) {
                drive->capacity64 = set_max;
                printk(KERN_INFO "%s: Host Protected Area disabled.\n",
                                 drive->name);
        }
}

Do I interpret it right that the following is done in the above function:

1.) The current capacity of the disk is detected.
2.) The "native max. address size" of the disk is detected and stored in 
set_max.
3.) If capacity < set_max then it is rightly stated that an HPA is detected.
4.) If an HPA is detected, then that HPA is disabled, i.e. the maximum address 
size is set to the "native max. address size". Afterwards, the HPA is no 
more!

My question is now: why is an HPA disabled i.e. disprotected when detected? 
Why not let the HPA alone, because a certain set of disk sectors shall not be 
accessible by the OS?

Best regards

Oliver
-- 

Acid -- better living through chemistry.
--
__
________________________________________creating IT solutions

Dr. Oliver Tennert
Senior Solutions Engineer
CAx Professional Services
                                        science + computing ag
phone   +49(0)7071 9457-598             Hagellocher Weg 71-75	
fax     +49(0)7071 9457-411             D-72070 Tuebingen, Germany
O.Tennert@science-computing.de          www.science-computing.de



^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: IDE disk and HPA
@ 2005-08-04 12:11 Etienne Lorrain
  2005-08-04 21:45 ` Gustavo Guillermo Pérez
  0 siblings, 1 reply; 9+ messages in thread
From: Etienne Lorrain @ 2005-08-04 12:11 UTC (permalink / raw)
  To: linux-kernel

> > > My question is now: why is an HPA disabled i.e. disprotected when
> > > detected? Why not let the HPA alone, because a certain set of disk
> > > sectors shall not be accessible by the OS?
> >
> > Because the HPA is most commonly used to hide all but a fraction of a
> > disk to work with older BIOSes.
>
> But as to my knowledge, the HPA was had been introduced to allow HW
> vendors to store things like diagnostic programs in a part of the
> disk protected from partitioning and filesystems.
> The point is, IF there is an HPA, there MIGHT be a partitioning
> scheme and some filesystems on the disk which rely on the size of
> disk being the native size MINUS the HPA.

  If those HW vendors want to store software in the HPA of the IDE
 hard disk, and they employ people able to read the IDE specifications,
 they know that this HPA can be protected by password and so Linux
 just display a failure when trying to restore the capacity of the
 Hard Disk - because it lacks the unlocking password.

  Note that this HPA is a good place to store a bootloader too, in fact
 I like to think of it as the big floppy drive of the PC which no more
 have any floppy drive: create a FAT filesystem of 64 Mbytes there and
 copy all the floppy you used to have there. Your bootloader, if it
 is good enough, will be able to run software from this area.

  I also have to add that it is finally time to read the ATA 4
 specification (published in august 1998) or any newer version, for
 instance at:
 http://www.t13.org/project/d1153r18-ATA-ATAPI-4.pdf
 around page 30 / page 46 about "6.10 Security Mode feature set".
 Pay attentiong to the last sentense of "6.10.4 Frozen mode".
  If you are using the right bootloader someone has already taken care
 of that detail for you - you are not disk2brick virus sensitive, and
 you do not care much of the blankdisk virus neither - whatever the
 OSes you are using.

  Etienne.

--
 http://gujin.org


^ permalink raw reply	[flat|nested] 9+ messages in thread
* RE: IDE disk and HPA
@ 2005-08-04 17:15 Aleksey Gorelov
  2005-08-05  9:50 ` Etienne Lorrain
  0 siblings, 1 reply; 9+ messages in thread
From: Aleksey Gorelov @ 2005-08-04 17:15 UTC (permalink / raw)
  To: etienne.lorrain, linux-kernel

>-----Original Message-----
>From: linux-kernel-owner@vger.kernel.org 
>[mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of 
>Etienne Lorrain
>Sent: Thursday, August 04, 2005 5:11 AM
>To: linux-kernel@vger.kernel.org
>Subject: Re: IDE disk and HPA
>
>> > > My question is now: why is an HPA disabled i.e. disprotected when
>> > > detected? Why not let the HPA alone, because a certain 
>set of disk
>> > > sectors shall not be accessible by the OS?
>> >
>> > Because the HPA is most commonly used to hide all but a 
>fraction of a
>> > disk to work with older BIOSes.
>>
>> But as to my knowledge, the HPA was had been introduced to allow HW
>> vendors to store things like diagnostic programs in a part of the
>> disk protected from partitioning and filesystems.
>> The point is, IF there is an HPA, there MIGHT be a partitioning
>> scheme and some filesystems on the disk which rely on the size of
>> disk being the native size MINUS the HPA.
>
>  If those HW vendors want to store software in the HPA of the IDE
> hard disk, and they employ people able to read the IDE specifications,
> they know that this HPA can be protected by password and so Linux
> just display a failure when trying to restore the capacity of the
> Hard Disk - because it lacks the unlocking password.

 Yep, you are right. When used by BIOS/firmware, it is usually 
protected by password. And interesting enough, as in this particular 
case, they employ people to not only read them, but to write them as
well ;)
  However, if not protected by the password, it is probably Ok 
to make it visible (as things currently are).

>
>  Note that this HPA is a good place to store a bootloader too, in fact
> I like to think of it as the big floppy drive of the PC which no more
> have any floppy drive: create a FAT filesystem of 64 Mbytes there and
> copy all the floppy you used to have there. Your bootloader, if it
> is good enough, will be able to run software from this area.

If your bootloader if the first thing to run in the system, you can 
use & protect portion of your hardrive for yourself - just make sure you

lock with set max with password when passing control to 'normal'
OS/loader.

Aleks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-08-05 10:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-22 12:17 IDE disk and HPA Oliver Tennert
2005-07-22 14:47 ` Alan Cox
2005-08-04  7:14   ` Oliver Tennert
2005-08-04 11:41     ` Alan Cox
  -- strict thread matches above, loose matches on Subject: below --
2005-08-04 12:11 Etienne Lorrain
2005-08-04 21:45 ` Gustavo Guillermo Pérez
2005-08-05 10:15   ` Etienne Lorrain
2005-08-04 17:15 Aleksey Gorelov
2005-08-05  9:50 ` Etienne Lorrain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.