Subject: bug#15633: dd and host protected area

From: "Peter D." <[email-masked]>
Date: Wed, 16 Oct 2013 18:19:54 +1100

Hi,

Is it deliberate that dd can not read from, or write to the host protected
area?  Or is it a bug?

It is sensible the the OS does not normally access the HPA, but dd is  not
a normal tool.

Personally I would expect it to be able to read from the HPA and to write
to  it with a suitable flag like, "--yes-I-am-reckless".

Some jurisdictions require that hard drives be blanked before disposal.  Dd
is the obvious tool for that.

I have two 80GB drives in this machine one with HPA, the other without.
Hear is a cut'n'paste from my console...

psd@psd-System-Product-Name:~$
psd@psd-System-Product-Name:~$
psd@psd-System-Product-Name:~$
psd@psd-System-Product-Name:~$ sudo hdparm -N /dev/sdb

/dev/sdb:
 max sectors   = 156299375/156301488, HPA is enabled
psd@psd-System-Product-Name:~$ sudo dd count=1 if=/dev/sdb of=junk
skip=156299376
dd: `/dev/sdb': cannot skip: Invalid argument
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000515987 s, 0.0 kB/s
psd@psd-System-Product-Name:~$ sudo dd count=1 if=/dev/sdb of=junk
skip=156299375
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000105041 s, 0.0 kB/s
psd@psd-System-Product-Name:~$ sudo hdparm -N /dev/sda

/dev/sda:
 max sectors   = 156301488/156301488, HPA is disabled
psd@psd-System-Product-Name:~$ sudo dd count=1 if=/dev/sda of=junk
skip=156299376
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.0182093 s, 28.1 kB/s
psd@psd-System-Product-Name:~$
psd@psd-System-Product-Name:~$ dd --version
dd (coreutils) 8.13
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Paul Rubin, David MacKenzie and Stuart Kemp.
psd@psd-System-Product-Name:~$

Thank you.

-- 
Peter D.
Sig goes here...