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 9FD6037F74C for ; Tue, 17 Mar 2026 09:23:48 +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=1773739428; cv=none; b=doSdLwi/JjVRISvVFBqbDBxRNUGDadC0OzpTMRTzHKTTBWhAj7FNya2UhFaf+P7L5mpgiSFw7mzgclujuXMuqnjA+LG5UXueuNmKORDdBdIqTVKc+trzUeTugK8iJ53Ogt+ogatWakrptGhbdyyf2pPXiKdoGCkK65F+Iw22EAU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773739428; c=relaxed/simple; bh=6ecQGUgV275nsR7UI3ASybysUwo+CP/vm/F/N0BbbzU=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=n/19j76Gzp8uNbOwUWKny1xUXlZPfytR1U9ncvpFouRL25INi2SpEAcGd/zmzj6HN6pnQUN+7Fwm+b4sM73T62o7ngDSXA4YFzrtelpqcNVaVxlTTzsCvCKUZDHnL0TSnWh4tniy6fzZqX8EW0jre7i4M6P+oAfhGcZRFKTe9fE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=l28lA2cZ; 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="l28lA2cZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CDBFC4CEF7; Tue, 17 Mar 2026 09:23:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1773739428; bh=6ecQGUgV275nsR7UI3ASybysUwo+CP/vm/F/N0BbbzU=; h=Subject:To:Cc:From:Date:From; b=l28lA2cZ551mDeGQxRcjSn7YQkBLtD6xuaDl4bsErIOYBgDtDdZc4rYGIsswhbxBI ai4R/Xh3t63L7JekqHlFo6Xac1VSkH8iShRcwaQHFbsmZ6d/WKdmQq41diNVvJkQ4c l5eu3zxKtcRt3lrh+57Mo8Wwhu173cDQzFawaZZk= Subject: FAILED: patch "[PATCH] mm/kfence: disable KFENCE upon KASAN HW tags enablement" failed to apply to 6.1-stable tree To: glider@google.com,akpm@linux-foundation.org,andreyknvl@gmail.com,dvyukov@google.com,elver@google.com,ernesto.martinezgarcia@tugraz.at,gregkh@linuxfoundation.org,kees@kernel.org,ryabinin.a.a@gmail.com,stable@vger.kernel.org Cc: From: Date: Tue, 17 Mar 2026 10:23:43 +0100 Message-ID: <2026031743-sixth-control-6db4@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x 09833d99db36d74456a4d13eb29c32d56ff8f2b6 # git commit -s git send-email --to '' --in-reply-to '2026031743-sixth-control-6db4@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 09833d99db36d74456a4d13eb29c32d56ff8f2b6 Mon Sep 17 00:00:00 2001 From: Alexander Potapenko Date: Fri, 13 Feb 2026 10:54:10 +0100 Subject: [PATCH] mm/kfence: disable KFENCE upon KASAN HW tags enablement KFENCE does not currently support KASAN hardware tags. As a result, the two features are incompatible when enabled simultaneously. Given that MTE provides deterministic protection and KFENCE is a sampling-based debugging tool, prioritize the stronger hardware protections. Disable KFENCE initialization and free the pre-allocated pool if KASAN hardware tags are detected to ensure the system maintains the security guarantees provided by MTE. Link: https://lkml.kernel.org/r/20260213095410.1862978-1-glider@google.com Fixes: 0ce20dd84089 ("mm: add Kernel Electric-Fence infrastructure") Signed-off-by: Alexander Potapenko Suggested-by: Marco Elver Reviewed-by: Marco Elver Cc: Andrey Konovalov Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Ernesto Martinez Garcia Cc: Greg KH Cc: Kees Cook Cc: Signed-off-by: Andrew Morton diff --git a/mm/kfence/core.c b/mm/kfence/core.c index b4ea3262c925..b5aedf505cec 100644 --- a/mm/kfence/core.c +++ b/mm/kfence/core.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -916,6 +917,20 @@ void __init kfence_alloc_pool_and_metadata(void) if (!kfence_sample_interval) return; + /* + * If KASAN hardware tags are enabled, disable KFENCE, because it + * does not support MTE yet. + */ + if (kasan_hw_tags_enabled()) { + pr_info("disabled as KASAN HW tags are enabled\n"); + if (__kfence_pool) { + memblock_free(__kfence_pool, KFENCE_POOL_SIZE); + __kfence_pool = NULL; + } + kfence_sample_interval = 0; + return; + } + /* * If the pool has already been initialized by arch, there is no need to * re-allocate the memory pool.