Subject: [PATCH] powerpc/kasan: Disable KCOV in KASAN code

From: Benjamin Gray <[email-masked]>
Date: Mon, 10 Jul 2023 14:41:43 +1000

As per the generic KASAN code in mm/kasan, disable KCOV with
KCOV_INSTRUMENT := n in the makefile.

This fixes a ppc64 boot hang when KCOV and KASAN are enabled.
kasan_early_init() gets called before a PACA is initialised, but the
KCOV hook expects a valid PACA.

Suggested-by: Christophe Leroy <[email-masked]>
Signed-off-by: Benjamin Gray <[email-masked]>

---

The generic makefile has other disabled sanitisers / hooks, but this
patch is just an upstream of fixing a blocking issue for running
syzkaller. The blocker is resolved by this; kernels stop hanging on boot
with KCOV + KASAN.

This works as an alternative to
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/[email-masked]/
---
 arch/powerpc/mm/kasan/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/mm/kasan/Makefile b/arch/powerpc/mm/kasan/Makefile
index 699eeffd9f55..f9522fd70b2f 100644
--- a/arch/powerpc/mm/kasan/Makefile
+++ b/arch/powerpc/mm/kasan/Makefile
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 
 KASAN_SANITIZE := n
+KCOV_INSTRUMENT := n
 
 obj-$(CONFIG_PPC32)		+= init_32.o
 obj-$(CONFIG_PPC_8xx)		+= 8xx.o
-- 
2.41.0