All of lore.kernel.org
 help / color / mirror / Atom feed
* Erasing an SD/MMC card from usermode?
@ 2011-01-05 23:03 John Gilmore
  2011-01-06  4:48 ` Chris Ball
  0 siblings, 1 reply; 2+ messages in thread
From: John Gilmore @ 2011-01-05 23:03 UTC (permalink / raw)
  To: linux-mmc, gnu

I'm working on secure deletion of data on various media.  I recalled
that the MMC and SD card specs contain a low-level command for erasing
blocks, which could be used to erase a whole card if desired.  And later
MMC specs provide a secure block erase command that also erases ancillary
unaddressable garbage blocks, etc.

However, after a perusal of the relevant kernel code (as of the 2.6.35
shipped by Ubuntu), I see no support for invoking these commands from a
user program.  I saw some patches on the LKML from Adrian Hunter in
June 2010 that added support for ioctl(BLKSECDISCARD).  Are these in
an upcoming mainline kernel?  Has someone provided a clean userspace
way to invoke it on an entire SD card or MMC card?

(On ATA disks, access to the SECURITY ERASE command is via the hdparm user
program, which invokes the SG_IO (SCSI Generic) driver.  But SECURITY ERASE
has odd edges, e.g. it requires that you set and then supply a password.  It
would be a shame if higher level programs, e.g. the Linux installer, had
to run different "secure erase" commands depending on what medium is being
erased.)

	John Gilmore

PS:  Does anyone know a way to do secure erase via a USB Mass Storage adapter?

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

* Re: Erasing an SD/MMC card from usermode?
  2011-01-05 23:03 Erasing an SD/MMC card from usermode? John Gilmore
@ 2011-01-06  4:48 ` Chris Ball
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Ball @ 2011-01-06  4:48 UTC (permalink / raw)
  To: John Gilmore; +Cc: linux-mmc

Hi John,

On Wed, Jan 05, 2011 at 03:03:42PM -0800, John Gilmore wrote:
> I'm working on secure deletion of data on various media.  I recalled
> that the MMC and SD card specs contain a low-level command for erasing
> blocks, which could be used to erase a whole card if desired.  And later
> MMC specs provide a secure block erase command that also erases ancillary
> unaddressable garbage blocks, etc.
> 
> However, after a perusal of the relevant kernel code (as of the 2.6.35
> shipped by Ubuntu), I see no support for invoking these commands from a
> user program.  I saw some patches on the LKML from Adrian Hunter in
> June 2010 that added support for ioctl(BLKSECDISCARD).  Are these in
> an upcoming mainline kernel? 

These patches were included in the 2.6.36 release, back in October.

> Has someone provided a clean userspace way to invoke it on an entire SD
> card or MMC card?

Not that I can see.  http://sourceforge.net/projects/test-discard/ looks
like it would be trivially modifiable to use BLKSECDISCARD, and would
also tell you some interesting things about timing.  Of course, a tiny
script would be enough to open an MMC block device and call the ioctl.

> (On ATA disks, access to the SECURITY ERASE command is via the hdparm user
> program, which invokes the SG_IO (SCSI Generic) driver.  But SECURITY ERASE
> has odd edges, e.g. it requires that you set and then supply a password.  It
> would be a shame if higher level programs, e.g. the Linux installer, had
> to run different "secure erase" commands depending on what medium is being
> erased.)
> 
> 	John Gilmore
> 
> PS:  Does anyone know a way to do secure erase via a USB Mass Storage adapter?

Don't know, sorry.

-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

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

end of thread, other threads:[~2011-01-06  4:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-05 23:03 Erasing an SD/MMC card from usermode? John Gilmore
2011-01-06  4:48 ` Chris Ball

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.