From patchwork Wed Nov 4 23:18:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11883247 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 50914C00A89 for ; Thu, 5 Nov 2020 05:03:46 +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 B772E2083B for ; Thu, 5 Nov 2020 05:03:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="W35A/90n"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="eSK5X+2C"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="FBI115kS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B772E2083B 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=VjvaPOlFzblc2wtJhDMQFzPWCRH99aS3K4z7O44o5uM=; b=W35A/90nB4Bb7BpCPYgxGqPQy bKLpNOj1TsPK2Ye5TfH29P3m0DK4sG0KJvV89bSJMEJwGvoeS2eXrYFKk2Q2aoex2SeRPszw/HGDj t8jNeQQuU9n/XbswxaHr5GOnboKZrTTK2PYFOA3XviByZGbdWSeCRqUCG7EbPFXnRcz/6T+0ulMV4 cSa0FWN5p0HH6Yc20s45YJ4XObLPCj4EebmBf/6elR7wzF6RDxkpRu00Tv0h3KgnuS/CACEyH2rPn 2TYRMTfnH8DWDzsuLIwrQCy9Im+jnaexWSOGgMTsiec9UB+Bn5REv4bQWlwP6oGnvk7GQC7f7tgGB rRmG4hvEw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaXPI-0003DJ-Vj; Thu, 05 Nov 2020 05:01:57 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaW5E-000145-QB for linux-arm-kernel@merlin.infradead.org; Thu, 05 Nov 2020 03:37:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:Cc:To:From:Subject: References:Mime-Version:Message-Id:In-Reply-To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=71dDjA4AvorvAoOL9VJG2R9YWEBiYEDCkHWbAxU+l2Y=; b=eSK5X+2CrXXSCmbF2qt7JN8gLP ADCmp4MlWX2sAJPvKwvu1o+TNhlT2kKYC7ZDGYkvY+eZ2dzc1PWshcPnn5W1wqpGb8KaATGjX9h83 NHFpMx03M9IRNXEO8sGHsmGbnQL66gksTfQCdep8DJSwSnQNJG7il5/iDkZq4iEksIEWHfNLYvgvg xwywwtLqArkbiNDxcxKMbGf/GnqJKn87Lc5L78vbIGDnXxMbj5rnKsnkM/xI1gzjBh3Rd754wrSnL drgYLmpAyKrbo3fAPGdbS32OWPnMBz/R4rYgwrPuQrmbx3mBf091mGjUP/5J8guvmtMgo+GJKlR7f 2eAEMUyg==; Received: from mail-qt1-x84a.google.com ([2607:f8b0:4864:20::84a]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaS5H-00043T-3g for linux-arm-kernel@lists.infradead.org; Wed, 04 Nov 2020 23:20:57 +0000 Received: by mail-qt1-x84a.google.com with SMTP id d21so74565qtp.2 for ; Wed, 04 Nov 2020 15:20:54 -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=71dDjA4AvorvAoOL9VJG2R9YWEBiYEDCkHWbAxU+l2Y=; b=FBI115kSl/HZmIpkt1WXy79Z+i//PiEltj41xVsYSu3pxfB6uvCPMeCRU+oAq02d/D 7LIPPK8wd3GJK76/Z+BDYn+b9//x+1d+6CNuvFjeZjdgGSu/oC1EPweJd3+Lzxv5glTp KParHjDWpvGcnPVF8ALnFfigLvYM0k4RQEq4SKir4DLZLItEIrydCxau2ueZFsuk5ey1 wFCmkxmn6P3xvclIkvvcuQ3QgGEOPklAf2B20ejqU0W5hrst28zkEu9Q97OeWYM2+gcZ nKFW6GSy5kAaylxfNizKlF6ufym23h7ZX8sxFQMxH2b9geM9FZ7JUDhzyBe8014S3GZ3 8e4w== 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=71dDjA4AvorvAoOL9VJG2R9YWEBiYEDCkHWbAxU+l2Y=; b=XXPUOECUgdPzLFogQUN/UIddq53oBw/hiSoPWqtim4YMh0TvpT6Z4R5KLSxbVdYC39 eMH9RvokmsFT5pnjXAl2dPD69iv17zzJfujqT25mm7v+jpilCmUa5pcyU630upRI0b0/ TQg95jG/fif4TC/whNjhpJvrSfxHZfBopPsukmavdDVM6CrVejnwYXX6IMlIfm3Y/Fxw Qn6pZ3PsTApD+dx34heG0aX+EETgdAU9VaKDqzzPlnKnAIJnKvyZgCOL/4hX6LKzL9P1 yngJiRBPBHSGKYTxrl2dyq5zlATVmBKjUjPllP3UB174AHoX5Llqgfjdz63UmaFxOO9U rSow== X-Gm-Message-State: AOAM5326/llPVgUixZUL+q3dXTQaYj/fVXVenOvodH5YFrDYt/SHMlhI U/yMpmtUZ4adrfW30Jd3O08+INZ1UY+fTGt9 X-Google-Smtp-Source: ABdhPJxOZwIeUmqI/nV1niN8m+2CkK4H9VN0saYIPGqBloq1ama2UCKlYbsmmzphZXOZDPNwTMjB/REABxyDqsNS X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:ad4:4512:: with SMTP id k18mr256501qvu.5.1604531992636; Wed, 04 Nov 2020 15:19:52 -0800 (PST) Date: Thu, 5 Nov 2020 00:18:34 +0100 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v8 19/43] kasan: rename addr_has_shadow to addr_has_metadata From: Andrey Konovalov To: Catalin Marinas X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201104_232055_315941_96CC975D X-CRM114-Status: GOOD ( 13.96 ) 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 , Andrey Konovalov , Kevin Brodsky , Will Deacon , 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 d0cf61d4d70d..f9366dfd94c9 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); }