From patchwork Mon Nov 23 20:07:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11926393 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=-16.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 0A2A9C83011 for ; Mon, 23 Nov 2020 20:09:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 886912071E for ; Mon, 23 Nov 2020 20:09:06 +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="rJ0wPyDS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 886912071E 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 CCC4D6B00A2; Mon, 23 Nov 2020 15:09:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C05406B00A3; Mon, 23 Nov 2020 15:09:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A59886B00A4; Mon, 23 Nov 2020 15:09:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0107.hostedemail.com [216.40.44.107]) by kanga.kvack.org (Postfix) with ESMTP id 71D066B00A2 for ; Mon, 23 Nov 2020 15:09:04 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 1E1FC824999B for ; Mon, 23 Nov 2020 20:09:04 +0000 (UTC) X-FDA: 77516771808.20.egg61_06151cf27368 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id E8CCB180C07AF for ; Mon, 23 Nov 2020 20:09:03 +0000 (UTC) X-HE-Tag: egg61_06151cf27368 X-Filterd-Recvd-Size: 6139 Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.73]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Mon, 23 Nov 2020 20:09:03 +0000 (UTC) Received: by mail-ed1-f73.google.com with SMTP id s7so6981451eds.17 for ; Mon, 23 Nov 2020 12:09:03 -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=fDQy1wc4ePFUib94ltbYtVazi0RsE8I+c8xac0+Q+Wo=; b=rJ0wPyDSmdZPXeUKe9MhjGKLsaMM8OIwtm/Sg53kDkBndhHuAHu0Ef8DkEUGSuihlD uOaC3rDAfcukQGcvItdwVDUKC2Zc2OHOwV6pXC+2IfBzeLsspGPjDa+dOEOFIFS7GvNJ Uu1kVEQ7ZjpY2uA0La7T80tuogNGb0lBz6HwH0aZGz1DhOLM9FFRPHVqn5Ku1MoN45Gw CDlthTd9ZADLhifyzJNdeDLNDAOMClT6gMUXGzchMXHinne8n1kLv1j4ckjAGW6+ly6o 8H8jjDLCOV3J4/iwccRhoUSgJsDQPum/xiJyTRtSgOI0yR9tTVObuR8NM78WH8zMVkui OPRg== 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=fDQy1wc4ePFUib94ltbYtVazi0RsE8I+c8xac0+Q+Wo=; b=lh9lrPfTrUp0kDEneiHjTWHWuc3/HRvHaHlRY0UKgEfNbVcdQ2mSaup86GRas9wTfH 6tIa4ZSniBNKkJAuW3/n+zKTd5GawSPBkZEXFgbbjwash3hbovXEw5MucWKjdbB8311z EuWP7Hc36BSFdxgpBW6Q+O9S69qXIag8xkV4qvKPUaRSpytJFzzpgxxKhs+6jEC4yVtr vaW84i/VEA3pALR3VDrLIqjimjc1wRuqQB70oArGjBVuV6VUJBxdMBLLbHpmFN1CDpTY +Ku2tURTouE1alBo2KgmpwJTESeoKE1BNLFgcnyk/lQJSb0AeRRefuBTTS6E6D2TlTo3 9/DQ== X-Gm-Message-State: AOAM532PyAHiQsv6oG5N25nmvr2OCeib6LRugtXTxg2JOek8euEipKot e8XUlkTgDbOu02PmvyK4HhNE9Yzd1M84mth/ X-Google-Smtp-Source: ABdhPJwUEGMqgP1Mwk9YauS/ahrxnBn0vv0AM7jn5w6OhhPxh7R9yPQSQDF/sQwWUPd6WhwpZ7+0rfqyIUpe209i X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:aa7:d703:: with SMTP id t3mr791202edq.375.1606162141605; Mon, 23 Nov 2020 12:09:01 -0800 (PST) Date: Mon, 23 Nov 2020 21:07:42 +0100 In-Reply-To: Message-Id: <370466fba590a4596b55ffd38adfd990f8886db4.1606161801.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog Subject: [PATCH mm v11 18/42] kasan: rename addr_has_shadow to addr_has_metadata From: Andrey Konovalov To: Andrew Morton Cc: Catalin Marinas , Will Deacon , Vincenzo Frascino , Dmitry Vyukov , Andrey Ryabinin , Alexander Potapenko , Marco Elver , Evgenii Stepanov , Branislav Rankov , Kevin Brodsky , kasan-dev@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, 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 Reviewed-by: Alexander Potapenko --- 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 488ca1ff5979..c79d30c6fcdb 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -147,7 +147,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); }