From nobody Tue Feb 10 03:15:58 2026 Received: from mail-10628.protonmail.ch (mail-10628.protonmail.ch [79.135.106.28]) (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 44B3137BE7E for ; Mon, 12 Jan 2026 17:28:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.135.106.28 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768238918; cv=none; b=ipmmxAPu0n0mrCoM3wgY2gV6oFa+3i3fKiiiq1r/Xpd7ghPCMc3slhuw4X8xGYK+qD/cDyrfT52UdEA7AznChvXYS+jwPUCXCcxHAPHM8/tK8bFd5qNImNz6kWIB+iAE/waTE/WGqLdtDU+JPErfclwZuLkhK8wMdBgutTeTYfU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768238918; c=relaxed/simple; bh=mdgk9M23toUSSdVjaABscn4nritKLnqb4cFgULxtoho=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nwW4kIanSnuqgaqaoPJPvuRmOci44yCEbUdEXRGpm4JHpsT42hj5I9m2EvJQ5+pwEzcy+51PXQIahi3XBdHvTejDYuqY971IiaZBCI25JQxnSnCout56NR0PldVyLazFjNlYExWm70B9S/hxNuqX9vKTwYfuC+LHaAivyurwqqI= 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=Mz3lwR5F; arc=none smtp.client-ip=79.135.106.28 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="Mz3lwR5F" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1768238905; x=1768498105; bh=aRRLcM1Q5eZzMoX1A6R6c/uTaz4KswX3LOgQlrenxtQ=; 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=Mz3lwR5FN5Jg6SuNhhhuaft0NwPkVkAb4k+T8GF5Nb0VEMlQubO5AMjPwPzoXZ3+j vvBucl3JF2xYYGLuN5YwyDUaSEsZS0UqtSOvEDb/Cnjd9JEFBoSn3hhFupSbvkwk7J snmkB2nqD3tFqGqaYKS3Lli2HKktDp5A9NuTooxCN5KuEYfkfriF8wZUo3ca1HKHpL 1QTfcWg/XqM7AbH7+zWNvXNypzRTIx9uj0XW+IB8NyqbszjYY1CQnZeXaWY6T9rC2y cXVx6V2goWqSzHHfMXayVdUoXMKoZijzbUkW7UdFA4d9OwAZnEwEhjjcJxAccBirDd XyzdM7oGcTnGQ== Date: Mon, 12 Jan 2026 17:28:19 +0000 To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" From: Maciej Wieczor-Retman Cc: m.wieczorretman@pm.me, Maciej Wieczor-Retman , Andrey Konovalov , linux-kernel@vger.kernel.org Subject: [PATCH v8 11/14] x86: Minimal SLAB alignment Message-ID: <1e1283ac47effe841f37b6a877842a7bf1948abe.1768233085.git.m.wieczorretman@pm.me> In-Reply-To: References: Feedback-ID: 164464600:user:proton X-Pm-Message-ID: 664d84d79fc31bfc3bbc0bbed45ff5fc4e06d605 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 8 byte minimal SLAB alignment interferes with KASAN's granularity of 16 bytes. It causes a lot of out-of-bounds errors for unaligned 8 byte allocations. Compared to a kernel with KASAN disabled, the memory footprint increases because all kmalloc-8 allocations now are realized as kmalloc-16, which has twice the object size. But more meaningfully, when compared to a kernel with generic KASAN enabled, there is no difference. Because of redzones in generic KASAN, kmalloc-8' and kmalloc-16' object size is the same (48 bytes). So changing the minimal SLAB alignment of the tag-based mode doesn't have any negative impact when compared to the other software KASAN mode. Adjust x86 minimal SLAB alignment to match KASAN granularity size. Signed-off-by: Maciej Wieczor-Retman Reviewed-by: Andrey Konovalov --- Changelog v6: - Add Andrey's Reviewed-by tag. Changelog v4: - Extend the patch message with some more context and impact information. Changelog v3: - Fix typo in patch message 4 -> 16. - Change define location to arch/x86/include/asm/cache.c. arch/x86/include/asm/cache.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/include/asm/cache.h b/arch/x86/include/asm/cache.h index 69404eae9983..3232583b5487 100644 --- a/arch/x86/include/asm/cache.h +++ b/arch/x86/include/asm/cache.h @@ -21,4 +21,8 @@ #endif #endif =20 +#ifdef CONFIG_KASAN_SW_TAGS +#define ARCH_SLAB_MINALIGN (1ULL << KASAN_SHADOW_SCALE_SHIFT) +#endif + #endif /* _ASM_X86_CACHE_H */ --=20 2.52.0