• Peter Xu's avatar
    mm/x86: make pud_leaf() only care about PSE bit · 144bb0ae
    Peter Xu authored
    When working on mprotect() on 1G dax entries, I hit an zap bad pud error
    when zapping a huge pud that is with PROT_NONE permission.
    
    Here the problem is x86's pud_leaf() requires both PRESENT and PSE bits
    set to report a pud entry as a leaf, but that doesn't look right, as it's
    not following the pXd_leaf() definition that we stick with so far, where
    PROT_NONE entries should be reported as leaves.
    
    To fix it, change x86's pud_leaf() implementation to only check against
    PSE bit to report a leaf, irrelevant of whether PRESENT bit is set.
    
    Link: https://lkml.kernel.org/r/20240812181225.1360970-5-peterx@redhat.comSigned-off-by: default avatarPeter Xu <peterx@redhat.com>
    Acked-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
    Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
    Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: Dave Jiang <dave.jiang@intel.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Kirill A. Shutemov <kirill@shutemov.name>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Michael Ellerman <mpe@ellerman.id.au>
    Cc: Nicholas Piggin <npiggin@gmail.com>
    Cc: Oscar Salvador <osalvador@suse.de>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Rik van Riel <riel@surriel.com>
    Cc: Sean Christopherson <seanjc@google.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    144bb0ae
pgtable.h 40.9 KB