Skip to contentSkip to conversation

cleanup vmalloc_fault for 64bit kernel

PATCH In review Wu Fei 2 participants 3 messages Aug 31, 2009 – Sep 10, 2009 MIPS

lore
Share & tools
lore

Wu Fei

author
#0 lore raw

PATCH 1/1 cleanup vmalloc_fault for 64bit kernel

64bit kernel won't arrive vmalloc_fault, it's not necessary or possible to copy the page table from init_mm.pgd. swapper_pg_dir, module_pg_dir and the process's pgd represent the different virtual address area, and the tlb exception handler accesses the suitable one directly.

---
 arch/mips/mm/fault.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
arch/mips/mm/fault.c +3 -3
index f956ecb..e769789 100644
@@ -58,11 +58,9 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
 	 * only copy the information from the master page table,
 	 * nothing more.
 	 */
+#ifdef CONFIG_32BIT
 	if (unlikely(address >= VMALLOC_START && address <= VMALLOC_END))
 		goto vmalloc_fault;
-#ifdef MODULE_START
-	if (unlikely(address >= MODULE_START && address < MODULE_END))
-		goto vmalloc_fault;
 #endif
 
 	/*
@@ -203,6 +201,7 @@ do_sigbus:
 	force_sig_info(SIGBUS, &info, tsk);
 
 	return;
+#ifdef CONFIG_32BIT
 vmalloc_fault:
 	{
 		/*
@@ -241,4 +240,5 @@ vmalloc_fault:
 			goto no_context;
 		return;
 	}
+#endif
 }
Signature · 1 line
1.6.4.rc1
#1 lore raw
Quoted 16 lines · Wu Fei

64bit kernel won't arrive vmalloc_fault, it's not necessary or possible to copy the page table from init_mm.pgd. swapper_pg_dir, module_pg_dir and the process's pgd represent the different virtual address area, and the tlb exception handler accesses the suitable one directly.

---
 arch/mips/mm/fault.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
arch/mips/mm/fault.c +0 -0
index f956ecb..e769789 100644
@@ -58,11 +58,9 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
 	 * only copy the information from the master page table,

arch/mips/mm/fault.c asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write, · line 65

Quoted 10 lines
arch/mips/mm/fault.c +1 -3
 	 * nothing more.
 	 */
+#ifdef CONFIG_32BIT
 	if (unlikely(address >= VMALLOC_START && address <= VMALLOC_END))
 		goto vmalloc_fault;
-#ifdef MODULE_START
-	if (unlikely(address >= MODULE_START && address < MODULE_END))
-		goto vmalloc_fault;
 #endif
 

That is not correct. You can still arrive at do_page_fault() from faults in the vmalloc range. We need to go directly to the panic code as I did in my patch: Message-Id: <[email protected]>

AKA: [PATCH] MIPS: Don't corrupt page tables on vmalloc fault.

Quoted 15 lines
arch/mips/mm/fault.c +2 -0
 	/*
@@ -203,6 +201,7 @@ do_sigbus:
 	force_sig_info(SIGBUS, &info, tsk);
 
 	return;
+#ifdef CONFIG_32BIT
 vmalloc_fault:
 	{
 		/*
@@ -241,4 +240,5 @@ vmalloc_fault:
 			goto no_context;
 		return;
 	}
+#endif
 }
author
#2 lore raw
Quoted 22 lines · David Daney
Quoted 21 lines · Wu Fei

64bit kernel won't arrive vmalloc_fault, it's not necessary or possible to copy the page table from init_mm.pgd. swapper_pg_dir, module_pg_dir and the process's pgd represent the different virtual address area, and the tlb exception handler accesses the suitable one directly.

---
 arch/mips/mm/fault.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
arch/mips/mm/fault.c +1 -0
index f956ecb..e769789 100644
@@ -58,11 +58,9 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
 	 * only copy the information from the master page table,
 	 * nothing more.
 	 */
+#ifdef CONFIG_32BIT
 	if (unlikely(address >= VMALLOC_START && address <= VMALLOC_END))
 		goto vmalloc_fault;
Quoted 8 lines

arch/mips/mm/fault.c asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write, · line 65

Quoted 5 lines
arch/mips/mm/fault.c +0 -3
-#ifdef MODULE_START
-	if (unlikely(address >= MODULE_START && address < MODULE_END))
-		goto vmalloc_fault;
 #endif
 

That is not correct. You can still arrive at do_page_fault() from faults in the vmalloc range. We need to go directly to the panic code

That's not a real problem, if do_page_fault() from faults in the vmalloc range, find_vma() returns NULL and eventually it will arrive no_context. But anyway, I think your patch is better and readable.

Thanks,
Wufei.

Quoted 22 lines

as I did in my patch: Message-Id:
<[email protected]>

AKA: [PATCH] MIPS: Don't corrupt page tables on vmalloc fault.

Quoted 14 lines
arch/mips/mm/fault.c +2 -0
 	/*
@@ -203,6 +201,7 @@ do_sigbus:
 	force_sig_info(SIGBUS, &info, tsk);
  	return;
+#ifdef CONFIG_32BIT
 vmalloc_fault:
 	{
 		/*
@@ -241,4 +240,5 @@ vmalloc_fault:
 			goto no_context;
 		return;
 	}
+#endif
 }