Hugh Dickins wrote:On Tue, 5 Jan 2010, KOSAKI Motohiro wrote:Excellent test case, thank you! Would you consider preparing a patch to futextest?From c3e2dfdff84b9b720e646fd6dd3c38fff293c7e6 Mon Sep 17 00:00:00 2001
From: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
Date: Tue, 5 Jan 2010 11:33:00 +0900
Subject: [PATCH] futex: remove rw parameter from get_futex_key()
Currently, futex have two problem.
A) current futex doesn't handle private file mappings properly.
get_futex_key() use PageAnon() to distinguish file and anon. it can
makes following bad scenario.
1) thread-A call futex(private-mapping, FUTEX_WAIT). it makes to
sleep on file mapping object.
2) thread-B write a variable and it makes cow.
3) thread-B call futex(private-mapping, FUTEX_WAKE). it wake up
sleeped thread on the anonymous page. (but it's nothing)
http://git.kernel.org/?p=linux/kernel/git/dvhart/futextest.git;a=summary
Patch attached. you can feel free any modify such file. thanks.