Skip to contentSkip to conversation

arm64: mm: Pass origial fault address to handle_mm_fault()

PATCH Applied Gavin Shan 4 participants 4 messages Jun 14, 2021 – Jun 15, 2021 arm64

lore
Share & tools
lore

Gavin Shan

author
#0 lore raw

PATCH 1/1 arm64: mm: Pass origial fault address to handle_mm_fault()

Currently, the lower bits of fault address is cleared before it's passed to handle_mm_fault(). It's unnecessary since generic code does same thing since the commit 1a29d85eb0f19 ("mm: use vmf->address instead of of vmf->virtual_address").

This passes the original fault address to handle_mm_fault() in case the generic code needs to know the exact fault address.

---
 arch/arm64/mm/fault.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/mm/fault.c +1 -1
index 871c82ab0a30..e2883237216d 100644
@@ -504,7 +504,7 @@ static vm_fault_t __do_page_fault(struct mm_struct *mm, unsigned long addr,
 	 */
 	if (!(vma->vm_flags & vm_flags))
 		return VM_FAULT_BADACCESS;
-	return handle_mm_fault(vma, addr & PAGE_MASK, mm_flags, regs);
+	return handle_mm_fault(vma, addr, mm_flags, regs);
 }
 
 static bool is_el0_instruction_abort(unsigned int esr)
Signature · 1 line
2.23.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 18 lines · Gavin Shan

Currently, the lower bits of fault address is cleared before it's passed to handle_mm_fault(). It's unnecessary since generic code does same thing since the commit 1a29d85eb0f19 ("mm: use vmf->address instead of of vmf->virtual_address").

This passes the original fault address to handle_mm_fault() in case the generic code needs to know the exact fault address.

---
 arch/arm64/mm/fault.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/mm/fault.c +0 -0
index 871c82ab0a30..e2883237216d 100644

arch/arm64/mm/fault.c static vm_fault_t __do_page_fault(struct mm_struct *mm, unsigned long addr, · line 507

Quoted 5 lines
arch/arm64/mm/fault.c +1 -1
@@ -504,7 +504,7 @@ static vm_fault_t __do_page_fault(struct mm_struct *mm, unsigned long addr,
 	 */
 	if (!(vma->vm_flags & vm_flags))
 		return VM_FAULT_BADACCESS;
-	return handle_mm_fault(vma, addr & PAGE_MASK, mm_flags, regs);
+	return handle_mm_fault(vma, addr, mm_flags, regs);

This seems to match most of the other architectures (arch/arm also masks out the bottom bits). So:

Reviewed-by on v1 1/1
#2 lore raw
In reply to Gavin Shan
Quoted 19 lines · Gavin Shan

Currently, the lower bits of fault address is cleared before it's passed to handle_mm_fault(). It's unnecessary since generic code does same thing since the commit 1a29d85eb0f19 ("mm: use vmf->address instead of of vmf->virtual_address").

This passes the original fault address to handle_mm_fault() in case the generic code needs to know the exact fault address.

---
 arch/arm64/mm/fault.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/mm/fault.c +0 -0
index 871c82ab0a30..e2883237216d 100644

arch/arm64/mm/fault.c static vm_fault_t __do_page_fault(struct mm_struct *mm, unsigned long addr, · line 510

Quoted 8 lines
arch/arm64/mm/fault.c +1 -1
@@ -504,7 +504,7 @@ static vm_fault_t __do_page_fault(struct mm_struct *mm, unsigned long addr,
 	 */
 	if (!(vma->vm_flags & vm_flags))
 		return VM_FAULT_BADACCESS;
-	return handle_mm_fault(vma, addr & PAGE_MASK, mm_flags, regs);
+	return handle_mm_fault(vma, addr, mm_flags, regs);
 }
 
 static bool is_el0_instruction_abort(unsigned int esr)

FWIW

maintainer Applied
#3 lore raw
In reply to Gavin Shan
Quoted 7 lines · Gavin Shan

Currently, the lower bits of fault address is cleared before it's passed to handle_mm_fault(). It's unnecessary since generic code does same thing since the commit 1a29d85eb0f19 ("mm: use vmf->address instead of of vmf->virtual_address").

This passes the original fault address to handle_mm_fault() in case the generic code needs to know the exact fault address.

Applied to arm64 (for-next/mm), thanks!

[1/1] arm64: mm: Pass origial fault address to handle_mm_fault()

      https://git.kernel.org/arm64/c/84c5e23edecd

Cheers,

Signature · 5 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev