From patchwork Thu Sep 24 22:50:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11798329 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 550A0112E for ; Thu, 24 Sep 2020 22:51:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1711423600 for ; Thu, 24 Sep 2020 22:51:34 +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="pSVeZJ+M" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1711423600 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 BC51E8E0013; Thu, 24 Sep 2020 18:51:31 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B77208E0001; Thu, 24 Sep 2020 18:51:31 -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 A68E88E0013; Thu, 24 Sep 2020 18:51:31 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0175.hostedemail.com [216.40.44.175]) by kanga.kvack.org (Postfix) with ESMTP id 899F68E0001 for ; Thu, 24 Sep 2020 18:51:31 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 529B11E0E for ; Thu, 24 Sep 2020 22:51:31 +0000 (UTC) X-FDA: 77299453182.12.rat27_4c1751627162 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 32BD118016667 for ; Thu, 24 Sep 2020 22:51:31 +0000 (UTC) X-Spam-Summary: 1,0,0,965c059f16c71512,d41d8cd98f00b204,38sjtxwokcowobrfsmybjzuccuzs.qcazwbil-aayjoqy.cfu@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.221.73:@flex--andreyknvl.bounces.google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100;04ygqikgoxd9ey5356o9rznq347hyopp8xs4neqrykxktwonw7n8ow4t1oetszc.z4az4mjq3kyk668tjhyinmeko6munbsbo4bb5pdz19je4cobsehmgricno74y9p.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: rat27_4c1751627162 X-Filterd-Recvd-Size: 6071 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Thu, 24 Sep 2020 22:51:30 +0000 (UTC) Received: by mail-wr1-f73.google.com with SMTP id o6so297654wrp.1 for ; Thu, 24 Sep 2020 15:51:30 -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=hIFfthxFzKDNttx6Iwa15uG/YA2TsOtV5/OtZQz4D6k=; b=pSVeZJ+Mo6ZWifAuS+6KCEX5EJxKTmAawvnqmG+62ZIqI8wE8ZOk0hn0O9ns5i2phJ s30NK/lLkW4w4L5khmsq9riWXwa4rx2E9xlWXa8+LKwc7CbFbOEN/lADZOIP/YKrXRtn YpE/MgV5UV3uzh/LVu6RAIxKaLLhiLAgSHq3qmj+5EjUaE6ZTC1tMHPT5HmfU57+t1gG DUEpyJCz72NrVP5uQQDxIChAaeWFPv0hwiQqM1HQAM1FJ8D02vTkVZ8fkZ1YAdVf3Xj6 eIDapAyz+LWvq5r52TLARW0wYAs5rMBZHmwYG3wFPOXmGb2hAq7rsNvwXd8S6rw9nAKq 7oqg== 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=hIFfthxFzKDNttx6Iwa15uG/YA2TsOtV5/OtZQz4D6k=; b=ZmNSqWt+ARN6XCi+n28LVpVx3wezVO6tB7YQQPxBa//kjD0IlEV1JQRHORv3qtUNu/ LHyQsEy4W4376TOnv+27joO4ruYCzmizuZfMeg3Y0QG6faZyiYc/tOWlzlysyb2ik9bu S0jo5Ov7/xxA6Rk1b2UE9ByP9DFtXwmlqugag42nSKAmTX5myWtTGNDjOVJsjLa67bOS 80K0ApxhbjRLfQY+mNlumnHHdhcVcn4p1fOnJoIH3CnwyvaQmSLb4Se36Bs/frYrKWjk 8wSoYpluihEom5yU1oa/Z1yDXPuo6P4w91UnaVTHpqQGApe7wAF+0I9EfxMik59AwpwO sHBg== X-Gm-Message-State: AOAM532rLFsdvbWhJoj9nz936lPWbwNQOhXSFMyLyBY/pe0p/4npeDEQ Sa460dKMVa58FoBpHmqd2rio3kVSLw8f7222 X-Google-Smtp-Source: ABdhPJy5ULe6GUSQ5xDjMfDpd+cYJ8T54lZ2I/FeR/jw8GWQfUtfFJA8p7zrE57Z9aqLqoVj7Fe2KFlpULY4cs7D X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a5d:60cc:: with SMTP id x12mr1196294wrt.84.1600987889651; Thu, 24 Sep 2020 15:51:29 -0700 (PDT) Date: Fri, 25 Sep 2020 00:50:23 +0200 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog Subject: [PATCH v3 16/39] 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-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, 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 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 8dfacc0f73ea..0bf669fad345 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 91b869673148..145b966f8f4d 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -329,7 +329,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; @@ -340,11 +340,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 42b2b5791733..ff067071cd28 100644 --- a/mm/kasan/report_generic.c +++ b/mm/kasan/report_generic.c @@ -117,7 +117,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); }