]> git.karo-electronics.de Git - karo-tx-linux.git/commit
mm: avoid wrapping vm_pgoff in mremap()
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 7 Apr 2011 14:35:50 +0000 (07:35 -0700)
committerAndi Kleen <ak@linux.intel.com>
Thu, 28 Apr 2011 15:20:54 +0000 (08:20 -0700)
commita912dbb16e083224bab946591e2251278a1dd358
treedcfb29329644fd0e0246c7d89966231aeb07b41d
parentb229ff76e622cb4ba1e79c21764ff20b8c7f8fbe
mm: avoid wrapping vm_pgoff in mremap()

commit 982134ba62618c2d69fbbbd166d0a11ee3b7e3d8 upstream.

The normal mmap paths all avoid creating a mapping where the pgoff
inside the mapping could wrap around due to overflow.  However, an
expanding mremap() can take such a non-wrapping mapping and make it
bigger and cause a wrapping condition.

Noticed by Robert Swiecki when running a system call fuzzer, where it
caused a BUG_ON() due to terminally confusing the vma_prio_tree code.  A
vma dumping patch by Hugh then pinpointed the crazy wrapped case.

Reported-and-tested-by: Robert Swiecki <robert@swiecki.net>
Acked-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
mm/mremap.c