public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* truncate on MAP_SHARED files in ramfs filesystems on no-mmu
@ 2009-07-09  8:04 Mike Frysinger
  2009-07-09 10:06 ` David Howells
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2009-07-09  8:04 UTC (permalink / raw)
  To: David Howells; +Cc: Linux kernel mailing list

reviewing LTP tests shows mmap09 failing.  this test creates a file of
a certain length, opens it and creates a shared mapping, and then
tries various truncate tests:
truncate to a smaller size
truncate to a larger size
truncate to size 0

the first and last fail on no-mmu due to
file-nommu.c:ramfs_nommu_resize() rejecting attempts to shrink on a
shared mapping:
    /* check that a decrease in size doesn't cut off any shared mappings */
    if (newsize < size) {
        ret = ramfs_nommu_check_mappings(inode, newsize, size);
        if (ret < 0)
            return ret;
    }

my question is why ?  if an application maps a fd with MAP_SHARED,
truncates it, and then it or someone else who has that fd mapped tries
to access the now-invalid tail end, that is a bug in the application.
i dont see why we should be protecting users here from their own buggy
code ?
-mike

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

end of thread, other threads:[~2009-07-10 19:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-09  8:04 truncate on MAP_SHARED files in ramfs filesystems on no-mmu Mike Frysinger
2009-07-09 10:06 ` David Howells
2009-07-09 15:22   ` Mike Frysinger
2009-07-09 16:07     ` David Howells
2009-07-10 16:56       ` Robin Getz
2009-07-10 19:29       ` Mike Frysinger

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