From: Vladimir Davydov Date: Fri, 8 Aug 2014 21:22:01 +0000 (-0700) Subject: fork: copy mm's vm usage counters under mmap_sem X-Git-Tag: omap-for-v3.17/fixes-against-rc2~116^2~117 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f7d461433bb4a4deee61baefdac6cd1a1ecb546;p=pandora-kernel.git fork: copy mm's vm usage counters under mmap_sem If a forking process has a thread calling (un)mmap (silly but still), the child process may have some of its mm's vm usage counters (total_vm and friends) screwed up, because currently they are copied from oldmm w/o holding any locks (memcpy in dup_mm). This patch moves the counters initialization to dup_mmap() to be called under oldmm->mmap_sem, which eliminates any possibility of race. Signed-off-by: Vladimir Davydov Cc: Oleg Nesterov Cc: David Rientjes Cc: Christoph Lameter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed