From patchwork Fri Nov 13 22:16:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11905039 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 C40C5C4742C for ; Fri, 13 Nov 2020 22:31:39 +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 5E3F621D7F for ; Fri, 13 Nov 2020 22:31:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uywITPMo"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="nmTDGdvS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E3F621D7F 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=90iWs84EXX0WpVWn5qZrJGDhbyCjPx/GCJVfrMUKDng=; b=uywITPMoV3AY0C/C4LG/IMni8 g2zqGdRQi6modDJCMnDm48D1S7B/rjrHBAlkAW6uZy4+7OKsHuyeT//cUjaEMR5EqzOVr2Gwa64B7 ZaYqzuP7k2IsTyAgjF0GKma52bQXMvI4TPNVbQkHGsaEY2kth2IEeCjf+gR4sfR4V/fwHT2o6NXe2 AwKUuBQrg0bhte2zjPLTbcltec18DikE11Timl4zqhPaDlf91RXkX74kREZUsPxuVSv2wyRKLNOsJ BeNQ3kQuSJiW0demOYHtoa5ih1CNTNIeJT3uKn/9ui02AFAtczbuhNZX9YCpbzJLbzRC4isrf4gAf 02/c6T1dw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdhZq-0005tP-Ks; Fri, 13 Nov 2020 22:29:54 +0000 Received: from mail-qt1-x84a.google.com ([2607:f8b0:4864:20::84a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdhNw-0000Lu-R3 for linux-arm-kernel@lists.infradead.org; Fri, 13 Nov 2020 22:17:47 +0000 Received: by mail-qt1-x84a.google.com with SMTP id z8so6620473qti.17 for ; Fri, 13 Nov 2020 14:17:34 -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=8wuQS8Ui6lRxf4z6N6Fb3Z17fSYd+0q/Aq0OIY0oU2o=; b=nmTDGdvSIrwGYCxUGHaPrQAsQ2W2CBwqJryIGskg+mWj65n2WgSj2IFrfL2X97+0Mn 6475+IfrtPqiOf5BCkXNOtKoBeqqFoPC/pnd3b79iQRoSCj2GiDrsVpJnPFi+i5GMVUk DdVqXzISQaXLCYMqPf3W+z1iS6OxRF5TF45k8DGwfoNHsbRR9beC6FvUQS7ioxxrmnHk 3bJMgxuKzw2UYDKPz12ZcAISVuCaM++4QzdeUC7LY1Av6ht1uqoK9jp2d6KEbHGo1hOX 9L6Y5vsSboEdPLpy9ABKyUxvu5BQvzyPYGMK7hKJ5OCheKNwPh59OCdZYnts8heG0Fpr LjGA== 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=8wuQS8Ui6lRxf4z6N6Fb3Z17fSYd+0q/Aq0OIY0oU2o=; b=W7FngSyFF/+kxocXinELSR6nOyiNbcIZPJfhpExxTolnLjMvsRI+fKv6sgeme4zKZ0 S9rFHVTnSXPby+LAkgmQkgvoSBkYrpZQN3vURO2D7IOzwFSdmWNS9T2LYzEW4k3AYdjn QxAKeaUITTwBQ1wQOt5thLRL6B4pfynN48qxj+KNwXAH6a3rKiW3TV8lKtcdGteGNyn2 EDwMeFSSlQyOsbBMsUj7VExkpzTzSOckpVm+Di6z2tF4grHh0ifiOL+xMdYVGZ17LsSg GqpJuky8m+yh1uKYeCHP7SuAQ2HlyY9mCpiunqr6mAm8F5p2ihbmWGKFBvghCFFj+tzg nFGg== X-Gm-Message-State: AOAM533ObRo2vHr59xF7l1BNf4kerQbpN2svBHup+n3/O1fjMXcq06VN P7hhPTUCs/6hEs8YhJntB5ghoB+dxivDtBmy X-Google-Smtp-Source: ABdhPJwm0ivH+1FvXBRCkLSjJqA80NsTUMDVrQFeZWypxtKlsu/0LKPofR4Agm76uPBYpptr5KeWeCLyPe7q6dQ9 X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a0c:c709:: with SMTP id w9mr4788537qvi.50.1605305852387; Fri, 13 Nov 2020 14:17:32 -0800 (PST) Date: Fri, 13 Nov 2020 23:16:00 +0100 In-Reply-To: Message-Id: <3d2ffcbffff7cdfe60d10493081f82205c181ba7.1605305705.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.299.gdc1121823c-goog Subject: [PATCH mm v10 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-20201113_171736_990193_732E504D X-CRM114-Status: GOOD ( 12.73 ) 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__