From patchwork Fri Nov 13 22:16:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11905045 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 68523C4742C for ; Fri, 13 Nov 2020 22:32:56 +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 0FF6921D7F for ; Fri, 13 Nov 2020 22:32:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IuOmouR6"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="OViFLnDT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0FF6921D7F 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=oQNaD6YnXtHWM0Y8X6yARJ9xWkkWo8sYCQyJPjSr/qU=; b=IuOmouR6zBTGmejko3pnldKGw OjccYXqSGh3zTDs8MgHzefdHf9bnX7CANduKrsVCAe3GSZz6sbBLzqeld7at60HF0j8UhybaEFa3p SZxrKAMulHYMMuLibfMB/Soi128O8Kuj/kCnqsojdlJFbTBAULvEGLuKTaISGZZivEi37GUIKEkzx gXiHaT3K+CPo9FZKUeAdrhbS7s3Ms6f/Cx50b8slw8dn6E4zDZQ/MGdIR0jM/76kAO0fxaMhWFtPI WUIlN6dyDOoug/VyyYCygcCMaTOwfqWOFf0K+KTz27/IQ4FMq2wjI5+JJpSFC44SsX6Q+DrB7BAvT hzos4tbNQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdhay-0006QY-Nl; Fri, 13 Nov 2020 22:31:04 +0000 Received: from mail-qt1-x849.google.com ([2607:f8b0:4864:20::849]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdhO1-0000NS-Js for linux-arm-kernel@lists.infradead.org; Fri, 13 Nov 2020 22:17:52 +0000 Received: by mail-qt1-x849.google.com with SMTP id g12so6644301qtc.15 for ; Fri, 13 Nov 2020 14:17:38 -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=TQ3h/P2zSifjnEPKLUt8MfrzzWgegpurLotLIMb03KU=; b=OViFLnDTVEAxFsckz/o9boWChDoxestNvKjwTZsSPS7jrseTOgUX9USIFCNOWcVpZS r3EYgwV1T7nRg/vvajdNJoxIuOcVL9VyJuHySHsUf7f4ZqH1x6bVJ2F1IMnLBR3NaAxe GsqChWDLawz+nIIY2rcxcZ4ZP7Lk/U2IeM8Ft1vjba7gdP6gBK5PwM0c03LUrr+ZPQ4o ZUMNugUWF9uQLBq+3yUa+B3x4f6baVj7KNKW6SVrTIvz0G6gNoGt+b9FOgWoeQPSl0/t sgOmJIsfyfA4NKuaeIEwAuyUxdxqsFrDivJQnO7l/VxgIRVlgrnF9S0bkEPEbyDQ4SSs tIcw== 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=TQ3h/P2zSifjnEPKLUt8MfrzzWgegpurLotLIMb03KU=; b=LXHbkT79j55bV2GN0RAfCtD0F0eahBtrp/TG3I0Wfe8ce3zjRXme59QpZWTu4RFIsV P2w2epcLSQkUc5yZH1ngsnNH3t/94L1Wr/GPT4BLbQxl6x9f2bcU7nuZ5+OSV7Qo21h3 eob0ny6CME5qzVRuhPyWboapKu13UXOUF0hNV5+ce4WmZEnZgzZDwslfSGExggHF4s8d 1c89BF6zD46L6lZHrS7oq3/pt/yvFsURV+mmEyIJLGanNrAkgSId9dqA4DVgOEj7Uv9l VbU5y1kPQ11+sIa7u3hr33QASGuWnenaY/Llv43CQBcmz+oYef8rogstK4pKxucB/LNE iTnA== X-Gm-Message-State: AOAM532VWgLtjeSWnmnTi+RxvC4DOOt3n515dApATUFLFwwpKYm4bHQA WESGNmv2TG43zOyUg4+JxmTorjXEtaTA0nTs X-Google-Smtp-Source: ABdhPJyyzzzWMa5ZfSEgGXq+uNnpkhGRH/ZM85ww0X98O3xAcNqQSmoe4gJo+qIxTd+l67OWdxYkvdchOYXxOEn1 X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a0c:f254:: with SMTP id z20mr4721382qvl.36.1605305856867; Fri, 13 Nov 2020 14:17:36 -0800 (PST) Date: Fri, 13 Nov 2020 23:16:02 +0100 In-Reply-To: Message-Id: <67354d1e68484b547d222b8f0ef402887954be06.1605305705.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.299.gdc1121823c-goog Subject: [PATCH mm v10 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-20201113_171741_733898_0539D9F5 X-CRM114-Status: GOOD ( 10.71 ) 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)