From patchwork Wed Nov 4 23:18:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11883093 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 88BB6C00A89 for ; Thu, 5 Nov 2020 04:09:18 +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 E18CF20732 for ; Thu, 5 Nov 2020 04:09:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="YHmPla+0"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Q4D1Ghv1"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="vNs/tV40" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E18CF20732 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=cuLha6iFQRn21MRa67Ds6ecQbO1FX/2l7Kqn8hUsE8I=; b=YHmPla+0Y1PIOetdEzx/fVzxs QxXSuLVbF7kNdMRaVz0lzC5r1rulLrJHYcujB6214uJgYcNH2gHEpQyZXcUPM60XSJ6B1BRqowlpE ppZW7zE6NI5T/O4Cmf7szkk6/Djd+WP2bD9K8qrKHF9BpGmHOvvWS6+IaES7jIZUIrdNfsMZBXT7l kBpALy0qHr9KqpyUB5KMsJNYcoHyZR2A9ijqWWl7jcg4kKc/o4auabKWafOhsgu8vOkvyvFH/9dmQ 26M/klnp3OtkWqg5YBRPxfqDKBYAIvalMUmBPMOVQMfUjC8EL9MiPMNxIPLUeT8NLxFLz5iP6jFXw cnTRsHLNw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaWYy-0003XY-CY; Thu, 05 Nov 2020 04:07:52 +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 1kaW56-00016k-LF for linux-arm-kernel@merlin.infradead.org; Thu, 05 Nov 2020 03:37:00 +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=E7M1YMbMIR4yMAYd8ymzpiiG9f9KaGeAaRDscMDAbI8=; b=Q4D1Ghv1SqIRYz7LsNFbduY9gA g7V7NiuIMs7qzR3PhhScE0X+yrfMcY/mKFNqGiUYCRgJApj1tfuOTH1Se9rYNp+uFW8SdiJYvXJjJ 9CzrUAbjbgF93Scd9Ej57+PpirELpufiiQXmiqcGq1xBJ2m269Cy4edc9JE/+d1I7ECnzbfP41Xw2 JgaGQhZ+Lu/E7BEq93jhoOTbqvy+Yb3vBTVwmDdhuRbvYdPokg5XqmndN13b57fGXSZM4cf26qD9b Q7SFcunSKKHREACNzNTMJdqrXNbPL+XohyBopD1knEEhGOlmi8yNqr9oRNKAVg9v5Goj5aQZDoQ/9 RXkTIIgw==; Received: from mail-qk1-x749.google.com ([2607:f8b0:4864:20::749]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaS5t-00048t-6O for linux-arm-kernel@lists.infradead.org; Wed, 04 Nov 2020 23:21:35 +0000 Received: by mail-qk1-x749.google.com with SMTP id w189so14481819qkd.6 for ; Wed, 04 Nov 2020 15:21:32 -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=E7M1YMbMIR4yMAYd8ymzpiiG9f9KaGeAaRDscMDAbI8=; b=vNs/tV40nkRYLh+bd2pRN8tnAzZTvTLYqRkQOCW6i0NqSU2MOjkywCmEziyzjFDNbr 1rXXXbldJOqtLhDCWvgATfC+KSCn3Aw1SgcbKhGaY2x/0ad9/WzaRZcunh9SZ9VhdWE+ 93GL/HUwq1B+KUAPEFz5rUbLRIrVBCkQXeDb31FsmrSWnLJ4R1ycm2wOLG0aAjeFzPNd jLN+AusTKOptQ9gIduhkrhSG92OcBcAhl87OkgzMmsZeCPCIffeaaQOvpyCBT3IoQjWh u6V6jH9lhOM7AGfqm48kv9PP2ZoAcIs2IFa3F6C/Ts6nXU4mcYfW9PncMAclN7WOtnNw P00Q== 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=E7M1YMbMIR4yMAYd8ymzpiiG9f9KaGeAaRDscMDAbI8=; b=GKqBZ1RFdNMl+GYKBcoFQBF47XsWH0yaOqn9qXoTO1mnS4PjlAX7WbitOIchWKoIcr /uDYepOEYtf9kdjR+E2R2MZKRp8Lo4Kx3ZLtK4rW8n454bAtOiV8ueTnp4ZKqAs0GJ3t b0dY2D7lJQxHevwOnO5bcVafttYXg4O5uRNEEESE25J/8G9UuNjty4woQZpoQyzqyYRB LCQ57QxPgecrZljopwG0LYlk4jy1OmVunrSq8WC5scofank+QWCGvUXUMyEcCBhZ4w7m iqXeA7ibKRM20GbQJ9WzsshZNEkoAhyd/a4NxVX6otAs4KT9Y/YaiwJfHc+ymCtpSQD/ XBDw== X-Gm-Message-State: AOAM530EbwtqixlHR/o31ucirpbqc5JYwxaue7MqcVuWVsl7mPsDO1bE 2JDxds/WChTV5V1obO0sJm+CaYDj8poxIPsy X-Google-Smtp-Source: ABdhPJzqgs/A05RlcSOyed/F/WMpRLrfZfCyn2cPNSS5rL4ubrhak1Ah1gehiCULAgkww5qluz2BjCh1uVyX/JcV X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:ad4:4b32:: with SMTP id s18mr435733qvw.16.1604532031338; Wed, 04 Nov 2020 15:20:31 -0800 (PST) Date: Thu, 5 Nov 2020 00:18:50 +0100 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v8 35/43] 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-20201104_232133_380328_3DC25713 X-CRM114-Status: UNSURE ( 9.26 ) X-CRM114-Notice: Please train this message. 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 --- 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 e3cd6a3d2b23..618e69d12f61 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)