arm64: mm: use ptep_clear() instead of pte_clear() in clear_flush()
PATCH 1/1 arm64: mm: use ptep_clear() instead of pte_clear() in clear_flush()
From: Qi Zheng <[email protected]>
In clear_flush(), the original pte may be a present entry, so we should use ptep_clear() to let page_table_check track the pte clearing operation, otherwise it may cause false positive in subsequent set_pte_at().
--- arch/arm64/mm/hugetlbpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/mm/hugetlbpage.c +1 -1
@@ -236,7 +236,7 @@ static void clear_flush(struct mm_struct *mm,unsigned long i, saddr = addr;for (i =0 ; i < ncontig; i++, addr += pgsize, ptep++) -pte_clear (mm, addr, ptep); +ptep_clear (mm, addr, ptep);flush_tlb_range (&vma, saddr, addr); }
Signature · 1 line
2.30.2
I wrote wrong Kefeng's email address before, correct it now.
Quoted 25 lines · Qi Zheng
From: Qi Zheng <[email protected]>
In
clear_flush(), the original pte may be a present entry, so we should useptep_clear()to letpage_table_checktrack the pte clearing operation, otherwise it may cause false positive in subsequentset_pte_at().Fixes 42b2547137f5 ("arm64/mm: enable ARCH_SUPPORTS_PAGE_TABLE_CHECK")Signed-off-by Qi Zheng <[email protected]>--- arch/arm64/mm/hugetlbpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm64/mm/hugetlbpage.c +1
-1@@ -236,7 +236,7 @@ static void clear_flush(struct mm_struct *mm,unsigned long i, saddr = addr;for (i =0 ; i < ncontig; i++, addr += pgsize, ptep++) -pte_clear (mm, addr, ptep); +ptep_clear (mm, addr, ptep);flush_tlb_range (&vma, saddr, addr); }
Will Deacon
maintainerQuoted 5 lines · Qi Zheng
From: Qi Zheng <[email protected]>
In
clear_flush(), the original pte may be a present entry, so we should useptep_clear()to letpage_table_checktrack the pte clearing operation, otherwise it may cause false positive in subsequentset_pte_at().
Isn't this true for most users of pte_clear()? There are some in the core code, so could they trigger the false positive as well?
Will
A message that is not in the archive (sent off-list or not yet received): CAOgjDMi6kTZUjEianbO670RQxJ8=JhHxkeci9NspSCRT5rPhYw@mail.gmail.com
Will Deacon
maintainerQuoted 11 lines · Qi Zheng
Will Deacon <[1][email protected]>于2023年8月11日 周五19:03写道:
On Thu, Aug 10, 2023 at 09:32:41AM +0000, Qi Zheng wrote:
> From: Qi Zheng <[2][email protected]>
>
> Inclear_flush(), the original pte may be a present entry, so we should
> useptep_clear()to letpage_table_checktrack the pte clearing operation,
> otherwise it may cause false positive in subsequentset_pte_at().
Quoted 8 lines
Isn't this true for most users of
pte_clear()? There are some in the core
code, so could they trigger the false positive as well?No, the PTE entry in other places where
pte_clear()is used is non-present PTE.
Thepage_table_checkdoes not does track the pte operation in this case, so it will not cause false positives.
Are you sure? For example, the call from flush_all_zero_pkmaps() in highmem.c really looks like it's clearing a valid entry. Not that arm64 cares about highmem, but still.
Will
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
A message that is not in the archive (sent off-list or not yet received): CAOgjDMgVZXbEeA6O2yPR9N27JWCMNR3D7cgHJbmbfYYUdKF3eQ@mail.gmail.com
Quoted 25 lines · On Fri, 11 Aug 2023 19:28:41 +0800 Qi Zheng <[email protected]> wrote:
Quoted 23 lines · Will Deacon <[email protected]>于2023年8月11日 周五19:21写道:
Quoted 11 lines · Qi Zheng
Will Deacon <[1][email protected]>于2023年8月11日 周五19:03写道:
On Thu, Aug 10, 2023 at 09:32:41AM +0000, Qi Zheng wrote:
> From: Qi Zheng <[2][email protected]>
>
> Inclear_flush(), the original pte may be a present entry, so we should
> useptep_clear()to letpage_table_checktrack the pte clearing operation,
> otherwise it may cause false positive in subsequentset_pte_at().Quoted 5 lines
Isn't this true for most users of
pte_clear()? There are some in the core
code, so could they trigger the false positive as well?No, the PTE entry in other places where
pte_clear()is used isnon-present
Quoted 2 lines
PTE.
Thepage_table_checkdoes not does track the pte operation in thiscase,
Quoted 1 line
so it will not cause false positives.
Quoted 7 lines
Quoted 3 lines
Are you sure? For example, the call from
flush_all_zero_pkmaps()inhighmem.creally looks like it's clearing a valid entry. Not that arm64 cares about highmem, but still.Ah, this is
init_mm, not user mm,page_table_checkdoes not care about this case.
It's unclear where we stand with this patch. An ack or a nack, please?
Quoted 32 lines · Andrew Morton
Quoted 30 lines · On Fri, 11 Aug 2023 19:28:41 +0800 Qi Zheng <[email protected]> wrote:
Quoted 26 lines · Will Deacon <[email protected]>于2023年8月11日 周五19:21写道:
Quoted 11 lines · Qi Zheng
Will Deacon <[1][email protected]>于2023年8月11日 周五19:03写道:
On Thu, Aug 10, 2023 at 09:32:41AM +0000, Qi Zheng wrote:
> From: Qi Zheng <[2][email protected]>
>
> Inclear_flush(), the original pte may be a present entry, so we should
> useptep_clear()to letpage_table_checktrack the pte clearing operation,
> otherwise it may cause false positive in subsequentset_pte_at().Quoted 5 lines
Isn't this true for most users of
pte_clear()? There are some in the core
code, so could they trigger the false positive as well?No, the PTE entry in other places where
pte_clear()is used isnon-present
Quoted 2 lines
PTE.
Thepage_table_checkdoes not does track the pte operation in thiscase,
Quoted 1 line
so it will not cause false positives.
Are you sure? For example, the call from
flush_all_zero_pkmaps()inhighmem.creally looks like it's clearing a valid entry. Not that arm64 cares about highmem, but still.
Quoted 4 lines
Quoted 2 lines
Ah, this is
init_mm, not user mm,page_table_checkdoes not care about this case.It's unclear where we stand with this patch. An ack or a nack, please?
Hi all,
Any comments or suggestions here?
Thanks,
Qi
Quoted 32 lines · Andrew Morton
Quoted 30 lines · On Fri, 11 Aug 2023 19:28:41 +0800 Qi Zheng <[email protected]> wrote:
Quoted 26 lines · Will Deacon <[email protected]>于2023年8月11日 周五19:21写道:
Quoted 11 lines · Qi Zheng
Will Deacon <[1][email protected]>于2023年8月11日 周五19:03写道:
On Thu, Aug 10, 2023 at 09:32:41AM +0000, Qi Zheng wrote:
> From: Qi Zheng <[2][email protected]>
>
> Inclear_flush(), the original pte may be a present entry, so we should
> useptep_clear()to letpage_table_checktrack the pte clearing operation,
> otherwise it may cause false positive in subsequentset_pte_at().Quoted 5 lines
Isn't this true for most users of
pte_clear()? There are some in the core
code, so could they trigger the false positive as well?No, the PTE entry in other places where
pte_clear()is used isnon-present
Quoted 2 lines
PTE.
Thepage_table_checkdoes not does track the pte operation in thiscase,
Quoted 1 line
so it will not cause false positives.
Are you sure? For example, the call from
flush_all_zero_pkmaps()inhighmem.creally looks like it's clearing a valid entry. Not that arm64 cares about highmem, but still.
Quoted 4 lines
Quoted 2 lines
Ah, this is
init_mm, not user mm,page_table_checkdoes not care about this case.It's unclear where we stand with this patch. An ack or a nack, please?
Sorry Andrew, I saw you'd queued it so I marked it as "done" on my list. I think it's fine:
Will