From: linux@horizon.com
To: helge.hafting@hist.no
Cc: linux-kernel@vger.kernel.org
Subject: Re: truncate shows non zero data beyond the end of the inode with
Date: 24 Sep 2004 00:08:56 -0000 [thread overview]
Message-ID: <20040924000856.16796.qmail@science.horizon.com> (raw)
> 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.
reply other threads:[~2004-09-24 0:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040924000856.16796.qmail@science.horizon.com \
--to=linux@horizon.com \
--cc=helge.hafting@hist.no \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®