From patchwork Fri Nov 13 22:15:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11905021 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=unavailable 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 3D2B0C4742C for ; Fri, 13 Nov 2020 22:26:55 +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 C2706207DE for ; Fri, 13 Nov 2020 22:26:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="U4lRlYZO"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="gwWZ+UhQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C2706207DE 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=po5H2oOmkriba93F1/mAc1eGySjhto03PQRFGVJYD2U=; b=U4lRlYZOf4u1em8LHt9rdTBlc BBVXCHQYiy1PRyFLafy4UAMjg6t7SH1HV3mMU6afwzmdMSCkDoQgoh9WvzBKNKvo5hTH9AN1038Ix wUauUIEmyckE6dGISSx5jrpYGzhJjekYWwP3VQNwcMSUUdGvtC/MG2n6RZXTNH180DOC/op5hQhb6 uxVYuTDu6vybZpzy8J4uUShHvZXFBiSXBODYJj4gUirwSW2ePW7ReJCP9TiZJRR/kYeA2ZhF7sHP/ qlFS9PMrDVq6wh051+riUuTHZGl8+USS/MCOef8PquFssOhqFGaWerQUVYYEt7WghY2hGan5OIwP+ 8tX5cUshQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdhUx-0003O6-Fw; Fri, 13 Nov 2020 22:24:52 +0000 Received: from mail-wm1-x349.google.com ([2a00:1450:4864:20::349]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdhNN-00006y-FP for linux-arm-kernel@lists.infradead.org; Fri, 13 Nov 2020 22:17:22 +0000 Received: by mail-wm1-x349.google.com with SMTP id g3so3988114wmh.9 for ; Fri, 13 Nov 2020 14:16:59 -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=yKCkBgNRmvI+VGlyeWsyI6UJ3UVry+X9WEXdpst8yJw=; b=gwWZ+UhQgwYktvhlG4qpSBtTFaMzJ7o4XlB5VEfUEE1f+1HjShk26V1631xYBFfdHO /td2rp4X3Bv6JmEbwASkafhRKUH6DosZ9i+MlQ71NyC91JqnRm2EOG330qQlw/ssKaP6 f1Xg3Ub31XAjR2TvHFWoC88Zo3OQi7rDWXq0W29NlbSQ5Sf1PK7Ns/OYkyDHiNaGhobG lqEwe19V+E4X4XqVzZhn8HEtK03oEvgD0I+eV8w8Z3VNh+3da1QxZeWl+4yr2/XJS9kQ v1Nikq509qf7sQ7VAYVGOFRqpH6yFXdRxfxzeQezbWOunFNGQb2TmkLAqlwBQC5IEbnC ga3Q== 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=yKCkBgNRmvI+VGlyeWsyI6UJ3UVry+X9WEXdpst8yJw=; b=aEZD7aAmC8lzoeyxNAew9LGGaYD36NBy/0/9NnQ32+NmZvucJzFgjU+OPZF8F++rjp e1RyAGwqXAooVRAZ4dfoflO7Jaszu2RIP+HzmSmkd6Do+Ud8GT/qfdzPy7ANSDEhQuqy lzZ4I+6G7GY6yJCs64JxjqvlK8NXAyKX4rMYHB0yTA8C1U61eF1+ZsZK22fqSRUcnd9Y Rf6YIEdniJWnyCaGE4skN2Ncs9horJODExrOTUDhFeFT3KGDXVMShY7nZIXtxtPNmVH7 11HujrHjNFAhJyuxxE1pcyxQwIYFvzYoE3Q9VR8qt4Z2zHtHNAmnO9hm3UhIXR82/Ddi 2TvQ== X-Gm-Message-State: AOAM530Sjohk876kSvbImaJ3Dxs8EBrZMi+rTRGcV/Ztyl7YvFf1xIFq O2O+kmOk9tvOneJZeQNuDGNmN5iBmnEW4ujK X-Google-Smtp-Source: ABdhPJxTGFZn+HmhpVYxkUxA1FolU4F5i9ZeKo7HnjvUcq40VAGfn7HX29/N3wqXI9g41qb8PFeb+JyorOolwZ4Y X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:adf:e284:: with SMTP id v4mr6412618wri.271.1605305818271; Fri, 13 Nov 2020 14:16:58 -0800 (PST) Date: Fri, 13 Nov 2020 23:15:46 +0100 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.299.gdc1121823c-goog Subject: [PATCH mm v10 18/42] kasan: rename addr_has_shadow to addr_has_metadata From: Andrey Konovalov To: Andrew Morton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201113_171701_632175_89EF121D X-CRM114-Status: GOOD ( 15.43 ) 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 This is a preparatory commit for the upcoming addition of a new hardware tag-based (MTE-based) KASAN mode. Hardware tag-based KASAN won't be using shadow memory, but will reuse this function. Rename "shadow" to implementation-neutral "metadata". No functional changes. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino Reviewed-by: Marco Elver Reviewed-by: Alexander Potapenko --- Change-Id: I03706fe34b38da7860c39aa0968e00001a7d1873 --- mm/kasan/kasan.h | 2 +- mm/kasan/report.c | 6 +++--- mm/kasan/report_generic.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index 488ca1ff5979..c79d30c6fcdb 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -147,7 +147,7 @@ static inline const void *kasan_shadow_to_mem(const void *shadow_addr) << KASAN_SHADOW_SCALE_SHIFT); } -static inline bool addr_has_shadow(const void *addr) +static inline bool addr_has_metadata(const void *addr) { return (addr >= kasan_shadow_to_mem((void *)KASAN_SHADOW_START)); } diff --git a/mm/kasan/report.c b/mm/kasan/report.c index af9138ea54ad..2990ca34abaf 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -361,7 +361,7 @@ static void __kasan_report(unsigned long addr, size_t size, bool is_write, untagged_addr = reset_tag(tagged_addr); info.access_addr = tagged_addr; - if (addr_has_shadow(untagged_addr)) + if (addr_has_metadata(untagged_addr)) info.first_bad_addr = find_first_bad_addr(tagged_addr, size); else info.first_bad_addr = untagged_addr; @@ -372,11 +372,11 @@ static void __kasan_report(unsigned long addr, size_t size, bool is_write, start_report(&flags); print_error_description(&info); - if (addr_has_shadow(untagged_addr)) + if (addr_has_metadata(untagged_addr)) print_tags(get_tag(tagged_addr), info.first_bad_addr); pr_err("\n"); - if (addr_has_shadow(untagged_addr)) { + if (addr_has_metadata(untagged_addr)) { print_address_description(untagged_addr, get_tag(tagged_addr)); pr_err("\n"); print_shadow_for_address(info.first_bad_addr); diff --git a/mm/kasan/report_generic.c b/mm/kasan/report_generic.c index b543a1ed6078..16ed550850e9 100644 --- a/mm/kasan/report_generic.c +++ b/mm/kasan/report_generic.c @@ -118,7 +118,7 @@ const char *get_bug_type(struct kasan_access_info *info) if (info->access_addr + info->access_size < info->access_addr) return "out-of-bounds"; - if (addr_has_shadow(info->access_addr)) + if (addr_has_metadata(info->access_addr)) return get_shadow_bug_type(info); return get_wild_bug_type(info); }