All of lore.kernel.org
 help / color / mirror / Atom feed
* [CFT] read+shared mmap write+read data corruption
@ 2007-05-27 10:49 Russell King
  2007-05-27 14:16 ` James Bottomley
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Russell King @ 2007-05-27 10:49 UTC (permalink / raw)
  To: linux-arch; +Cc: Lennert Buytenhek, Andrew Morton

Lennert Buytenhek recently reported on the linux-arm-kernel list that
fsx-linux fails on his Xscale ARM platforms.  Originally, a problem was
noticed with DB4 databases being corrupted.

After a little bit of digging, I found what appears to be a hole in
the cache alias handling for the page cache; I'm not certain what the
solution is at present [*].  However, I don't think this is an ARM
specific issue.

So, if you have a cache which needs a flush_dcache_page() implementation,
can you please grab:

  http://www.wantstofly.org/~buytenh/cache-issue.c

Build this, and then run:

$ ./cache-issue | od -t x1 -Ax

If the output is a load of zero bytes instead of "0123456789abcdef" then
the read after a shared mmap() write returned stale data.

Note: this program is much more likely to show the issue than fsx-linux -
on my platforms, fsx-linux doesn't show any problems after several minutes
of running, whereas Lennert's program shows a problem immediately.

Also note that our msync() syscall is a no-op; my original test was with
a version of the above with msync(MS_INVALIDATE) in.

* - the hole is:

void do_generic_mapping_read(struct address_space *mapping,
                             struct file_ra_state *_ra,
                             struct file *filp,
                             loff_t *ppos,
                             read_descriptor_t *desc,
                             read_actor_t actor)
{
...
                /* If users can be writing to this page using arbitrary
                 * virtual addresses, take care about potential aliasing
                 * before reading the page on the kernel side.
                 */
                if (mapping_writably_mapped(mapping))
                        flush_dcache_page(page);

is false for both read calls, since at the time this test is done, there
are no shared writable mappings.  However, that's not to say that there
haven't _been_ shared writable mappings.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:

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

end of thread, other threads:[~2007-05-29 17:14 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-27 10:49 [CFT] read+shared mmap write+read data corruption Russell King
2007-05-27 14:16 ` James Bottomley
2007-05-27 22:25   ` Lennert Buytenhek
2007-05-27 23:06     ` David Miller
2007-05-27 23:05   ` David Miller
2007-05-28  0:31     ` James Bottomley
2007-05-28 12:44       ` Lennert Buytenhek
2007-05-29  5:35         ` David Miller
2007-05-29  9:12           ` Russell King
2007-05-29 10:26             ` David Miller
2007-05-27 22:24 ` Lennert Buytenhek
2007-05-28  0:00   ` James Bottomley
2007-05-28 10:05     ` Russell King
2007-05-28 14:17       ` James Bottomley
2007-05-28 14:39         ` Lennert Buytenhek
2007-05-29  3:06           ` James Bottomley
2007-05-29  3:15             ` Lennert Buytenhek
2007-05-29 14:32               ` James Bottomley
2007-05-29 17:13                 ` Russell King
2007-05-29  5:58           ` David Miller
2007-05-28 15:04         ` Russell King
2007-05-29 15:42       ` Lennert Buytenhek
2007-05-28 12:33     ` Lennert Buytenhek
2007-05-28 14:22       ` James Bottomley
2007-05-28 12:38 ` Lennert Buytenhek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.