Re: [PATCH] powerpc: booke: fix boot crash due to null hugepd

2017-05-17 Thread Laurentiu Tudor
Hi Greg,

On 05/17/2017 12:15 PM, Greg KH wrote:
> On Tue, May 16, 2017 at 09:47:52AM -0500, laurentiu.tu...@nxp.com wrote:
>> From: Laurentiu Tudor 
>>
>> On 32-bit book-e machines, hugepd_ok() does not take
>> into account null hugepd values, causing this crash at boot:
>>
>
> $ ./scripts/get_maintainer.pl --file arch/powerpc/include/asm/nohash/pgtable.h
> Benjamin Herrenschmidt  (supporter:LINUX FOR 
> POWERPC (32-BIT AND 64-BIT))
> Paul Mackerras  (supporter:LINUX FOR POWERPC (32-BIT AND 
> 64-BIT))
> Michael Ellerman  (supporter:LINUX FOR POWERPC (32-BIT 
> AND 64-BIT),commit_signer:2/3=67%)
> "Aneesh Kumar K.V"  
> (commit_signer:2/3=67%,authored:1/3=33%,added_lines:3/8=38%,removed_lines:2/3=67%)
> Scott Wood  (commit_signer:1/3=33%)
> Laurentiu Tudor  
> (commit_signer:1/3=33%,authored:1/3=33%,added_lines:1/8=12%,removed_lines:1/3=33%)
> Christophe Leroy  
> (commit_signer:1/3=33%,authored:1/3=33%,added_lines:4/8=50%)
> linuxppc-...@lists.ozlabs.org (open list:LINUX FOR POWERPC (32-BIT AND 
> 64-BIT))
> linux-ker...@vger.kernel.org (open list)
>
> I'm not listed there at all, any specific reason you sent this to me?
> Nothing I can do with it...
>

Just some finger trouble on my side. Please disregard and sorry for the 
noise.

---
Best Regards, Laurentiu
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] powerpc: booke: fix boot crash due to null hugepd

2017-05-17 Thread Greg KH
On Tue, May 16, 2017 at 09:47:52AM -0500, laurentiu.tu...@nxp.com wrote:
> From: Laurentiu Tudor 
> 
> On 32-bit book-e machines, hugepd_ok() does not take
> into account null hugepd values, causing this crash at boot:
> 
> Unable to handle kernel paging request for data at address 0x8000
> Faulting instruction address: 0xc00182a8
> Oops: Kernel access of bad area, sig: 11 [#1]
> SMP NR_CPUS=24
> CoreNet Generic
> Modules linked in:
> CPU: 1 PID: 1 Comm: swapper/0 Tainted: GW   
> 4.10.0-rc8-00016-g69b1f87 #11
> task: e505 task.stack: e5058000
> NIP: c00182a8 LR: c001829c CTR: 7ffe
> REGS: e5059c50 TRAP: 0300   Tainted: GW
> (4.10.0-rc8-00016-g69b1f87)
> MSR: 00021002 
>   CR: 88428e82  XER: 
> DEAR: 8000 ESR: 
> GPR00: c0107510 e5059d00 e505 8000 bff1 e5059d0c e5059d08 2017
> GPR08:     28428e82  c00027d0 
> GPR16:   88a28e82 2000 48422e82  88a28e84 dd004000
> GPR24: e5059e38   bff1 dd004000 0001 00029002 bff1
> NIP [c00182a8] follow_huge_addr+0x38/0xf0
> LR [c001829c] follow_huge_addr+0x2c/0xf0
> Call Trace:
> [e5059d00] [e5059d00] 0xe5059d00 (unreliable)
> [e5059d20] [c0107510] follow_page_mask+0x40/0x3c0
> [e5059d80] [c0107958] __get_user_pages+0xc8/0x420
> [e5059de0] [c010817c] get_user_pages_remote+0x8c/0x230
> [e5059e30] [c013f170] copy_strings+0x110/0x3a0
> [e5059ea0] [c013f42c] copy_strings_kernel+0x2c/0x50
> [e5059ec0] [c0141324] do_execveat_common+0x474/0x620
> [e5059f10] [c01414fc] do_execve+0x2c/0x40
> [e5059f20] [c0001f68] try_to_run_init_process+0x18/0x60
> [e5059f30] [c000289c] kernel_init+0xcc/0x120
> [e5059f40] [c000f1e8] ret_from_kernel_thread+0x5c/0x64
> Instruction dump:
> bfc10018 7c9f2378 90010024 7fc000a6 7c000146 80630020 38a1000c 38c10008
> 4bfff869 2c03 41c20090 81210008 <8143> 81630004 3860ffea 2f89
> ---[ end trace 4bf94e15fd9fa824 ]---
> 
> This impacts all nxp (ex-freescale) 32-bit booke platforms.
> 
> Fixes: 20717e1ff526 ("powerpc/mm: Fix little-endian 4K hugetlb")
> 
> Reported-by: Madalin-Cristian Bucur 
> Signed-off-by: Laurentiu Tudor 
> ---
>  arch/powerpc/include/asm/nohash/pgtable.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/include/asm/nohash/pgtable.h 
> b/arch/powerpc/include/asm/nohash/pgtable.h
> index 0cd8a38..e5805ad 100644
> --- a/arch/powerpc/include/asm/nohash/pgtable.h
> +++ b/arch/powerpc/include/asm/nohash/pgtable.h
> @@ -230,7 +230,7 @@ static inline int hugepd_ok(hugepd_t hpd)
>   return ((hpd_val(hpd) & 0x4) != 0);
>  #else
>   /* We clear the top bit to indicate hugepd */
> - return ((hpd_val(hpd) & PD_HUGE) ==  0);
> + return (hpd_val(hpd) && (hpd_val(hpd) & PD_HUGE) == 0);
>  #endif
>  }
>  

$ ./scripts/get_maintainer.pl --file arch/powerpc/include/asm/nohash/pgtable.h
Benjamin Herrenschmidt  (supporter:LINUX FOR POWERPC 
(32-BIT AND 64-BIT))
Paul Mackerras  (supporter:LINUX FOR POWERPC (32-BIT AND 
64-BIT))
Michael Ellerman  (supporter:LINUX FOR POWERPC (32-BIT AND 
64-BIT),commit_signer:2/3=67%)
"Aneesh Kumar K.V"  
(commit_signer:2/3=67%,authored:1/3=33%,added_lines:3/8=38%,removed_lines:2/3=67%)
Scott Wood  (commit_signer:1/3=33%)
Laurentiu Tudor  
(commit_signer:1/3=33%,authored:1/3=33%,added_lines:1/8=12%,removed_lines:1/3=33%)
Christophe Leroy  
(commit_signer:1/3=33%,authored:1/3=33%,added_lines:4/8=50%)
linuxppc-...@lists.ozlabs.org (open list:LINUX FOR POWERPC (32-BIT AND 64-BIT))
linux-ker...@vger.kernel.org (open list)

I'm not listed there at all, any specific reason you sent this to me?
Nothing I can do with it...

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] powerpc: booke: fix boot crash due to null hugepd

2017-05-16 Thread laurentiu.tudor
From: Laurentiu Tudor 

On 32-bit book-e machines, hugepd_ok() does not take
into account null hugepd values, causing this crash at boot:

Unable to handle kernel paging request for data at address 0x8000
Faulting instruction address: 0xc00182a8
Oops: Kernel access of bad area, sig: 11 [#1]
SMP NR_CPUS=24
CoreNet Generic
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Tainted: GW   
4.10.0-rc8-00016-g69b1f87 #11
task: e505 task.stack: e5058000
NIP: c00182a8 LR: c001829c CTR: 7ffe
REGS: e5059c50 TRAP: 0300   Tainted: GW
(4.10.0-rc8-00016-g69b1f87)
MSR: 00021002 
  CR: 88428e82  XER: 
DEAR: 8000 ESR: 
GPR00: c0107510 e5059d00 e505 8000 bff1 e5059d0c e5059d08 2017
GPR08:     28428e82  c00027d0 
GPR16:   88a28e82 2000 48422e82  88a28e84 dd004000
GPR24: e5059e38   bff1 dd004000 0001 00029002 bff1
NIP [c00182a8] follow_huge_addr+0x38/0xf0
LR [c001829c] follow_huge_addr+0x2c/0xf0
Call Trace:
[e5059d00] [e5059d00] 0xe5059d00 (unreliable)
[e5059d20] [c0107510] follow_page_mask+0x40/0x3c0
[e5059d80] [c0107958] __get_user_pages+0xc8/0x420
[e5059de0] [c010817c] get_user_pages_remote+0x8c/0x230
[e5059e30] [c013f170] copy_strings+0x110/0x3a0
[e5059ea0] [c013f42c] copy_strings_kernel+0x2c/0x50
[e5059ec0] [c0141324] do_execveat_common+0x474/0x620
[e5059f10] [c01414fc] do_execve+0x2c/0x40
[e5059f20] [c0001f68] try_to_run_init_process+0x18/0x60
[e5059f30] [c000289c] kernel_init+0xcc/0x120
[e5059f40] [c000f1e8] ret_from_kernel_thread+0x5c/0x64
Instruction dump:
bfc10018 7c9f2378 90010024 7fc000a6 7c000146 80630020 38a1000c 38c10008
4bfff869 2c03 41c20090 81210008 <8143> 81630004 3860ffea 2f89
---[ end trace 4bf94e15fd9fa824 ]---

This impacts all nxp (ex-freescale) 32-bit booke platforms.

Fixes: 20717e1ff526 ("powerpc/mm: Fix little-endian 4K hugetlb")

Reported-by: Madalin-Cristian Bucur 
Signed-off-by: Laurentiu Tudor 
---
 arch/powerpc/include/asm/nohash/pgtable.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/nohash/pgtable.h 
b/arch/powerpc/include/asm/nohash/pgtable.h
index 0cd8a38..e5805ad 100644
--- a/arch/powerpc/include/asm/nohash/pgtable.h
+++ b/arch/powerpc/include/asm/nohash/pgtable.h
@@ -230,7 +230,7 @@ static inline int hugepd_ok(hugepd_t hpd)
return ((hpd_val(hpd) & 0x4) != 0);
 #else
/* We clear the top bit to indicate hugepd */
-   return ((hpd_val(hpd) & PD_HUGE) ==  0);
+   return (hpd_val(hpd) && (hpd_val(hpd) & PD_HUGE) == 0);
 #endif
 }
 
-- 
1.8.3.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel