From patchwork Tue Sep 15 21:15: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: 11777741 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 92C236CA for ; Tue, 15 Sep 2020 21:17:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4ADF620770 for ; Tue, 15 Sep 2020 21:17:01 +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="LidLdQly" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4ADF620770 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 210B1900081; Tue, 15 Sep 2020 17:16:59 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 198D9900012; Tue, 15 Sep 2020 17:16:59 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B13D900081; Tue, 15 Sep 2020 17:16:59 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0099.hostedemail.com [216.40.44.99]) by kanga.kvack.org (Postfix) with ESMTP id E86E6900012 for ; Tue, 15 Sep 2020 17:16:58 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A1E301DE0 for ; Tue, 15 Sep 2020 21:16:58 +0000 (UTC) X-FDA: 77266555716.15.store97_131733e27114 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 7532F1814B0C1 for ; Tue, 15 Sep 2020 21:16:58 +0000 (UTC) X-Spam-Summary: 1,0,0,5482fca7e9e4d3ea,d41d8cd98f00b204,3sc9hxwokcc0jwmanhtweupxxpun.lxvurwdg-vvtejlt.xap@flex--andreyknvl.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:973:982:988:989:1260:1277:1313:1314:1345:1359:1431:1437:1516:1518:1535:1542:1593:1594:1711:1730:1747:1777:1792:1981:2194:2199:2393:2559:2562:2693:3138:3139:3140:3141:3142:3152:3353:3865:3866:3867:3871:4117:4250:4321:4605:5007:6261:6653:6742:8603:9969:10004:10400:10450:10455:11026:11232:11473:11658:11914:12043:12048:12297:12438:12555:12895:12986:14093:14097:14181:14394:14659:14721:19904:19999:21080:21324:21365:21444:21451:21627:21990:30054:30075,0,RBL:209.85.128.74:@flex--andreyknvl.bounces.google.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100;04yrwoz3hp7wng4ea5rx4fu9kybdsopp8xs4neqrykxktwonw7n8ow4t1oeou6z.yw37kjjq3kyk668o15tyyzd4nqmunbsbo4bb5pdz19je4cobsehmgricno74y9p.4-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNS BL:neutr X-HE-Tag: store97_131733e27114 X-Filterd-Recvd-Size: 6073 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Tue, 15 Sep 2020 21:16:57 +0000 (UTC) Received: by mail-wm1-f74.google.com with SMTP id t8so122319wmj.6 for ; Tue, 15 Sep 2020 14:16:57 -0700 (PDT) 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=NFU27GtWbL95WCt8F/LRedzvWo/LtApbnjc66sNmtks=; b=LidLdQlyti52eZWrhFHwUDuJizCaKRW6hyaJQDPEh27JNL1d+0SqlmcdF2NYGQzQTj 8OmpJEhJfeBEK+B+bvCO4r45A6t+VdFYb/W5Yl9uh3fbjCL1YPof98V406NWsKQbngiv fcL/GZ7KtxfdSHcYClU5y8Hdw2j+sPyP8HmJq/MYUC9y1HZTu7MT4ivkE1G5+ln/A2ir 2LMRHdmZxtC2INIfJmAdFUjD5w1Yw+zYrZAZXUuxQcB6fjznILZzEieeiixnMw+S8F/l DP5W0iRnd5/4Sjl8Ye0p4BbDkF9pmZ48GHG7sBUL+6Bdz7/AFgNBjuMWvzR3goJmJgl+ buwA== 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=NFU27GtWbL95WCt8F/LRedzvWo/LtApbnjc66sNmtks=; b=tMcHxMyitjsm2Ax/MhHKyAbSG+M3QGzapq5ymX0xujJh9Yq8gxT0a+Hdh3Vi6LMtdT /79ccAguVckL9/bYlihIa564LAdVzH5jEhpW7SeaWrbpsmqzvaEhvkV/qPLLS4uj+u3a A0hieXgSkKa5mcHefKJQDYKpP/bdmhn4WZ+B0Ewq2GyX/ayuUKQlFeSq0iM11zNC9w2G KLlfgKYpJJL447FK7DznBNH0wzYJtjr7jnYVzVswxxbKNWYjh9f/6ohuCBnPUL9r3uqU 9cxGu+Vku0fZ1t8YrBFs3f6UBJuz3F88shxBWYo/BThyG/rvGFv4ps+izyARuKc10sH+ qjTA== X-Gm-Message-State: AOAM531A1K/YR7Ym5SC84dumWTcqzWbuOx8iHrg9yuK4rMl+I2T9HAvH pF0brDQxI2XzEdr+wTZ11P83wfB+jdqG1nMr X-Google-Smtp-Source: ABdhPJymDPmDOkSNHrHOdoAiOAhuUVRheTqBJLYFZ0ONbNVc2apw1tqvXIMsxB8eYidBcUGd0R+qoYr0kPN/EPVS X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:adf:9c93:: with SMTP id d19mr23867458wre.275.1600204616832; Tue, 15 Sep 2020 14:16:56 -0700 (PDT) Date: Tue, 15 Sep 2020 23:15:56 +0200 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.28.0.618.gf4bc123cb7-goog Subject: [PATCH v2 14/37] kasan: rename addr_has_shadow to addr_has_metadata From: Andrey Konovalov To: Dmitry Vyukov , Vincenzo Frascino , Catalin Marinas , kasan-dev@googlegroups.com Cc: Andrey Ryabinin , Alexander Potapenko , Marco Elver , Evgenii Stepanov , Elena Petrova , Branislav Rankov , Kevin Brodsky , Will Deacon , Andrew Morton , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov X-Rspamd-Queue-Id: 7532F1814B0C1 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 --- 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 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); }