From patchwork Mon Nov 2 16:04:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11874393 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 E8D23C00A89 for ; Mon, 2 Nov 2020 16:11:30 +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 306BB22258 for ; Mon, 2 Nov 2020 16:11:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="neIQWlGr"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="v6ir8TXD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 306BB22258 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=QiQPQtE8XuH/WDoF4OSfrQNUqzy+KGl8iYxJhEF1hZE=; b=neIQWlGrJXHmiHVE9U7E4de6W VF9g+eRDQkbxGgaFVjmPLzH4lwuXwFumywVfZWY5I/d1t/B9p4rFsW8WOyzPqLHQdZu415GNNfWO6 2Laks75tTfPyb/PEykAID8esulr4A8Oa13Uklu2b8drJ8KU+FQIfZUCA1M1FIuCiMP2JXncm1Fiy5 HYlWE6m94OQUHLEAW0/DyGRDELrQn7n4GuYAVgNrBf3eVjxTJgcNxS7c4wrIXNLaIEmumr9iMOqpQ O0viD8YXbGoTOoAkN/GewuykxYcXt+/zBxEFmCBa/YbVWRVFe/OeO/psIL3icqJl4i2niiz+c6O5j adtst+32Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZcPr-0001fU-F9; Mon, 02 Nov 2020 16:10:43 +0000 Received: from mail-wm1-x34a.google.com ([2a00:1450:4864:20::34a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZcKp-0006ox-Jj for linux-arm-kernel@lists.infradead.org; Mon, 02 Nov 2020 16:05:41 +0000 Received: by mail-wm1-x34a.google.com with SMTP id u207so3504632wmu.4 for ; Mon, 02 Nov 2020 08:05:30 -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=sVRidbcAWerSUwt2ci/DUHKn4WqZtHdaAQApmenAD58=; b=v6ir8TXDrscren7ochiaFCvCeDXF39eitOZaERVNtup9izMuNGdlbt8sIvzSVl9SQ8 0QGnDvw0+KGgbTxWPEPecDbfjAo+WjedruVADl1G7uYvT4/O20aFm1+KCaEdDGitSTeK NQswEXuQL+poPsloGbFTH3mbNtGvIo5Srcxh/ikRSVqrXWIfYZXI1Y83zemqtR5VlW7K FpvQIvxkwe/MOmqv9vlG0Py8yGnQMIDwIpaOr4jUyKtJP272qBF6Gb9VZ/vSDt+qBPCr bUKSk0dPlYt9Hq+y05dowoPE/PjJSxIWyFiaZOLSCNkCdrcpTdAJ+TNWvP46rwGv29sS I0KA== 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=sVRidbcAWerSUwt2ci/DUHKn4WqZtHdaAQApmenAD58=; b=o3XukNeNowiHE1lX6OYRm+G3dn7SrHov+wd+suRSp1nv7Zr1l5gmmMzAXi3joO/3+A Akh0vsE7q4L6NnJgAJez4GyOb7UVphUdb6egNVuExNos+yJRIUrsusbjPwLqLPWTGOe0 XFkDoysbZ5cLkJJMhgJsstv+En95357WGeg7adMjV1rF1iX/7LCnjtbL4G9xLJfHs772 L3NOaO7phS1LEML+mxPWkFT56G5SEGqa3OWPHIc73CZtWpevVA5UpYn49+uTlXfTtfo8 xa+jCuWqxvO/DSQXmini9DJg9aBLEVrxr0mh54JwmuCImj18/PqXVchJl+AWo/pHCDb3 JgLw== X-Gm-Message-State: AOAM532zCRUlMw0wkhSJ4oxKhkYThAD5it7cc1Sd3Xdb40VRBfd0dx02 /JP+tCfLSJab8NPqnW6/QpNW1yIS0JZmPfu/ X-Google-Smtp-Source: ABdhPJyREh+t6Io9PXjdhN+oiI1e4wC2VDxO12r/g8aOXiFkF4OSY7aITzm4LlFjoO0wg88pCsMbIo5Egu4Xqh3B X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a05:6000:1109:: with SMTP id z9mr19417964wrw.388.1604333128982; Mon, 02 Nov 2020 08:05:28 -0800 (PST) Date: Mon, 2 Nov 2020 17:04:06 +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 26/41] kasan: rename addr_has_shadow to addr_has_metadata 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_110532_360543_466CC118 X-CRM114-Status: GOOD ( 15.48 ) 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 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 --- 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 54fc3fac9779..ce335009aad0 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -146,7 +146,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); }