linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cleanup vmalloc_fault for 64bit kernel
@ 2009-08-31 13:28 Wu Fei
  2009-09-09 15:35 ` David Daney
  0 siblings, 1 reply; 3+ messages in thread
From: Wu Fei @ 2009-08-31 13:28 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips

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.

Signed-off-by: Wu Fei <at.wufei@gmail.com>
---
 arch/mips/mm/fault.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index f956ecb..e769789 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -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
 }
-- 
1.6.4.rc1

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

* Re: [PATCH] cleanup vmalloc_fault for 64bit kernel
  2009-08-31 13:28 [PATCH] cleanup vmalloc_fault for 64bit kernel Wu Fei
@ 2009-09-09 15:35 ` David Daney
  2009-09-10 11:42   ` Wu Fei
  0 siblings, 1 reply; 3+ messages in thread
From: David Daney @ 2009-09-09 15:35 UTC (permalink / raw)
  To: Wu Fei; +Cc: Ralf Baechle, linux-mips

Wu Fei wrote:
> 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.
> 
> Signed-off-by: Wu Fei <at.wufei@gmail.com>
> ---
>  arch/mips/mm/fault.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
> index f956ecb..e769789 100644
> --- a/arch/mips/mm/fault.c
> +++ b/arch/mips/mm/fault.c
> @@ -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
>  

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: 
<1251931654-21268-1-git-send-email-ddaney@caviumnetworks.com>

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



>  	/*
> @@ -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
>  }

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

* Re: [PATCH] cleanup vmalloc_fault for 64bit kernel
  2009-09-09 15:35 ` David Daney
@ 2009-09-10 11:42   ` Wu Fei
  0 siblings, 0 replies; 3+ messages in thread
From: Wu Fei @ 2009-09-10 11:42 UTC (permalink / raw)
  To: David Daney; +Cc: Ralf Baechle, linux-mips

On Wed, Sep 09, 2009 at 08:35:26AM -0700, David Daney wrote:
> Wu Fei wrote:
>> 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.
>>
>> Signed-off-by: Wu Fei <at.wufei@gmail.com>
>> ---
>>  arch/mips/mm/fault.c |    6 +++---
>>  1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
>> index f956ecb..e769789 100644
>> --- a/arch/mips/mm/fault.c
>> +++ b/arch/mips/mm/fault.c
>> @@ -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
>>  
>
> 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.

> as I did in my patch: Message-Id:  
> <1251931654-21268-1-git-send-email-ddaney@caviumnetworks.com>
>
> AKA: [PATCH] MIPS: Don't corrupt page tables on vmalloc fault.
>
>
>
>>  	/*
>> @@ -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
>>  }
>

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

end of thread, other threads:[~2009-09-10 11:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-31 13:28 [PATCH] cleanup vmalloc_fault for 64bit kernel Wu Fei
2009-09-09 15:35 ` David Daney
2009-09-10 11:42   ` Wu Fei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).