From patchwork Fri Aug 14 17:26:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11715035 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0FBE5739 for ; Fri, 14 Aug 2020 17:30:34 +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 CB2DD20855 for ; Fri, 14 Aug 2020 17:30:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Cv+LLAxu"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="DrFj49N6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB2DD20855 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+patchwork-linux-arm=patchwork.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=b0eGjdGtkUzAHhHGL9pLzuTrqQgmuYVbcQgFv/Dm6hQ=; b=Cv+LLAxut6fe3jsHFVUDfZa0p 8Pa/t8Kgb7Nzk69zIBEjT80SGCLfhywGOLOpDoGYgfTHuIMvoFRrBpZ0wgHamFFeaMfwZPwNjQYX0 N6Fk7Gjh73cadwyF6o2+nhBRWjnj7ucbidA0vV6HNJ+cCzM5FxVWKBsf4BbxBVEre8OE5wnhofqKx NE3NRoclTJHENgcLOci2EAgfoLJ/r2pd13AS2GLNmdVomfRiydcsqNjVnShgrDZ2lPZj+ezcWxFUM 23TZMoyxjKmN7Mtr5oZ9akKbc8DYMlXjtajG6S7JvVB1iW/4hGnszl+gqB7ByGAg/v7MyAMT/er/M qbD5Wn/jw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k6dWq-0004Ur-MM; Fri, 14 Aug 2020 17:30:08 +0000 Received: from mail-qv1-f73.google.com ([209.85.219.73]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k6dUn-0003RR-BV for linux-arm-kernel@lists.infradead.org; Fri, 14 Aug 2020 17:28:11 +0000 Received: by mail-qv1-f73.google.com with SMTP id d1so6469300qvs.21 for ; Fri, 14 Aug 2020 10:27:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=uzelTOrZuAbTWnllhx2uagoa2R4S00LwGFOB2texzaA=; b=DrFj49N6R4eCrQJphz6+ETLQSN0RvuR+8g3jRWO5Kv9Cu3h0thzUUGYLi70G7SUsL+ kk40BvPcKjV4y5B+tEwCs0wOVQz3Qo6Srdv07PKEjyECoSiZoRIroE761xkoNWipUcMN roNpIlNYf89LDQz/ZqjUGEJZHvbnTtlRJ0+MUIuDazMnwFSw53XRUzj07eRKXWAfZijn dzNZO8q+k/fcomM5fZfG+FEMWYRiHVBFBoFFEBTlaayDyg+1daA7M4MSqNiq+43cjUm2 g1oHg4iWrX+S5n5/Ax9bx6fOL4mospA1TbRF8FPjvTbwcC/rp93zDPO8bpBJknFheRvr RkUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=uzelTOrZuAbTWnllhx2uagoa2R4S00LwGFOB2texzaA=; b=YKBEOEJ07kZ3gC8f5EVfA1a3NJgGPKGb6YeJuv1mzNzx8Gz/euSpa8DpQDHV2u5J3Z dqPPncL5fwjGfnIl1Ul6E1WL/pkG+VF7pmFRrSxeO8lhEg/p8y9G5XskauPVwl4HlX0J lzTLDol4EhVUNl40zXdKESP9e1pu9XTyQZB4TnLqArZL20uXNLTYXuzjvkh07QVDKsIV HPPtK93Ph5rd0H/QcD8xlNQxRY1EQwTGMgpYv3+/ZdUPRsSuV1k7nRE412K7jcy7ihLU LW4SbzyVy1Ao04w29+ZsxaA5PkguXpQKp9FzidEl0WlSiuI5B/WxQrSQvWhgA91UJ3Gq D+PA== X-Gm-Message-State: AOAM531shI+9wMyEvb6fZz7RPN97xUFXAa4gaEzIutrp7NCDkQ6e2b+t 4hhAvg4ndznWn06tSRB6yWajrtU+oQXhpULj X-Google-Smtp-Source: ABdhPJx9kLUufXWadY2TxpJl/SQvQjOV7v/3wKY2MxvbtkT8yluKpe6HFl7wJbjM0gRLHD3MjV79RqnFtPzqoG66 X-Received: by 2002:a05:6214:8a:: with SMTP id n10mr3654847qvr.13.1597426077265; Fri, 14 Aug 2020 10:27:57 -0700 (PDT) Date: Fri, 14 Aug 2020 19:26:56 +0200 In-Reply-To: Message-Id: <82cf4f8007645f8c45e6e4847a28a743dfb9cbda.1597425745.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.28.0.220.ged08abb693-goog Subject: [PATCH 14/35] kasan: rename addr_has_shadow to addr_has_metadata From: Andrey Konovalov To: Dmitry Vyukov , Vincenzo Frascino , Catalin Marinas , kasan-dev@googlegroups.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200814_132801_544655_3DEB1BE1 X-CRM114-Status: GOOD ( 14.40 ) X-Spam-Score: -7.7 (-------) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-7.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.219.73 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.219.73 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_MED DKIMwl.org - Medium sender 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: Marco Elver , Elena Petrova , Andrey Konovalov , Kevin Brodsky , Will Deacon , Branislav Rankov , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexander Potapenko , linux-arm-kernel@lists.infradead.org, Andrey Ryabinin , Andrew Morton , Evgenii Stepanov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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 --- 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 15cf3e0018ae..38fa4c202e9a 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -145,7 +145,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 8463e35b489f..ada3cfb43764 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -334,7 +334,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; @@ -345,11 +345,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 427f4ac80cca..29d30fae9421 100644 --- a/mm/kasan/report_generic.c +++ b/mm/kasan/report_generic.c @@ -122,7 +122,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); }