Re: [PATCH] general split_vma hugetlb fix

From: William Lee Irwin III
Date: Fri Feb 11 2005 - 15:46:11 EST


On Fri, Feb 11, 2005 at 08:06:08PM +0000, Hugh Dickins wrote:
> 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@xxxxxxxxxxx>

As usual, excellent work, Hugh. akpm, Linus, please apply.

Acked-by: William Irwin <wli@xxxxxxxxxxxxxx>


-- wli
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/