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: 11926421 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.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,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 41DDFC63697 for ; Mon, 23 Nov 2020 20:09:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B8ED820715 for ; Mon, 23 Nov 2020 20:09:46 +0000 (UTC) Authentication-Results: mail.kernel.org; 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 B8ED820715 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8AACC6B00B7; Mon, 23 Nov 2020 15:09:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 858ED6B00B9; Mon, 23 Nov 2020 15:09:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F9AB6B00B7; Mon, 23 Nov 2020 15:09:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0196.hostedemail.com [216.40.44.196]) by kanga.kvack.org (Postfix) with ESMTP id 0ECFC6B00B7 for ; Mon, 23 Nov 2020 15:09:45 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A54B9180AD811 for ; Mon, 23 Nov 2020 20:09:44 +0000 (UTC) X-FDA: 77516773488.30.alley81_170070b27368 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 83138180B3C83 for ; Mon, 23 Nov 2020 20:09:44 +0000 (UTC) X-HE-Tag: alley81_170070b27368 X-Filterd-Recvd-Size: 4577 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Mon, 23 Nov 2020 20:09:44 +0000 (UTC) Received: by mail-wm1-f73.google.com with SMTP id o17so142532wmd.9 for ; Mon, 23 Nov 2020 12:09:43 -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=A5RDdsjCAZVXk5rtJYjowWWOmI8y6v9YtsY30Diu24YYMaFm5Qgz6j0DvlAieQcYBD GwBSPjji6+P4vt7FuOnYXwe+D4AEa3uBQPjJVAaeoz+la7Jd0RCbnY6eRtySRI1qy/v0 mdWz/vv+PN/K/FERquDbYsIGJsM8BFWN7gNR/IggZWGPy20JPSyDaVgZQ8dZgC/s1fbP 522b0VLpvvO/PqxQE7qn+N/YYNGXsMAx0z2GH2IiZ3+1b2wJ1WVaipYLYw2jgW8Iu+Ga /ucNyGHtBPTMBr0vvOmM2IVKIeC91pU0TdEyXh0F5ckKgW4/wTjzukNDF2/NQQ1k83HB b+Og== X-Gm-Message-State: AOAM531lPoCtnkLNGj5f8EWugRp0qYmGSYVYTJ9d+WhJWMv5mf7crbaU +fxwCmNpldC3moYp7kgXLpA3eq+Agv4wB5fj 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 Cc: Catalin Marinas , Will Deacon , Vincenzo Frascino , Dmitry Vyukov , Andrey Ryabinin , Alexander Potapenko , Marco Elver , Evgenii Stepanov , Branislav Rankov , Kevin Brodsky , kasan-dev@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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__