From patchwork Tue Nov 10 22:10:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11895745 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 BD9A3C55ABD for ; Tue, 10 Nov 2020 22:42:29 +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 4E5D2207BB for ; Tue, 10 Nov 2020 22:42:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jYCG9agK"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="mmCfzyyF"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="e3OOW+tq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E5D2207BB 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=eG+UlyODqoZlN12ukTY5U65TaCw0PFGPM2lo3zjo1tg=; b=jYCG9agKihYHqu2IfaAVLfLZc Nh8Hg/hxovBdjg8g27yCx8nBQoasNeslKlZh/bcskeIy7I4WhleiPXUNIQ4QXJVvl5+ZlTM0Ye489 kFWHwyLpz579r7CAELuUM9Iy4yWCIpaDncBDRi9WK8Lx7bMspdvTbd8UYFoqDNv9NzT9kVkiad+c/ ZRKUn+AuwPTkK5PZd29aJcTf2PLMETvrSrFHZkTPXv4hjrlFnOPMB3jNXr6HKfj7aXpxDJPppa5Hd kL1u/IHEqxhI0zlISZ7mW6sM92ZTzoAN4MPKp+u0U02vHR4JhnPOox76rP/0i+F+Y0uSWzOBfHZtz YtW+xOCWQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kccKg-0001EF-HF; Tue, 10 Nov 2020 22:41:46 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kccBH-0005D9-BA for linux-arm-kernel@merlin.infradead.org; Tue, 10 Nov 2020 22:32:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:Cc:To:From:Subject: References:Mime-Version:Message-Id:In-Reply-To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=AWBOrywbLQB+4u6q3KIizLA7Ns2sbu1oUV46sd6l1CY=; b=mmCfzyyFhKHHP1Nt7mOhk+Q6vw qnsYbgyDSI3yo1Zxfwtnj4qJRkdXAVf8TJWbCIjslXH4O2Fazfmij1HtV7z1F4NeUKlIdovo7KGeX WCEQLzK+XAMsg003jQN86adC8i9xiJKkRxNsHIe4B6pi4zv1tKpYRuuoB9GGRT7wx1ul7GlbORGce tOjkhEKrmLqLMvhe3yxeOZeQ/b4o5w1SvbXxIgNCoC835S/2bQbCnx0DeRtnMPdf+xsSP4k2p6cZl 8GbN+QtrOeu53ZO2ipo/ztgQ+mYNB2vuN/yOWY2M/XjzmxjXe64KOWDYthPgOTMe4nr/KyoJMxtIC 9duQc4Rg==; Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcbsR-0007eu-Tt for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2020 22:12:40 +0000 Received: by mail-yb1-xb49.google.com with SMTP id j2so155789ybb.12 for ; Tue, 10 Nov 2020 14:12:30 -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=AWBOrywbLQB+4u6q3KIizLA7Ns2sbu1oUV46sd6l1CY=; b=e3OOW+tqsg4Vhyv8X3Xod4zrgwWq1gbp/YZv7AZ3J3/ktq4wWa35UKYKxt84rtB1QK 3B4r9P6nzYoSeXfhwLb70Ue8eIbEmI1Sdfi6UL/JvGFcHJXZUxVfDFR87BpN5zfNU1n6 H1gu9RVYdPMQkmsBZjBIuIyCCHnK+nQUigSMGQUSZi1q/U3FKM0XU7I4N7ATJNcrusmP UYnBxdBH4Fv6Y/h7AwedKCXd2bdugFA7YtEk2wZaDv/9ONlZPbwFuLUk4CsvwXEeBDUC UBoKjhziv6+bciU3KcUH6jficpCPmTxrJLgNXG5wOVktrV9zHmBG50XrtsFWkm5WkcjE PcEA== 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=AWBOrywbLQB+4u6q3KIizLA7Ns2sbu1oUV46sd6l1CY=; b=jmdatZheR1yp3zaBqi83DVznXmFcWDLVY8Kgaknzhnzym1RK/uN7RVrfaoHTiBVQRb 5JNNnW/F1U3oJ8+Dd66QqGJwHKycJAycJgMMDkvnPR9/1z8YaPsuDEVhASRXHkVUwQH0 usW2b+LOYffrPD+PeQSfkr3KCvR3camLR33bIk7FtmjTR2JEvDrK4hPTu5SE1cMBndyO RaXpP+bl+f4+n2fZC9Zf3pFRb7uTBdKi9BwRi7G57F4UNpeYlduIEkpn1aLq9Z3KeUIV UpZ9mHT/EjgHISZZ2wK6OKKXbD2YMAGi0V6gu/iXA/Wv1NqqN+c5lOmCinXg3m7jFbTt C5Lg== X-Gm-Message-State: AOAM53012mk0Hi/0c5KwPVyl/P1+qPLX4sd9lMqpejwIhs/UtBlKQyIi IgT5Cn9j5Hb7Me75wVql/a4WXt+lc8PbTN1Q X-Google-Smtp-Source: ABdhPJwhlX6AQ97UEoMvYcNV25l2xhFbbk2YuOXWTd5VQwdGRTM2uJicQqv84zFQDeLs4QF0cawsX9B2H2Q7+7Sl X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a25:100a:: with SMTP id 10mr29800073ybq.410.1605046347868; Tue, 10 Nov 2020 14:12:27 -0800 (PST) Date: Tue, 10 Nov 2020 23:10:31 +0100 In-Reply-To: Message-Id: <76b91f88120fc8c3e5923d6432a1d537ee584fc8.1605046192.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8-goog Subject: [PATCH v9 34/44] arm64: kasan: Align allocations for HW_TAGS From: Andrey Konovalov To: Catalin Marinas X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201110_221236_525717_0CD6E8A4 X-CRM114-Status: GOOD ( 10.49 ) 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 , Andrey Konovalov , Kevin Brodsky , Will Deacon , Branislav Rankov , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexander Potapenko , Evgenii Stepanov , Andrey Ryabinin , Andrew Morton , 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__