From nobody Sun Dec 14 17:56:10 2025 Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64DE1328B44 for ; Wed, 10 Dec 2025 17:30:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765387820; cv=none; b=sRArQK0LEjWa/nOW5hlym1DRMI2UQhkFEUDuF6rQMkjVfck9pQ8mCZaSNJ/jlzMizmbTmi9+8aVinMI3Iu2nZUEtKUaWkx2R/Dy2VuYTgE18HJRraIRehlNcUcukQLCnRq/vfsBuTBz5J4/1nX9EVtbwgSe0xVumatDj0TcjFsg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765387820; c=relaxed/simple; bh=3Oprj88zPy/HKcL66codnIh/vLkQGX+Lp4FrXVTBmDQ=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GXKHC4SUl+QIgMWzecCVIihnULhDdvvzBM3cfyFeeqKQs4npxaJwbOKSMHI3jv/0OkWAo1Y/BTBNO+55cnY/N+mfl3RoT9IcMpFOAPHFFiRi5qwG5DHUtSWel7M+03MQWjxj/8xrQZrCIgEy6RNi/M8CLX9g9P7HD/0O5CUTuiw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me; spf=pass smtp.mailfrom=pm.me; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b=YcCGlnGi; arc=none smtp.client-ip=185.70.43.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pm.me Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b="YcCGlnGi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1765387815; x=1765647015; bh=3Oprj88zPy/HKcL66codnIh/vLkQGX+Lp4FrXVTBmDQ=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=YcCGlnGiX5NotnVIYBB4fzVizI4bXwHMZUEvypahJhnjeOKJ7Ph/UhwJtMMdC2OfC PeLd42p7trlGuXPYNbTCuUqngYqcnIWutQSUqxhiiavPrE238p8DiXRD0CugIGZF2v zw8q5hInGEJPPY6DnpYJNxXoy/V/VpynTyQu+6jsO09gDpXcjtB5WXcuIcNvwy2S5T dGkE28nfOAaVjP4IzECPasRNyG1P8uDddzAPNzmT/qaknggKpgryK8OxHunO5nOost tixi8RKrHqW7l5Jy3tGzCRerl0/KGedoC6ma4ceKH4rxaV2l4k5CfbnPBTzzIFfYhz UX0YS/ZLf6Tqg== Date: Wed, 10 Dec 2025 17:30:10 +0000 To: Catalin Marinas , Will Deacon From: Maciej Wieczor-Retman Cc: m.wieczorretman@pm.me, Maciej Wieczor-Retman , Alexander Potapenko , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 13/15] arm64: Unify software tag-based KASAN inline recovery path Message-ID: <3cb831d9ec43485b42b2c6ff765367c4a92c5d5f.1765386422.git.m.wieczorretman@pm.me> In-Reply-To: References: Feedback-ID: 164464600:user:proton X-Pm-Message-ID: caf63166bb826a0dbdb440310f4a58afdeedfcd3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Maciej Wieczor-Retman To avoid having a copy of a long comment explaining the intricacies of the inline KASAN recovery system and issues for every architecture that uses the software tag-based mode, a unified kasan_die_unless_recover() function was added. Use kasan_die_unless_recover() in the kasan brk handler to cleanup the long comment, that's kept in the non-arch KASAN code. Signed-off-by: Maciej Wieczor-Retman Acked-by: Catalin Marinas Acked-by: Alexander Potapenko --- Changelog v7: - Add Alexander's Acked-by tag. Changelog v6: - Add Catalin's Acked-by tag. Changelog v5: - Split arm64 portion of patch 13/18 into this one. (Peter Zijlstra) arch/arm64/kernel/traps.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index 681939ef5d16..b1efc11c3b5a 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -1071,22 +1071,7 @@ int kasan_brk_handler(struct pt_regs *regs, unsigned= long esr) =20 kasan_report(addr, size, write, pc); =20 - /* - * The instrumentation allows to control whether we can proceed after - * a crash was detected. This is done by passing the -recover flag to - * the compiler. Disabling recovery allows to generate more compact - * code. - * - * Unfortunately disabling recovery doesn't work for the kernel right - * now. KASAN reporting is disabled in some contexts (for example when - * the allocator accesses slab object metadata; this is controlled by - * current->kasan_depth). All these accesses are detected by the tool, - * even though the reports for them are not printed. - * - * This is something that might be fixed at some point in the future. - */ - if (!recover) - die("Oops - KASAN", regs, esr); + kasan_die_unless_recover(recover, "Oops - KASAN", regs, esr, die); =20 /* If thread survives, skip over the brk instruction and continue: */ arm64_skip_faulting_instruction(regs, AARCH64_INSN_SIZE); --=20 2.52.0