LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] powerpc/32: Fix hardlockup on vmap stack overflow
@ 2021-11-18  9:39 Christophe Leroy
  2021-11-25  9:34 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe Leroy @ 2021-11-18  9:39 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: Christophe Leroy, linux-kernel, linuxppc-dev, stable

Since the commit c118c7303ad5 ("powerpc/32: Fix vmap stack - Do not
activate MMU before reading task struct") a vmap stack overflow
results in a hard lockup. This is because emergency_ctx is still
addressed with its virtual address allthough data MMU is not active
anymore at that time.

Fix it by using a physical address instead.

Fixes: c118c7303ad5 ("powerpc/32: Fix vmap stack - Do not activate MMU before reading task struct")
Cc: stable@vger.kernel.org
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/kernel/head_32.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/head_32.h b/arch/powerpc/kernel/head_32.h
index 6b1ec9e3541b..349c4a820231 100644
--- a/arch/powerpc/kernel/head_32.h
+++ b/arch/powerpc/kernel/head_32.h
@@ -202,11 +202,11 @@ _ASM_NOKPROBE_SYMBOL(\name\()_virt)
 	mfspr	r1, SPRN_SPRG_THREAD
 	lwz	r1, TASK_CPU - THREAD(r1)
 	slwi	r1, r1, 3
-	addis	r1, r1, emergency_ctx@ha
+	addis	r1, r1, emergency_ctx-PAGE_OFFSET@ha
 #else
-	lis	r1, emergency_ctx@ha
+	lis	r1, emergency_ctx-PAGE_OFFSET@ha
 #endif
-	lwz	r1, emergency_ctx@l(r1)
+	lwz	r1, emergency_ctx-PAGE_OFFSET@l(r1)
 	addi	r1, r1, THREAD_SIZE - INT_FRAME_SIZE
 	EXCEPTION_PROLOG_2 0 vmap_stack_overflow
 	prepare_transfer_to_handler
-- 
2.33.1


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

* Re: [PATCH] powerpc/32: Fix hardlockup on vmap stack overflow
  2021-11-18  9:39 [PATCH] powerpc/32: Fix hardlockup on vmap stack overflow Christophe Leroy
@ 2021-11-25  9:34 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2021-11-25  9:34 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Michael Ellerman, Paul Mackerras,
	Christophe Leroy
  Cc: linuxppc-dev, linux-kernel, stable

On Thu, 18 Nov 2021 10:39:53 +0100, Christophe Leroy wrote:
> Since the commit c118c7303ad5 ("powerpc/32: Fix vmap stack - Do not
> activate MMU before reading task struct") a vmap stack overflow
> results in a hard lockup. This is because emergency_ctx is still
> addressed with its virtual address allthough data MMU is not active
> anymore at that time.
> 
> Fix it by using a physical address instead.
> 
> [...]

Applied to powerpc/fixes.

[1/1] powerpc/32: Fix hardlockup on vmap stack overflow
      https://git.kernel.org/powerpc/c/5bb60ea611db1e04814426ed4bd1c95d1487678e

cheers

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

end of thread, other threads:[~2021-11-25  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18  9:39 [PATCH] powerpc/32: Fix hardlockup on vmap stack overflow Christophe Leroy
2021-11-25  9:34 ` Michael Ellerman

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).