* Re: truncate shows non zero data beyond the end of the inode with
@ 2004-09-24 0:08 linux
0 siblings, 0 replies; only message in thread
From: linux @ 2004-09-24 0:08 UTC (permalink / raw)
To: helge.hafting; +Cc: linux-kernel
> Could this "garbage" possibly be confidential data?
> I.e. one user repeatedly makes and mmaps a 1-byte file,
> extends it to 4k, and looks at the 4095 bytes of "garbage".
> Maybe he finds some "interesting stuff" when someone else's
> confidential file just got dropped from pagecache
> so he could mmap this 1-byte file?
No, it couldn't. The sequence of operations is:
- char *p = mmap(1-byte file). p[1] through p[4095] are guaranteed to be zero.
- Write to p[1] through p[4095]. If the file is flushed at this point,
the extra bytes are guaranteed NOT to be written to disk.
- ftruncate() the file to 4096 bytes
- At this point, Linux may flush the non-zero bytes p[1]..p[4095] to disk.
*That* is the issue being complained about. If you write to p[1] through
p[4095] *before* calling truncate(2) or ftruncate(2), it can get written
back to disk.
If you don't write past the EOF, it doesn't arise.
The only security issue is that, although you technically are guaranteed
access to the trailing partial page, so a correct program *could*
rely on it, it's more commonly evidence of a bug, and bugs often have
security implications.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-09-24 0:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-24 0:08 truncate shows non zero data beyond the end of the inode with linux
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®