From patchwork Tue Nov 10 22:10:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11895699 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 DD62BC388F7 for ; Tue, 10 Nov 2020 22:27:28 +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 71ECF206B2 for ; Tue, 10 Nov 2020 22:27:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IpVqhM1y"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="rDfcg4Wv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71ECF206B2 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=GttxViJUBWSxGKm7mvR+4HprMDhAd+bjbtQdeZkwqaM=; b=IpVqhM1y4mTpYFVPyhErd9ysK YvafYtNd1a+xs+YHa9hr+hJBJRCNJgRirGK+5E29gTcRXLsrwDJt3Aw5pgB2iJYmJAeWBsHB+yX4B U45pKrhB08FidkNfuhOS5GQN6Euk9n7ITmhGK8s9kwZNNv3TUA0UUVkL5OBge1S1N0O0qzkF0RZhm oY5vxNS8/1h9E0cK9oQ6pYEsFL+u9vpUiaZsrQV6SHW6Eni//indSCbdIRW5uIuXZDBStfKrLedO9 kVoAhzxPBnN0Ba576dGV86jvaECx89kIxMtCn5X9II2EdoQQC8n4OBuMqkHf60nlG+ACA+KWpCQhs tvDNbj98g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcc5H-0002eW-ON; Tue, 10 Nov 2020 22:25:52 +0000 Received: from mail-qk1-f201.google.com ([209.85.222.201]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcbsT-000510-MD for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2020 22:12:52 +0000 Received: by mail-qk1-f201.google.com with SMTP id w4so170511qki.20 for ; Tue, 10 Nov 2020 14:12:33 -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=OeZS4n3Ve5zgesVM2BV3JwByX9ZOkMptVCR7dAgVH0s=; b=rDfcg4Wv2g9oelKYJtIo74+QZQJvkXr2eyG74tpDpGIIE/EcmbjOAPtX/pQwkEHRuj BrCX2StKdYe2KLGS3AyewCxMyYzjUrIBIaojlYHYUZpFm7dlrCuv1e7HfC4N2a+Xx5fb wNqOlk2zNERGUBf16vUClQ5xVSxrjGg8IgN32tRtLu3qzRGJDakA2qf24U8DqMZdo1Gd WNY/KYVfFZnP//IiQpk3aMBcUUltYaxOkK8RGjkUEliN9ZP1f/07IhHmFeRCuleMifS0 zHTpWtkv+CH5eufxa8biZ2zUX/a22tHkvHV2F3di61fM88xR0LHtqLBVWv1NsQJ5czkr iH9Q== 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=OeZS4n3Ve5zgesVM2BV3JwByX9ZOkMptVCR7dAgVH0s=; b=SZJDotxYHKqfxw+nupgnQrdXbT2/KlQFwQ7JIMdAMb6gaFDTET0f0xdupdjii+8tD+ h13uxY/Jyn6KWQGmYA4ss6lYIiKS3bxXcMhf9NIPZnivxKnxtGVDSyQjBAhlBHCINGid vqZCB1tL/UIMFJRL5B0h4cR77VEk9BT91JT2xG3wm5KVCbMwSKM9vk15TmmN1F0Li8V4 rLWs3YrZUzeQjjPLBhs3Fihr9toEYqaU5CjVHRoCTwG5fpOkvTOd3DXbNNR+01bsMLu7 47J0iq9lTmRqEhpDNv63pQIkWzBvMBlSDUjaT+RcQ1ysd+IBsFpEwl5CKQAIOPKv1hGo nQgA== X-Gm-Message-State: AOAM5303n5O9S4+eOVVntrtdwNTsk8CxiL/Xvc+KRm/FYP4ESlrRoM+m U9DOCkPbp6SMYuV/pYd/FabnG40TAvsNeHYD X-Google-Smtp-Source: ABdhPJyBxa8GZp4LuIt2JvLFO10gSTwXZsLMfIN1bZSlGLMd2BqGN3ai4Lxd8KeGS0BNXEUCdT8lDH+43Gzco7DI X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a0c:9719:: with SMTP id k25mr19774260qvd.42.1605046352358; Tue, 10 Nov 2020 14:12:32 -0800 (PST) Date: Tue, 10 Nov 2020 23:10:33 +0100 In-Reply-To: Message-Id: <71fcf23cd66d690afce1d80dc2f4659b2342152c.1605046192.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8-goog Subject: [PATCH v9 36/44] kasan: define KASAN_GRANULE_SIZE 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_171237_838643_2E8280AD X-CRM114-Status: GOOD ( 10.93 ) 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 has granules of MTE_GRANULE_SIZE. Define KASAN_GRANULE_SIZE to MTE_GRANULE_SIZE for CONFIG_KASAN_HW_TAGS. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino Reviewed-by: Marco Elver Reviewed-by: Alexander Potapenko --- Change-Id: I5d1117e6a991cbca00d2cfb4ba66e8ae2d8f513a --- mm/kasan/kasan.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index ae7def3b725b..d745a78745dd 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -5,7 +5,13 @@ #include #include +#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS) #define KASAN_GRANULE_SIZE (1UL << KASAN_SHADOW_SCALE_SHIFT) +#else +#include +#define KASAN_GRANULE_SIZE MTE_GRANULE_SIZE +#endif + #define KASAN_GRANULE_MASK (KASAN_GRANULE_SIZE - 1) #define KASAN_GRANULE_PAGE (KASAN_GRANULE_SIZE << PAGE_SHIFT)