Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Nov 1999 21:46:55 -0700 (MST)
From:      David G Andersen <danderse@cs.utah.edu>
To:        barrett@phoenix.aye.net (Barrett Richardson)
Cc:        wes@softweyr.com, kris@hub.freebsd.org, trouble@netquick.net, danderse@cs.utah.edu, freebsd-security@FreeBSD.ORG
Subject:   Re: secure filesystem wiping
Message-ID:  <199911190446.VAA22206@faith.cs.utah.edu>
In-Reply-To: <Pine.BSF.4.01.9911182331400.18537-100000@phoenix.aye.net> from "Barrett Richardson" at Nov 18, 99 11:37:34 pm

next in thread | previous in thread | raw e-mail | index | archive | help
Lo and behold, Barrett Richardson once said:
> 
> Also, will my system choke if I mmap a 250 MB file on a system
> with 32 MB of ram? That was why I was thinking of obliterating
> files in strips.

Not if you do it right.  Do it in blocks, and use madvise 
(try MADV_SEQUENTIAL on the whole region, or simply MADV_DONTNEED each
block after you're done).  I'd wager that MADV_SEQUENTIAL will give you
exactly the behavior you're looking for if you do something like:

Blocks in terms of pagesize would be particularly appropriate, yes. :)

blocks = filesize/PAGE_SIZE;
for (block = 0; block < blocks; block++) {
   for (i = 0; i < PAGE_SIZE; i++) {
      scribble, scrabble, Z=10 points.
   }
}

Note that the pseudocode doesn't overwrite multiple times, and that's on
purpose.  If you're going through the mmap interface and not the raw
device, I don't think you're really going to have enough control over
things to do multiple pass overwrites.  But this should work just fine for
nuking those unsightly blemishes left over on your filesystem.

  -Dave

-- 
work: dga@lcs.mit.edu                          me:  dga@pobox.com
      MIT Laboratory for Computer Science           http://www.angio.net/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-security" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911190446.VAA22206>