Re: [PATCH v2 0/2] hugetlbfs: use i_mmap_rwsem for better synchronization

From: Andrew Morton
Date: Thu Dec 20 2018 - 16:06:47 EST


On Tue, 18 Dec 2018 14:35:55 -0800 Mike Kravetz <mike.kravetz@xxxxxxxxxx> wrote:

> There are two primary issues addressed here:
> 1) For shared pmds, huge PTE pointers returned by huge_pte_alloc can become
> invalid via a call to huge_pmd_unshare by another thread.
> 2) hugetlbfs page faults can race with truncation causing invalid global
> reserve counts and state.
> Both issues are addressed by expanding the use of i_mmap_rwsem.
>
> These issues have existed for a long time. They can be recreated with a
> test program that causes page fault/truncation races. For simple mappings,
> this results in a negative HugePages_Rsvd count. If racing with mappings
> that contain shared pmds, we can hit "BUG at fs/hugetlbfs/inode.c:444!" or
> Oops! as the result of an invalid memory reference.

Still no reviewers or ackers :(

I'll queue these for 4.21-rc1. The Fixes: commits are over a decade
old so I assume things aren't super-urgent and the cc:stable will do
its work.