]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
Fix incorrect user space access locking in mincore() (CVE-2006-4814)
authorLinus Torvalds <torvalds@osdl.org>
Thu, 4 Jan 2007 00:44:45 +0000 (01:44 +0100)
committerAdrian Bunk <bunk@stusta.de>
Thu, 4 Jan 2007 00:44:45 +0000 (01:44 +0100)
commit7c876d457b5c7e949032a4ac7aec64af0136d52a
treeb1f16947a5739a423a59c54f19551f0ac69753a7
parent571525bb8f82493d0332aa8e31776a9fdc607b3b
Fix incorrect user space access locking in mincore() (CVE-2006-4814)

Doug Chapman noticed that mincore() will doa "copy_to_user()" of the
result while holding the mmap semaphore for reading, which is a big
no-no.  While a recursive read-lock on a semaphore in the case of a page
fault happens to work, we don't actually allow them due to deadlock
schenarios with writers due to fairness issues.

Doug and Marcel sent in a patch to fix it, but I decided to just rewrite
the mess instead - not just fixing the locking problem, but making the
code smaller and (imho) much easier to understand.

Also included are two fixes for the original patch including one
by Oleg Nesterov.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
mm/mincore.c