All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] parisc: Fix kernel panic in mem_init()
@ 2020-05-30  9:34 Helge Deller
  2020-06-01 10:54 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Helge Deller @ 2020-05-30  9:34 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman, Ben Hutchings

Dear stable kernel maintainers,
can you please apply this patch to all 3.x and 4.x stable kernels?
Based on upstream commit bf71bc16e02162388808949b179d59d0b571b965
which doesn't apply out of the box on older kernels.
-----------

The Debian kernel v5.6 triggers this kernel panic:

 Kernel panic - not syncing: Bad Address (null pointer deref?)
 Bad Address (null pointer deref?): Code=26 (Data memory access rights trap) at addr 0000000000000000
 CPU: 0 PID: 0 Comm: swapper Not tainted 5.6.0-2-parisc64 #1 Debian 5.6.14-1
  IAOQ[0]: mem_init+0xb0/0x150
  IAOQ[1]: mem_init+0xb4/0x150
  RP(r2): start_kernel+0x6c8/0x1190
 Backtrace:
  [<0000000040101ab4>] start_kernel+0x6c8/0x1190
  [<0000000040108574>] start_parisc+0x158/0x1b8

on a HP-PARISC rp3440 machine with this memory layout:
 Memory Ranges:
  0) Start 0x0000000000000000 End 0x000000003fffffff Size   1024 MB
  1) Start 0x0000004040000000 End 0x00000040ffdfffff Size   3070 MB

Fix the crash by avoiding virt_to_page() and similar functions in
mem_init() until the memory zones have been fully set up.

Signed-off-by: Helge Deller <deller@gmx.de>

diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index aae9b0d71c1e..10a52664e29f 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -607,7 +607,7 @@ void __init mem_init(void)
 			> BITS_PER_LONG);

 	high_memory = __va((max_pfn << PAGE_SHIFT));
-	set_max_mapnr(page_to_pfn(virt_to_page(high_memory - 1)) + 1);
+	set_max_mapnr(max_low_pfn);
 	free_all_bootmem();

 #ifdef CONFIG_PA11

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

* Re: [PATCH] parisc: Fix kernel panic in mem_init()
  2020-05-30  9:34 [PATCH] parisc: Fix kernel panic in mem_init() Helge Deller
@ 2020-06-01 10:54 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2020-06-01 10:54 UTC (permalink / raw)
  To: Helge Deller; +Cc: stable, Ben Hutchings

On Sat, May 30, 2020 at 11:34:02AM +0200, Helge Deller wrote:
> Dear stable kernel maintainers,
> can you please apply this patch to all 3.x and 4.x stable kernels?
> Based on upstream commit bf71bc16e02162388808949b179d59d0b571b965
> which doesn't apply out of the box on older kernels.
> -----------
> 
> The Debian kernel v5.6 triggers this kernel panic:
> 
>  Kernel panic - not syncing: Bad Address (null pointer deref?)
>  Bad Address (null pointer deref?): Code=26 (Data memory access rights trap) at addr 0000000000000000
>  CPU: 0 PID: 0 Comm: swapper Not tainted 5.6.0-2-parisc64 #1 Debian 5.6.14-1
>   IAOQ[0]: mem_init+0xb0/0x150
>   IAOQ[1]: mem_init+0xb4/0x150
>   RP(r2): start_kernel+0x6c8/0x1190
>  Backtrace:
>   [<0000000040101ab4>] start_kernel+0x6c8/0x1190
>   [<0000000040108574>] start_parisc+0x158/0x1b8
> 
> on a HP-PARISC rp3440 machine with this memory layout:
>  Memory Ranges:
>   0) Start 0x0000000000000000 End 0x000000003fffffff Size   1024 MB
>   1) Start 0x0000004040000000 End 0x00000040ffdfffff Size   3070 MB
> 
> Fix the crash by avoiding virt_to_page() and similar functions in
> mem_init() until the memory zones have been fully set up.
> 
> Signed-off-by: Helge Deller <deller@gmx.de>
> 
> diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
> index aae9b0d71c1e..10a52664e29f 100644
> --- a/arch/parisc/mm/init.c
> +++ b/arch/parisc/mm/init.c
> @@ -607,7 +607,7 @@ void __init mem_init(void)
>  			> BITS_PER_LONG);
> 
>  	high_memory = __va((max_pfn << PAGE_SHIFT));
> -	set_max_mapnr(page_to_pfn(virt_to_page(high_memory - 1)) + 1);
> +	set_max_mapnr(max_low_pfn);
>  	free_all_bootmem();
> 
>  #ifdef CONFIG_PA11

Now queued up, thanks!

greg k-h


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

* [PATCH] parisc: Fix kernel panic in mem_init()
@ 2020-05-28 20:29 Helge Deller
  0 siblings, 0 replies; 3+ messages in thread
From: Helge Deller @ 2020-05-28 20:29 UTC (permalink / raw)
  To: linux-parisc, James Bottomley, John David Anglin

On a HP-PARISC rp3440 machine with this memory layout:
 Memory Ranges:
  0) Start 0x0000000000000000 End 0x000000003fffffff Size   1024 MB
  1) Start 0x0000004040000000 End 0x00000040ffdfffff Size   3070 MB

the Debian kernel v5.6 triggers a kernel panic:

 Kernel panic - not syncing: Bad Address (null pointer deref?)
 Backtrace:
  [<0000000040101ab4>] start_kernel+0x6c8/0x1190
  [<0000000040108574>] start_parisc+0x158/0x1b8

 Bad Address (null pointer deref?): Code=26 (Data memory access rights trap) at addr 0000000000000000
 CPU: 0 PID: 0 Comm: swapper Not tainted 5.6.0-2-parisc64 #1 Debian 5.6.14-1
 Hardware name: 9000/800/rp3440

  IAOQ[0]: mem_init+0xb0/0x150
  IAOQ[1]: mem_init+0xb4/0x150
  RP(r2): start_kernel+0x6c8/0x1190
 Backtrace:
  [<0000000040101ab4>] start_kernel+0x6c8/0x1190
  [<0000000040108574>] start_parisc+0x158/0x1b8

During memory initialization in mem_init() the memory zomes have not been set
up yet, so avoid using virt_to_page() and similar functions.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org # v5.0+


diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 5224fb38d766..0904542966a2 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -562,7 +562,8 @@ void __init mem_init(void)
 			> BITS_PER_LONG);

 	high_memory = __va((max_pfn << PAGE_SHIFT));
-	set_max_mapnr(page_to_pfn(virt_to_page(high_memory - 1)) + 1);
+	set_max_mapnr(max_low_pfn);
+
 	memblock_free_all();

 #ifdef CONFIG_PA11

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

end of thread, other threads:[~2020-06-01 10:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-30  9:34 [PATCH] parisc: Fix kernel panic in mem_init() Helge Deller
2020-06-01 10:54 ` Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2020-05-28 20:29 Helge Deller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.