linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] mm: arm64: advance pte for contpte_ptep_set_access_flags
@ 2024-08-31  8:35 Barry Song
  2024-08-31  9:54 ` David Hildenbrand
  0 siblings, 1 reply; 8+ messages in thread
From: Barry Song @ 2024-08-31  8:35 UTC (permalink / raw)
  To: akpm, linux-mm
  Cc: linux-arm-kernel, Barry Song, Ard Biesheuvel, John Hubbard,
	Mark Rutland, Catalin Marinas, David Hildenbrand, Will Deacon

From: Barry Song <v-songbaohua@oppo.com>

Hi Ryan, David,
it seems contpte_ptep_set_access_flags() has never advanced
pte pfn, and it is setting all entries' pfn to the first
subpage. But I feel quite strange we never have a bug reported.
Am I missing something?

Fixes: 4602e5757bcc ("arm64/mm: wire up PTE_CONT for user mappings")
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Barry Song <v-songbaohua@oppo.com>
---
 arch/arm64/mm/contpte.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/mm/contpte.c b/arch/arm64/mm/contpte.c
index a3edced29ac1..10dcd2641184 100644
--- a/arch/arm64/mm/contpte.c
+++ b/arch/arm64/mm/contpte.c
@@ -421,8 +421,10 @@ int contpte_ptep_set_access_flags(struct vm_area_struct *vma,
 		ptep = contpte_align_down(ptep);
 		start_addr = addr = ALIGN_DOWN(addr, CONT_PTE_SIZE);
 
-		for (i = 0; i < CONT_PTES; i++, ptep++, addr += PAGE_SIZE)
+		for (i = 0; i < CONT_PTES; i++, ptep++, addr += PAGE_SIZE) {
 			__ptep_set_access_flags(vma, addr, ptep, entry, 0);
+			entry = pte_advance_pfn(entry, 1);
+		}
 
 		if (dirty)
 			__flush_tlb_range(vma, start_addr, addr,
-- 
2.39.3 (Apple Git-146)



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-09-05  8:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-31  8:35 [PATCH RFC] mm: arm64: advance pte for contpte_ptep_set_access_flags Barry Song
2024-08-31  9:54 ` David Hildenbrand
2024-08-31 10:06   ` Barry Song
2024-09-04 15:13     ` Will Deacon
2024-09-04 15:50       ` Ryan Roberts
2024-09-05  3:27         ` Barry Song
2024-09-05  7:20           ` Ryan Roberts
2024-09-05  8:10             ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox