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: 11926721 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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,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 CA84AC2D0E4 for ; Mon, 23 Nov 2020 20:42:26 +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 42EEF204FD for ; Mon, 23 Nov 2020 20:42:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="RT29c2j3"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="A6GDNw6O"; 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 42EEF204FD 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=z0khnENBjjWP2qREOsrOk56CjWOGRLCmY/Izz2Q+X1A=; b=RT29c2j3AZs424B2D/E71wQG0 TShad1K9e7L5LnFBhOYfQ75Ejnefuf9pJL0Z928Tje5IHlIm/Ux95kgasPbrNkzHy1Xa/o4TPjd/m ITMG9n0Sb9mc5qz6WSi3nxljBCmjzPCY9SQHYX8kc905F702W1vYar+Vx2sgQh+LJoiGsZzKpchL9 bmq/m958WMbjZENY63fRqkNRYIQsrMPw4YIRwLTKdFQ5p45NAyBZFUAfdsBggOm1Qfp906IKqQYjX AnTsnlnmqCNinS5M2iAF1Q+DSCXecociBrg6q7jPSI8K0QM5ye/Fw2pS/JNlUorFB0x5cwZMqD5Fn CVz3piehQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1khIeX-0005Zw-Ha; Mon, 23 Nov 2020 20:41:37 +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 1khIPD-0006KM-NU for linux-arm-kernel@merlin.infradead.org; Mon, 23 Nov 2020 20:25:47 +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=fDQy1wc4ePFUib94ltbYtVazi0RsE8I+c8xac0+Q+Wo=; b=A6GDNw6OdjuL3qdendOFNCnrbe fs2ejd/sgDJPziRncuWAFLiuoMXKo6RgksdNz2MkdlkWzTBNqIvpoQprkcsm1TFWdfZsFymJPuJ0Y 38yeNVZy7Qfq6Djn+fiT0BPSd8tyc28nerwnl4vesUs/dnaoXwqcOhvf0rJW846xcaxiFsB295n0m QK1Cf5LBkNvw2/PiDNgKLwEGf7KtwNlGrgC8JM9aH4ufUkg+v6gsASAoDcD7iGtJH871IV+/JYig8 kigAPNHgv70PzqFoJhgq0nj85Kvji+Gm83RJXXx1e4zglgKOn4mR3ZyX7tSgXmTAHM1IyMR8HYPIG NKbkNVHg==; Received: from mail-ed1-x549.google.com ([2a00:1450:4864:20::549]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1khI92-0005HQ-DH for linux-arm-kernel@lists.infradead.org; Mon, 23 Nov 2020 20:09:09 +0000 Received: by mail-ed1-x549.google.com with SMTP id dj19so7036417edb.13 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=W7ZYx6N2zMlmdMWSuGiPgZrIp/KdWDj41/i3Lt3FankpjuTQ2y8FgFPaznqYtXxKyo LzGFHDpyB6enrKEJNKiX+CcJ4t3fCi0fNRn+A63kaCv4Tlv9UxqUe4pgTXyWgY62kLZZ IaYN8G0WcCol3fuZalGffAdSOveB6+e9d7dbM6njQRFa2Q3shQUt5gyXvJdpGd26DR2F Fl0u8P2qdI5ovA/SN1EmpOhdKDU88BsbV08m0XV9mf9v0doOAxbPRUgNsmR7zLvqFP3y RTQpKQfiMo/sxqydG6MPUinLONoqXX6FeidifA1ROFZGYfFut5f8A5xWO+vneoun3pln BDsQ== X-Gm-Message-State: AOAM530qmKMsKeJYtYFjYAd6WlLXrC+SNf3kI34jfdxvdjzmynM+8K0i OfjvFuXDxtWLcRgx3lCigiUOIO8zVdJxFHZJ 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201123_200905_747455_FF777518 X-CRM114-Status: GOOD ( 14.03 ) 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 , Catalin Marinas , Kevin Brodsky , Will Deacon , Branislav Rankov , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexander Potapenko , Evgenii Stepanov , Andrey Konovalov , Andrey Ryabinin , 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 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); }