public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* truncate shows non zero data beyond the end of the inode with MAP_SHARED
@ 2004-09-15 12:29 Andrea Arcangeli
  2004-09-15 12:46 ` Alan Cox
  2004-09-15 21:01 ` William Lee Irwin III
  0 siblings, 2 replies; 13+ messages in thread
From: Andrea Arcangeli @ 2004-09-15 12:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, an.li.wang

Hello,

I've been told we're not posix compliant the way we handle MAP_SHARED
on the last page of the inode. Basically after we map the page into
userspace people can make the data beyond the i_size non-zero and we
should clear it in the transition from page_mapcount 1 -> 0.  The bug
is that if you truncate-extend, the new data will not be guaranteed to
be zero.

msync + power outage and writing to the page with sys_write at the same
time it's being mapped (and in turn queueing it for pdflush writeout)
are the two worst offeners. To fix those we'd need to mark the pte
readonly, flush the tlb with a worst-case IPI broadcast, writepage, then
mark the pte read-write and flush the tlb again with another IPI
broadcast.

That is going to have a significant cost methinks. So maybe we shouldn't
fix it after all...

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2004-09-17 13:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-15 12:29 truncate shows non zero data beyond the end of the inode with MAP_SHARED Andrea Arcangeli
2004-09-15 12:46 ` Alan Cox
2004-09-15 21:01 ` William Lee Irwin III
2004-09-15 21:55   ` Andrew Morton
2004-09-15 22:00     ` William Lee Irwin III
2004-09-15 22:08       ` Andrea Arcangeli
2004-09-16  8:49         ` Helge Hafting
2004-09-16 14:26           ` Andrea Arcangeli
2004-09-17 13:49             ` Helge Hafting
2004-09-17 13:52               ` Andrea Arcangeli
2004-09-17 13:54               ` William Lee Irwin III
2004-09-15 22:04     ` Andrea Arcangeli
2004-09-15 21:58   ` Andrea Arcangeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox