Subject: CVS commit: src/bin/rm
To: None <source-changes@NetBSD.org>
From: Thor Lancelot Simon <tls@netbsd.org>
List: source-changes
Date: 01/11/2004 02:04:05
Module Name:	src
Committed By:	tls
Date:		Sun Jan 11 02:04:05 UTC 2004

Modified Files:
	src/bin/rm: rm.1 rm.c

Log Message:
Change behaviour of -P option to conform generally to DoD 5220.22-M
standard.  This change inspired by Apple's "Secure Empty Trash" functionality
in MacOS 10.3.  However, it is important to understand that this change
does not -- and can not -- actually achieve conformance to the current
revision of the standard.  To quote the manual page:

     The -P option attempts to conform to U.S. DoD 5220-22.M, "National Indus-
     trial Security Program Operating Manual" ("NISPOM") as updated by Change
     2 and the July 23, 2003 "Clearing & Sanitization Matrix".  However,
     unlike earlier revisions of NISPOM, the 2003 matrix imposes requirements
     which make it clear that the standard does not and can not apply to the
     erasure of individual files, in particular requirements relating to spare
     sector management for an entire magnetic disk.  Because these
     requirements are not met, the -P option does not conform to the standard.

This also makes the -P option a *lot* more expensive than it used to be.
It used to overwrite with 0xff, overwrite with 0x00, overwrite with 0xff,
with an fsync after each write.  Now it overwrites with a random character,
overwrites with 0xff, overwrites with 0x00, reads to validate the 0x00
overwrite, then overwrites with random data -- calling sync() after every
operation in an attempt to force seeks that will clear the data from the
cache of disks that lie about whether data has been committed to the
platters.  Also, the file's opened with O_SYNC|O_RSYNC to cause metadata
updates on every read/write, which should cause still more seeks.

This is better than it used to be, but it's by no means adequate if you
have data you really don't want read by an adversary who can pull the
disk apart.


To generate a diff of this commit:
cvs rdiff -r1.17 -r1.18 src/bin/rm/rm.1
cvs rdiff -r1.39 -r1.40 src/bin/rm/rm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.