From: Qi Zheng <zhengqi.arch@bytedance.com>
To: Miaohe Lin <linmiaohe@huawei.com>,
akpm@linux-foundation.org, pasha.tatashin@soleen.com
Cc: rientjes@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/page_table_check: fix accessing unmapped ptep
Date: Thu, 26 May 2022 21:04:52 +0800 [thread overview]
Message-ID: <09f38cf3-282a-61fa-9916-057b01b57d30@bytedance.com> (raw)
In-Reply-To: <20220526113350.30806-1-linmiaohe@huawei.com>
On 2022/5/26 7:33 PM, Miaohe Lin wrote:
> ptep is unmapped too early, so ptep will be accessed while it's unmapped.
> Fix it by deferring pte_unmap() until page table checking is done.
In the beginning, page_table_check only supported x86_64, so there
is no problem. But then the commit 3fee229a8eb9 ("riscv/mm: enable
ARCH_SUPPORTS_PAGE_TABLE_CHECK") added support for riscv-32, it is
indeed a problem in this case.
So:
Reviewed-by: Qi Zheng <zhengqi.arch@bytedance.com>
>
> Fixes: 80110bbfbba6 ("mm/page_table_check: check entries at pmd levels")
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
> mm/page_table_check.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/page_table_check.c b/mm/page_table_check.c
> index 3692bea2ea2c..971c3129b0e3 100644
> --- a/mm/page_table_check.c
> +++ b/mm/page_table_check.c
> @@ -234,11 +234,11 @@ void __page_table_check_pte_clear_range(struct mm_struct *mm,
> pte_t *ptep = pte_offset_map(&pmd, addr);
> unsigned long i;
>
> - pte_unmap(ptep);
> for (i = 0; i < PTRS_PER_PTE; i++) {
> __page_table_check_pte_clear(mm, addr, *ptep);
> addr += PAGE_SIZE;
> ptep++;
> }
> + pte_unmap(ptep);
> }
> }
--
Thanks,
Qi
next prev parent reply other threads:[~2022-05-26 13:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-26 11:33 Miaohe Lin
2022-05-26 13:04 ` Qi Zheng [this message]
2022-05-26 13:11 ` Pasha Tatashin
2022-05-26 13:23 ` Qi Zheng
2022-05-26 13:17 ` Pasha Tatashin
2022-05-26 13:34 ` Matthew Wilcox
2022-05-26 13:37 ` Pasha Tatashin
2022-05-26 18:15 ` Andrew Morton
2022-05-26 18:31 ` Pasha Tatashin
2022-05-27 1:10 ` Miaohe Lin
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=09f38cf3-282a-61fa-9916-057b01b57d30@bytedance.com \
--to=zhengqi.arch@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pasha.tatashin@soleen.com \
--cc=rientjes@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