From patchwork Mon Nov 2 16:04:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11874413 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 893A8C00A89 for ; Mon, 2 Nov 2020 16:16:47 +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 1DA342231B for ; Mon, 2 Nov 2020 16:16:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XJoC7WTw"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="B+b74HQO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1DA342231B 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=XJoC7WTwsLihlPT/E3at3vl/q khLvBtrP0uiXbPviZrmg5HnhKI/0TWTpmmcNCNxiwV7VeiEYYhczP+ZUSSHoIFOvntoQJ6ynrm+rq JaCJh9syE99b7rPB1pj6H04elKNaBaIMhrFtSEnM1++wsrd8/rvzHfhDzNLGBv+X1Lj4A9CgmxxAq qzHxNDSkyUk+ZGdCNcVBnVnCBop12d/OoCxH1T8XpM0FjsLw8Aqphzx3RTxPAqRm5YvjTmoE8GfHa chtEbpkpHEa1eS0I5XRxEG0rPecYpos2+0xArhfcS037bteNAZpsIhq6imCmnAeNLFhniaBDRKs+s N7l0jZEiA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZcUi-000490-K6; Mon, 02 Nov 2020 16:15:44 +0000 Received: from mail-qv1-xf4a.google.com ([2607:f8b0:4864:20::f4a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZcL8-0006yO-6Q for linux-arm-kernel@lists.infradead.org; Mon, 02 Nov 2020 16:05:54 +0000 Received: by mail-qv1-xf4a.google.com with SMTP id z9so8489512qvo.20 for ; Mon, 02 Nov 2020 08:05:47 -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=B+b74HQOp3f/kfOxXBITIRBEll8gls2oSrKFlkytGbLYfoRHHu1uMoDCIY1/QpTreR 1OWKmsbQ3kb79xzISbXlnmxB2nFKPH9xGsspSZnhWewaaEzeQQzpYHdE+Tvylc9ZEy1C Ynm9YJUeyl+VKHbYnn3nmDML3XSJTKgfLfCPTEHNx4Yj+yOt3oFEMIQaUDLmJGta7A6s +CZAF+bpODT0CKwxt9FAzMVIgqHaDyQzk6/HgFfJyDbRWtMk9xod5t/V99ooccHzwWKh mR2nvhRCb+Ky6uhyTKye5Xm1E2L9ta9OLifCVWA+NfdRlyOE/FFvrXthJ3hePSrMPK9z 3dQA== 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=gTMpYNLs64J3e6rYdTKVxbaaK4QYQtJswM7NoxxkqZ2BhoqpdjdUxsH7enJ4pAbAym 0ojbZLjtYWkh21CXvE/oSWnrsUf10XrZBQ+DaY+fqIYpQdXqEbjH1DHmu4qckpf5Yx5P CXJEbQdnwC2jiJ/BHC/50888mu7tWeOOHewn8Aj4muW4MJYP2MxdrwxUNv1h4yWYC1E5 njhuepQdYztokA3sYNp8G3QvUIUHx0HkUuQJDUk37vZZ20VrmuqAVwblMwFx/JZ0dcjT aokwhZpluAED5YW1Topib3zioP32ogxNNTGLF7q8EHeBy6/m4eNQzpKT0TDb8ERIu42O 2ZGg== X-Gm-Message-State: AOAM530rQnHsABsxx51xkAQhOI6m9w4/9jJE4xfxSiizXBz+ZXCloEc1 XR9sKiXtRGjx2psO4OnjyruFttj599rUxOog X-Google-Smtp-Source: ABdhPJxCpvODUOhYUZL5nc/yMsQuPusWm8gNXkjp/HkCNDgiJkwTvpJ1d1RHTffAkbxP5qgxtSriqvYjoje6hyoR X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a0c:f70e:: with SMTP id w14mr23027576qvn.10.1604333146336; Mon, 02 Nov 2020 08:05:46 -0800 (PST) Date: Mon, 2 Nov 2020 17:04:13 +0100 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v7 33/41] kasan: define KASAN_GRANULE_SIZE for HW_TAGS From: Andrey Konovalov To: Catalin Marinas , Will Deacon X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201102_110550_347457_1D93468D X-CRM114-Status: GOOD ( 11.08 ) 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 , Elena Petrova , Andrey Konovalov , Kevin Brodsky , 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)