From patchwork Mon Nov 23 20:07:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11926621 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DF66C63697 for ; Mon, 23 Nov 2020 20:24:15 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B192220782 for ; Mon, 23 Nov 2020 20:24:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="dVlp8TeJ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="cDTXlXdO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B192220782 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version:Message-Id: In-Reply-To:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jG8kJ07j3zuDn4aI6nI8F08mtfplxpYf7P0npxNvrZ4=; b=dVlp8TeJS1MTuiZeDvScwkvHI AkiGVYqSMQUO0cRQFdVFAbxSKhHdnLgUGYsWu0R32/wI0KqO9c8LggxnH/RciwS4TzHQK/2MTuzCZ zpLj2w2fdIdJM9JwExQSh/mtYFsbeI8541nCPebhyQ5wCnfjkbR8+8g7v7D9QK5OxZEgu3vta7BGN 6PgbZ6M2bRXFZrLefJrhnOrGWHzzfzbTDBYq9Gcm1LIvZlYeq+wnXXlCCThZEyG92ZAZUtSd9R7iK gTQGFYvYh5fLi0Ny4QF8QrX3diw8rHJLcxY1gVGJM6STWYRac+n9rawNUhMpusnjwIgqPs+CmOA6D EUdqC4RNA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1khIM4-0005RK-IU; Mon, 23 Nov 2020 20:22:32 +0000 Received: from mail-wr1-x449.google.com ([2a00:1450:4864:20::449]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1khI9k-0008OX-Eo for linux-arm-kernel@lists.infradead.org; Mon, 23 Nov 2020 20:10:00 +0000 Received: by mail-wr1-x449.google.com with SMTP id v5so6288723wrr.0 for ; Mon, 23 Nov 2020 12:09:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=npUOT2sfAgaDvlkN46GsxTaKsomnY3H/Y0C/GfI83qM=; b=cDTXlXdO/vb6GqH2AwfijuMT1JYrpDmbZtJdOxCsUahYeRESOZazEwfL2QDPtQuJrB Z5GdgKHhBfsbtSQvGsnUnIBG1CC/irD2nxMHInKgpxlli72UTlAtJczt6bIY/EJuIMZv p2KdpNbSwCXIZgnskmu6aw6m+FacrQ08R4hpJ7rXQdlRbJt8t4bT7O2C8ve/Ia+tHEXY JRP4rglI1hNFkKmuGYnEhTeudT4eP/l0buo+xuvYm77PQ/T5jdtEgT0DMQqWFzAY6ISJ bVtjDp/F4fsITeajL9hrQ3z8FC5qgGetFpMzANV9L1yUjEPuYtmgsQ1h+jhW4zmyDTVS bSXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=npUOT2sfAgaDvlkN46GsxTaKsomnY3H/Y0C/GfI83qM=; b=Aq8LIVyx1Rj18c9jLjOjM8lY7ZvvDhuhExo2CIjEnTKvUEZ/D7zJEW5K2HxDWhWeUR aTIe8gN6DcYIc3AHGwTzOyTGpNZfRjTo93stlbCoZ+SeiLNtFCjEQzKRcI0LBMDwjfh6 l0/xAGLGKl3jJW4AaLQrWCqNdlv1N1BurKoDr9Ym0h3AuoQMoxRntT9yDtAoatGI06kS 7JMSonQy17D4AgJH+9MveRClpvTxMFJ6XWPpO8jYIZ5CcREBTHQau/pgUXVfQv1ioIC5 Ir064DDNj3y7ej3HvUFtd4f8cs/iDcjy7QCq0+TxSuZrGKfE+ikWpxggyu3CNECwMn8P CzAw== X-Gm-Message-State: AOAM531uID1TRP10vFunIzyjYJqL93T2oM3+1ObemrxXkxUb5mpxYGdE Kt1VLWHeMYZcpM4hnQwPSBZ6gMOLR4NcKVO2 X-Google-Smtp-Source: ABdhPJwxMLqE2NZJqFIp+jaTrGYPBNL1b2AKQeMMzDyq/h8Fv7lSH2IM5pKIBr9QQlVBq9KLlMMxWz40k7moM3q8 X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:adf:90d0:: with SMTP id i74mr1449685wri.288.1606162183048; Mon, 23 Nov 2020 12:09:43 -0800 (PST) Date: Mon, 23 Nov 2020 21:07:56 +0100 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog Subject: [PATCH mm v11 32/42] arm64: kasan: Align allocations for HW_TAGS From: Andrey Konovalov To: Andrew Morton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201123_150948_598868_92CB4BD7 X-CRM114-Status: GOOD ( 13.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, Marco Elver , Catalin Marinas , Kevin Brodsky , Will Deacon , Branislav Rankov , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexander Potapenko , Evgenii Stepanov , Andrey Konovalov , Andrey Ryabinin , Vincenzo Frascino , Dmitry Vyukov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hardware tag-based KASAN uses the memory tagging approach, which requires all allocations to be aligned to the memory granule size. Align the allocations to MTE_GRANULE_SIZE via ARCH_SLAB_MINALIGN when CONFIG_KASAN_HW_TAGS is enabled. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino Reviewed-by: Catalin Marinas Reviewed-by: Alexander Potapenko --- Change-Id: I51ebd3f9645e6330e5a92973bf7c86b62d632c2b --- arch/arm64/include/asm/cache.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h index 63d43b5f82f6..77cbbe3625f2 100644 --- a/arch/arm64/include/asm/cache.h +++ b/arch/arm64/include/asm/cache.h @@ -6,6 +6,7 @@ #define __ASM_CACHE_H #include +#include #define CTR_L1IP_SHIFT 14 #define CTR_L1IP_MASK 3 @@ -51,6 +52,8 @@ #ifdef CONFIG_KASAN_SW_TAGS #define ARCH_SLAB_MINALIGN (1ULL << KASAN_SHADOW_SCALE_SHIFT) +#elif defined(CONFIG_KASAN_HW_TAGS) +#define ARCH_SLAB_MINALIGN MTE_GRANULE_SIZE #endif #ifndef __ASSEMBLY__