]> git.neil.brown.name Git - history.git/commit
[PATCH] general split_vma hugetlb fix
authorHugh Dickins <hugh@veritas.com>
Fri, 11 Feb 2005 04:48:00 +0000 (20:48 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 11 Feb 2005 04:48:00 +0000 (20:48 -0800)
commitb717da93b010bec7cc52d11a3637ac0d2ecaeea1
tree4f177eb462543e31093d67dbe929a9318a02969c
parent88f48c81c6d902621f8f59251785c59b116a3411
[PATCH] general split_vma hugetlb fix

My recent do_munmap hugetlb fix has proved inadequate.  There are
other places (madvise, mbind, mlock, mprotect) where split_vma is
called.  Only mprotect excludes a hugetlb vma: the others are in
danger of splitting at a misaligned address, causing later BUGs.

So move the ~HPAGE_MASK check from do_munmap to split_vma itself;
and fix up those places (madvise and mlock) which expect split_vma
can fail only with -ENOMEM, and wish to convert that to -EAGAIN.
(It appears genuine that some of these syscalls should be failing
with -ENOMEM and some with -EAGAIN, so respect those behaviours.)

madvise_dontneed doesn't use split_vma, but is equally in danger
of causing a hugetlb BUG via zap_page_range.  Whereas elsewhere the
patch is permissive (allowing the operation on a hugetlb vma even when
pointless, so long as it doesn't missplit it), here we must use -EINVAL
on any hugetlb vma, since a page fault would hit the BUG in its nopage.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Acked-by: William Irwin <wli@holomorphy.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
mm/madvise.c
mm/mlock.c
mm/mmap.c