From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 65562EAD0; Fri, 15 Nov 2024 06:49:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731653377; cv=none; b=Hs89ADpieGTvmll15iH64/7xoy7x2F4JEU0fMwTPJDtyGQe01deRDapsTkzXTHD2duW3of7UtB3RbsJLu59MQ6R4LjHaItqWTJq29tuE6olSnNFFFp0n+k/eZ0e0ZGlwA63xvOyUmipmjTFVGCR+Fd6bjj+qf8zRX8SykJqChz8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731653377; c=relaxed/simple; bh=D+JBbS9f0bakIlo/6JwYJ0a/daGZb9WMmwO2oJI1kYg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hF67cklp/2rHEfKCKAp1mA3APeBPORHMJcA33TEkPh9ZixzQzDGyD+9fA3/O954e1cXf2HFVUtJqHCG22KH+uODBO1j8ZiJcJ+MtsMn+r0+c0WxCUEV6dohtOJkmsFCxy/v4MAWkxC/f+6oOLC/nW8A0/1G6SdjJx34j9GR5lLI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hgAUts2n; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="hgAUts2n" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C80D8C4CECF; Fri, 15 Nov 2024 06:49:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1731653377; bh=D+JBbS9f0bakIlo/6JwYJ0a/daGZb9WMmwO2oJI1kYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hgAUts2nT7r+AjMnX7xJ9zqMYQ9wGH3k/z7YE+tGW+PFikSnlLTXzgkcdl2Cb5QH4 5gM7RoglqaknDeRw9n6DPze/++RB31dSAuV9HKlBibuj4XWNifS1KzcEjq+HftrTMR mcDtFp8ratZz38nK7CAlv83L9oM1MXgGNUQeykPo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andrey Konovalov , Mark Rutland , syzbot+908886656a02769af987@syzkaller.appspotmail.com, Will Deacon , Sasha Levin Subject: [PATCH 6.11 25/63] kasan: Disable Software Tag-Based KASAN with GCC Date: Fri, 15 Nov 2024 07:37:48 +0100 Message-ID: <20241115063726.828422420@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241115063725.892410236@linuxfoundation.org> References: <20241115063725.892410236@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.11-stable review patch. If anyone has any objections, please let me know. ------------------ From: Will Deacon [ Upstream commit 7aed6a2c51ffc97a126e0ea0c270fab7af97ae18 ] Syzbot reports a KASAN failure early during boot on arm64 when building with GCC 12.2.0 and using the Software Tag-Based KASAN mode: | BUG: KASAN: invalid-access in smp_build_mpidr_hash arch/arm64/kernel/setup.c:133 [inline] | BUG: KASAN: invalid-access in setup_arch+0x984/0xd60 arch/arm64/kernel/setup.c:356 | Write of size 4 at addr 03ff800086867e00 by task swapper/0 | Pointer tag: [03], memory tag: [fe] Initial triage indicates that the report is a false positive and a thorough investigation of the crash by Mark Rutland revealed the root cause to be a bug in GCC: > When GCC is passed `-fsanitize=hwaddress` or > `-fsanitize=kernel-hwaddress` it ignores > `__attribute__((no_sanitize_address))`, and instruments functions > we require are not instrumented. > > [...] > > All versions [of GCC] I tried were broken, from 11.3.0 to 14.2.0 > inclusive. > > I think we have to disable KASAN_SW_TAGS with GCC until this is > fixed Disable Software Tag-Based KASAN when building with GCC by making CC_HAS_KASAN_SW_TAGS depend on !CC_IS_GCC. Cc: Andrey Konovalov Suggested-by: Mark Rutland Reported-by: syzbot+908886656a02769af987@syzkaller.appspotmail.com Link: https://lore.kernel.org/r/000000000000f362e80620e27859@google.com Link: https://lore.kernel.org/r/ZvFGwKfoC4yVjN_X@J2N7QTR9R3 Link: https://bugzilla.kernel.org/show_bug.cgi?id=218854 Reviewed-by: Andrey Konovalov Acked-by: Mark Rutland Link: https://lore.kernel.org/r/20241014161100.18034-1-will@kernel.org Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- lib/Kconfig.kasan | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan index 98016e137b7f0..233ab20969242 100644 --- a/lib/Kconfig.kasan +++ b/lib/Kconfig.kasan @@ -22,8 +22,11 @@ config ARCH_DISABLE_KASAN_INLINE config CC_HAS_KASAN_GENERIC def_bool $(cc-option, -fsanitize=kernel-address) +# GCC appears to ignore no_sanitize_address when -fsanitize=kernel-hwaddress +# is passed. See https://bugzilla.kernel.org/show_bug.cgi?id=218854 (and +# the linked LKML thread) for more details. config CC_HAS_KASAN_SW_TAGS - def_bool $(cc-option, -fsanitize=kernel-hwaddress) + def_bool !CC_IS_GCC && $(cc-option, -fsanitize=kernel-hwaddress) # This option is only required for software KASAN modes. # Old GCC versions do not have proper support for no_sanitize_address. @@ -98,7 +101,7 @@ config KASAN_SW_TAGS help Enables Software Tag-Based KASAN. - Requires GCC 11+ or Clang. + Requires Clang. Supported only on arm64 CPUs and relies on Top Byte Ignore. -- 2.43.0