[lug] du vs df

Bear Giles bgiles at coyotesong.com
Mon Mar 11 14:41:00 MDT 2013


If you want to be really evil you can create the file, lseek to some
ridiculous amount (to create a sparse file), mmap it, delete it, then hand
it off to the library caller as a huge allocated buffer without making it
clear to them that they must call the deallocator when they're done with it.

Obviously there are times when this trick is useful but if somebody drops
the ball you could have invisible files slowly consuming a GB or more of
disk space.

BTW a good reason to hide the file like this is security - another app
can't tweak the file (which may be mmapped like above!) without doing some
deep voodoo. It's not 100% if the attacker has root access and knows what
to look for in /proc but it can stop naive attackers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20130311/2358c5bc/attachment.html>


More information about the LUG mailing list