public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] arm64: mm: disable PAN during caches_clean_inval_user_pou
@ 2024-01-08 13:00 Brandt, Oliver - Lenze
  2024-01-08 15:54 ` Mark Rutland
  0 siblings, 1 reply; 5+ messages in thread
From: Brandt, Oliver - Lenze @ 2024-01-08 13:00 UTC (permalink / raw)
  To: linux-arm-kernel@lists.infradead.org, will@kernel.org,
	catalin.marinas@arm.com
  Cc: linux-kernel@vger.kernel.org

Using the cacheflush() syscall from an 32-bit user-space fails when
ARM64_PAN is used. We 'll get an endless loop:

	1. executing "dc cvau, x2" results in raising an abort
	2. abort handler does not fix the reason for the abort and
	   returns to 1.

Disabling PAN for the time of the cache maintenance fixes this.

Fixes: 338d4f49d6f7 ("arm64: kernel: Add support for Privileged Access Never")
Cc: stable@vger.kernel.org
Signed-off-by: Oliver Brandt <oliver.brandt@lenze.com>
---
 arch/arm64/mm/cache.S | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S
index 503567c864fde..333c4c2baa568 100644
--- a/arch/arm64/mm/cache.S
+++ b/arch/arm64/mm/cache.S
@@ -70,10 +70,12 @@ SYM_FUNC_ALIAS(__pi_caches_clean_inval_pou, caches_clean_inval_pou)
  */
 SYM_FUNC_START(caches_clean_inval_user_pou)
 	uaccess_ttbr0_enable x2, x3, x4
+	ALTERNATIVE("nop", SET_PSTATE_PAN(0), ARM64_HAS_PAN, CONFIG_ARM64_PAN)
 
 	caches_clean_inval_pou_macro 2f
 	mov	x0, xzr
 1:
+	ALTERNATIVE("nop", SET_PSTATE_PAN(1), ARM64_HAS_PAN, CONFIG_ARM64_PAN)
 	uaccess_ttbr0_disable x1, x2
 	ret
 2:
-- 
2.43.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2024-01-09  8:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-08 13:00 [PATCH] arm64: mm: disable PAN during caches_clean_inval_user_pou Brandt, Oliver - Lenze
2024-01-08 15:54 ` Mark Rutland
2024-01-08 16:37   ` Brandt, Oliver - Lenze
2024-01-08 17:58     ` Mark Rutland
2024-01-09  8:37       ` Brandt, Oliver - Lenze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox