• H
    mm: fix possible cause of a page_mapped BUG · a3e8cc64
    Hugh Dickins 提交于
    Robert Swiecki reported a BUG_ON(page_mapped) from a fuzzer, punching
    a hole with madvise(,, MADV_REMOVE).  That path is under mutex, and
    cannot be explained by lack of serialization in unmap_mapping_range().
    
    Reviewing the code, I found one place where vm_truncate_count handling
    should have been updated, when I switched at the last minute from one
    way of managing the restart_addr to another: mremap move changes the
    virtual addresses, so it ought to adjust the restart_addr.
    
    But rather than exporting the notion of restart_addr from memory.c, or
    converting to restart_pgoff throughout, simply reset vm_truncate_count
    to 0 to force a rescan if mremap move races with preempted truncation.
    
    We have no confirmation that this fixes Robert's BUG,
    but it is a fix that's worth making anyway.
    Signed-off-by: NHugh Dickins <hughd@google.com>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    a3e8cc64
mremap.c 13.0 KB