From patchwork Thu Sep 24 22:50:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11798439 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA0EF6CB for ; Thu, 24 Sep 2020 23:04:31 +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 96A9F23899 for ; Thu, 24 Sep 2020 23:04:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ihv/tEQX"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="JeM/b75Y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 96A9F23899 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+patchwork-linux-arm=patchwork.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=+cqKttl2XW2rKBwUi+c9t/vfbBODlf8pi4Ij4hUcXyA=; b=ihv/tEQXv8SGGwZnbl7DV4Xlr 6Djwoxvr0YUqZ9CaaeKXWrRr2ozhVX5Xz/15VOqGkLqCvKM1vmYGv38Ep9mEqWCh0/f45gI/epk/4 oxLvhJLMl9qLTeVu53PwqNQX3gDN+PM/lrQNURb9F/wFI36MqtPscC1sb0T/BTfYhg1S4E9HrXvBe 9mtzTsj/CoZtqq3VaKE05+VYXkvcUvR2xvTQL3bQXsCRACPCLYT6Ndmm3O8jF+teSc+53hQcJ8um7 Ua2UpnX7uj6fTWRFgv87kHbqoph8AA3NIfHZk4MkGgk6wJfunMaxTP46eFinnxqWDtZPJ76qad0cJ KBF6pTdsA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLaHe-0007mw-W3; Thu, 24 Sep 2020 23:04:15 +0000 Received: from mail-qk1-x749.google.com ([2607:f8b0:4864:20::749]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLa5z-0002YZ-6W for linux-arm-kernel@lists.infradead.org; Thu, 24 Sep 2020 22:52:12 +0000 Received: by mail-qk1-x749.google.com with SMTP id m23so688053qkh.10 for ; Thu, 24 Sep 2020 15:52:09 -0700 (PDT) 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=wHymNihP2cmvV3L+Sm6JVmAu1rhIBofqol5fTdU44eg=; b=JeM/b75Yz4vtsSpUoXIkVhHEK2UmRKfSzDF8tDiV0svk/SQQvkdRlOIUuh5XrezrVO D8GP+rtwyL7DLqtJqZnEFSCifzLV5ZHjIznfR+V3fdrvh6oLoYe+qG1a9yDqaG5O7dMb LJXn71dUYDfIGcOn8DOT4VThpwpS/HGA9qCRP21wHtlrF2Sax4rrIxwuQwkEVH+h5CwG 1Ft8h3Fo12k2K8xB9dmsFqJsqA/ZDX0cSkW2Fe9zUv5fkCqkMeTU1OZY1vxhbNP2UnjO NR5sur7k5znV7ASaz35/4H/ICZYO91ncqOayXH1Kwv11JyfNWvkaRGvpE/sX1Ot85Mjm ajNQ== 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=wHymNihP2cmvV3L+Sm6JVmAu1rhIBofqol5fTdU44eg=; b=IGSEGRTKAdzzE+33CQXzxiQKlQtqMO/k4wls0TIi/YlbI12fnatQ3BVIEABduxltHP QnSrLorBpozKUOCSf02r2qNRXKkIxBLBqqRixjtT6igFzHv6BbjUekmJmJF9FcV1QnS8 7+oV/WMM/dSh22Qo+qi9KFizHKu62cqrAxK0fK+kodj/7GdLlETQ4lVG7rhVGL9h+RGh VKF6k4L1sMu/mbdj8VZXPCiVrB+Sm4CH9748jIRtegy8Pn5hKQnEUWP4MXAJIC4iwB3d ACKFhKjxzfhMiTWDDGxnGKVKV2Euz9hnWM0Amc59YXx9KDR/a9kOQthwtx8PVvA/x5W7 DAZA== X-Gm-Message-State: AOAM531LMM8KMaecGFgzMpd6Yh54DmRtF1xlP3Tm4cH+4FqqLUwNcYf1 adFPp6P47ibZgSdYRSiPLQDDNL+H55S8qWuJ X-Google-Smtp-Source: ABdhPJx8I9zcdeQs79Q6VCzskVq+c8Vo8fkjEk5YqlgGGh9FbiSdwKkm4WYjYWYgctnVTC2zSHXq+lhC47ne24cr X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a0c:a203:: with SMTP id f3mr1482755qva.33.1600987927725; Thu, 24 Sep 2020 15:52:07 -0700 (PDT) Date: Fri, 25 Sep 2020 00:50:38 +0200 In-Reply-To: Message-Id: <42a4409413858c47677134b55c49d447bf9a8e87.1600987622.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog Subject: [PATCH v3 31/39] arm64: kasan: Align allocations for HW_TAGS From: Andrey Konovalov To: Dmitry Vyukov , Vincenzo Frascino , Catalin Marinas , kasan-dev@googlegroups.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200924_185211_373327_60981D58 X-CRM114-Status: GOOD ( 12.58 ) X-Spam-Score: -7.7 (-------) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-7.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:749 listed in] [list.dnswl.org] -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_MED DKIMwl.org - Medium trust sender 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: Marco Elver , Elena Petrova , Andrey Konovalov , Kevin Brodsky , Will Deacon , Branislav Rankov , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexander Potapenko , linux-arm-kernel@lists.infradead.org, Andrey Ryabinin , Andrew Morton , Evgenii Stepanov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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 --- 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 a4d1b5f771f6..151808f1f443 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 @@ -50,6 +51,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__