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: 11926425 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.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,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 2BC61C63697 for ; Mon, 23 Nov 2020 20:09:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A52E020C56 for ; Mon, 23 Nov 2020 20:09:51 +0000 (UTC) Authentication-Results: mail.kernel.org; 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 A52E020C56 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 43E096B00BB; Mon, 23 Nov 2020 15:09:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A2C66B00BC; Mon, 23 Nov 2020 15:09:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A4D56B00BD; Mon, 23 Nov 2020 15:09:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0057.hostedemail.com [216.40.44.57]) by kanga.kvack.org (Postfix) with ESMTP id CBFF96B00BB for ; Mon, 23 Nov 2020 15:09:49 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6A62A1EE6 for ; Mon, 23 Nov 2020 20:09:49 +0000 (UTC) X-FDA: 77516773698.21.metal71_31108e827368 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id 27DC4180442C3 for ; Mon, 23 Nov 2020 20:09:49 +0000 (UTC) X-HE-Tag: metal71_31108e827368 X-Filterd-Recvd-Size: 4437 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Mon, 23 Nov 2020 20:09:48 +0000 (UTC) Received: by mail-wr1-f74.google.com with SMTP id w17so775605wrl.8 for ; Mon, 23 Nov 2020 12:09:48 -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=b1zB0ao6T+ZXTe289QbZNQqgS4HV1meqaKpEqRYKf2mw3lk1RmFvyL9Yc+1PJXOxeD vZ0404W0bTUlBVMM3rKvitGoUlskvjt9aagnxC+mGNXwMalrKCEb5tnPYTzusAMBjnZc alCW/ACVuzQ534e+EgmeGe3GhxkVOLSeOjH/yBQSn1TgEH8dps4iAtxkZM0IvGoaC7P7 PBf8xOKLlAy6lfCDfcVCowj3C1+gJVF8kP+8EcUPq7t8d02DudKAvBSUI+HiqHx5GNj+ /wkCAhy1AP/0pz2lM2j38lT0fZiXVq3pid7dSGw9QpW9/KxZ7XcDtgt02X8dKwdkj5Ow dzQg== X-Gm-Message-State: AOAM533cai6gYQDOTeecibwqnfaWfSTNmvmKj4xEq7Mb7b5Ng6x0K05s UhHKRpw9nDee2e4MyRMAfQevp/LyzNP3jHbn 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 Cc: Catalin Marinas , Will Deacon , Vincenzo Frascino , Dmitry Vyukov , Andrey Ryabinin , Alexander Potapenko , Marco Elver , Evgenii Stepanov , Branislav Rankov , Kevin Brodsky , kasan-dev@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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)