From: Miaohe Lin <linmiaohe@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <mike.kravetz@oracle.com>, <shakeelb@google.com>,
<hannes@cmpxchg.org>, <vbabka@suse.cz>, <walken@google.com>,
<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm/rmap: Fix potential pte_unmap on an not mapped pte
Date: Thu, 28 Jan 2021 09:54:40 +0800 [thread overview]
Message-ID: <3f924e26-57f3-863e-435f-115dbdf01ffc@huawei.com> (raw)
In-Reply-To: <20210127160921.989f01c83d6703148f6bc316@linux-foundation.org>
Hi:
On 2021/1/28 8:09, Andrew Morton wrote:
> On Wed, 27 Jan 2021 04:33:49 -0500 Miaohe Lin <linmiaohe@huawei.com> wrote:
>
>> For PMD-mapped page (usually THP), pvmw->pte is NULL. For PTE-mapped THP,
>> pvmw->pte is mapped. But for HugeTLB pages, pvmw->pte is not mapped and set
>> to the relevant page table entry. So in page_vma_mapped_walk_done(), we may
>> do pte_unmap() for HugeTLB pte which is not mapped. Fix this by checking
>> pvmw->page against PageHuge before trying to do pte_unmap().
>>
>
> What are the runtime consequences of this? Is there a workload which
> is known to trigger it?
>
Not yet. This should not be backported. My bad. Sorry about it.
> IOW, how do we justify a -stable backport of this fix?
> >>
>> --- a/include/linux/rmap.h
>> +++ b/include/linux/rmap.h
>> @@ -213,7 +213,8 @@ struct page_vma_mapped_walk {
>>
>> static inline void page_vma_mapped_walk_done(struct page_vma_mapped_walk *pvmw)
>> {
>> - if (pvmw->pte)
>> + /* HugeTLB pte is set to the relevant page table entry without pte_mapped. */
>> + if (pvmw->pte && !PageHuge(pvmw->page))
>> pte_unmap(pvmw->pte);
>> if (pvmw->ptl)
>> spin_unlock(pvmw->ptl);
>> --
>> 2.19.1
> .
>
prev parent reply other threads:[~2021-01-28 1:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-27 9:33 Miaohe Lin
2021-01-28 0:09 ` Andrew Morton
2021-01-28 1:54 ` Miaohe Lin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3f924e26-57f3-863e-435f-115dbdf01ffc@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=shakeelb@google.com \
--cc=vbabka@suse.cz \
--cc=walken@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®