From patchwork Mon Nov 23 20:07:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11926625 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=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,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 96944C2D0E4 for ; Mon, 23 Nov 2020 20:25: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 150CF206E5 for ; Mon, 23 Nov 2020 20:25: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="yvaVFq8w"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="FfWNnS6D" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 150CF206E5 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=XD9jMkWhIxGBjE7rM9Oox8C43Zj84tAyZNuwA7njl6U=; b=yvaVFq8w36dvh/uvKMJ39uemS f2rPFIqOZvZMahMSTgjA+FFOhgLLpbuq20n+7QvCHWWNjadhysJ6Pc3rFVMWS9japLo2XZgV0v+5I GANkkiH8CgP/9L3F9rXj5uxeXEr6PPHvu1gRPrAIu14ArgV4GQCoiKrJRIlTzjM5WA0kza1qo/Q+7 bx0XMOJymJziowfMG/EsPSS16aMqjrW73NYSJ8aQp0agZr66dJypz0t1Zboxd/pDt6W/Bg7Yw8vNR kKqeJzd3TWCeAq5TFjXAWuy5Ru+9vnvOpG8CBHeTTHKs50lcYB2s1o9xiy5k6zDqs0MDh161hSKMM YWG4BOn+w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1khIN1-0005t3-QU; Mon, 23 Nov 2020 20:23:31 +0000 Received: from mail-wr1-f73.google.com ([209.85.221.73]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1khI9p-0008QS-Fe for linux-arm-kernel@lists.infradead.org; Mon, 23 Nov 2020 20:10:05 +0000 Received: by mail-wr1-f73.google.com with SMTP id w17so6183740wrp.11 for ; Mon, 23 Nov 2020 12:09:49 -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=gEnDsD+N69lIXG3Ma+biKqxogEfpaBdkZlhoQUvyVBc=; b=FfWNnS6DgP7aoSkRvg3HeByQaSuDigoEyB8i2MUSZPS83BNAnfQl+QDxbBoeIDw2Zz lEJsVW3NR8061h7oS71deZYKO+i6jkdR7FmyaU9S6qYasJqCcaRrKGZX5IHSsFGwQrVn jE0ZUFb3ZJFyEqQvpFR66i/Gk0GQm/86LYNy3MjVTHrCYtCQxp+6c19nGjV+lyHp/otk 1KfcVpxv8JmvBBUCuimojZ5ltow/aDbCCrVGcoFPuCb+DE8F8sp71QozB/A7Q/f/e8/h ibjeDB0aU3qVOlaDoFUt3NUcn8A+vDFK/n/eY08TwQdt67SESvF/YY1dinvgJa9VO3zX VlKA== 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=gEnDsD+N69lIXG3Ma+biKqxogEfpaBdkZlhoQUvyVBc=; b=edqlajybBJVUOpDVLu0avRfrinaKEXZ72jm/koXD1J8LdXBD7WVjP1SzgPEtsVk8Q7 x7/q01PCbA0eusFlpnpMHycbWthMK17D/3XMEYvN4RXX8sGwWEUUv9v32ZF2zhpIrn2J LJ0SPwpKZhcduh6hR8cLCtybpEX8vwfrlb2zpMoenUErOZzqAXtisGBjkL3ar7hXhtWb LBAJR7fgCUO+4jKfgPzxlbgRiaPd+vYjqiS1t6eFp5xhL5XrHSOafTt8t04qjETI0ga9 AM18EUieAOExhhdECyz4VWh67MrjDxZ9lYMdDQZ0vvyeyxxs9YxM4gojbZq7owgOVNKQ HRUw== X-Gm-Message-State: AOAM530qDinLXVuae4jqStKuKj2OQhmXnFUK37UFYWyRh2yP6Vnc2AYM JCA8qpcsz1YYiPK4TI00JIHE9cZj0WO6GrCF X-Google-Smtp-Source: ABdhPJxuTyKGJpJ9R13tryozNvCIfSMHFYGMbWGDD7E7GAT3bPdC8BzbC8PwCKdMykkLVk97+KSIe7Ogp0sZD3jA X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a1c:398a:: with SMTP id g132mr585815wma.51.1606162187602; Mon, 23 Nov 2020 12:09:47 -0800 (PST) Date: Mon, 23 Nov 2020 21:07:58 +0100 In-Reply-To: Message-Id: <3d15794b3d1b27447fd7fdf862c073192ba657bd.1606161801.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog Subject: [PATCH mm v11 34/42] kasan: define KASAN_GRANULE_SIZE 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-20201123_150953_784914_0635A815 X-CRM114-Status: GOOD ( 11.39 ) 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 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 bc4f28156157..92cb2c16e314 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_MEMORY_PER_SHADOW_PAGE (KASAN_GRANULE_SIZE << PAGE_SHIFT)