• Kirill A. Shutemov's avatar
    mm: sanitize page->mapping for tail pages · 1c290f64
    Kirill A. Shutemov authored
    We don't define meaning of page->mapping for tail pages.  Currently it's
    always NULL, which can be inconsistent with head page and potentially
    lead to problems.
    
    Let's poison the pointer to catch all illigal uses.
    
    page_rmapping(), page_mapping() and page_anon_vma() are changed to look
    on head page.
    
    The only illegal use I've caught so far is __GPF_COMP pages from sound
    subsystem, mapped with PTEs.  do_shared_fault() is changed to use
    page_rmapping() instead of direct access to fault_page->mapping.
    Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Reviewed-by: default avatarJérôme Glisse <jglisse@redhat.com>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Dave Hansen <dave.hansen@intel.com>
    Cc: Mel Gorman <mgorman@suse.de>
    Cc: Rik van Riel <riel@redhat.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
    Cc: Steve Capper <steve.capper@linaro.org>
    Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Michal Hocko <mhocko@suse.cz>
    Cc: Jerome Marchand <jmarchan@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    1c290f64
page_alloc.c 189 KB