Re: [PATCH] mm/hugetlb: avoid get wrong ptep caused by race

From: Mike Kravetz
Date: Tue Feb 18 2020 - 19:52:13 EST


On 2/18/20 12:37 PM, Sean Christopherson wrote:
> On Tue, Feb 18, 2020 at 08:10:25PM +0800, Longpeng(Mike) wrote:
>> Our machine encountered a panic after run for a long time and
>> the calltrace is:
>
> What's the actual panic? Is it a BUG() in hugetlb_fault(), a bad pointer
> dereference, etc...?

I too would like some more information on the panic.
If your analysis is correct, then I would expect the 'ptep' returned by
huge_pte_offset() to not point to a pte but rather some random address.
This is because the 'pmd' calculated by pmd_offset(pud, addr) is not
really the address of a pmd. So, perhaps there is an addressing exception
at huge_ptep_get() near the beginning of hugetlb_fault()?

ptep = huge_pte_offset(mm, haddr, huge_page_size(h));
if (ptep) {
entry = huge_ptep_get(ptep);
...

--
Mike Kravetz