From patchwork Tue Nov 10 22:10:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11895631 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 1DD37C388F7 for ; Tue, 10 Nov 2020 22:19:30 +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 7B1A120674 for ; Tue, 10 Nov 2020 22:19:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="diy+w/Zv"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="X7YjSmgD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B1A120674 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=5V5d2/7mMavY02pouRo4YkDeOerL+m6sn0+wp+VbVBE=; b=diy+w/ZvW2Z8bSQnoLVWhcvIW Ed5F+2BrHw84lCsI5Nb1ZVDghuMzKMKIiHGgSiko/CL/2CzVXg8J/nMMXhON+ECP19+e/DxE/RJTn 5eorrB0MZXkBRG1yXp5zK8RsAcYS1gpj3P1azNW8TBXOh1EocVGAYvwZ4zuq/bZeRJt/AI4N5r8VF FOlZIjIS4JZ8hDTx4igFrr5qhpiHTr1oKoqp7TjreEUhQuqSce3w2+NC/EbX8BmZNWgdc/riurLDS WDGAg2483pXwxg0/Z626/0teE92W5yqCMmPzH9TFr2TPwbq1en2dzEj6FAI8jHEV0CWwUO3dISJ7U Pzh40lRFw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcbyJ-0007f7-Tz; Tue, 10 Nov 2020 22:18:40 +0000 Received: from mail-wr1-x44a.google.com ([2a00:1450:4864:20::44a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcbrn-0004ik-HP for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2020 22:12:10 +0000 Received: by mail-wr1-x44a.google.com with SMTP id f4so3141814wru.21 for ; Tue, 10 Nov 2020 14:11:53 -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=f+E/U7KjS3eO8ZHDl6v4LSa9uLmsgT0jRyLIgabh0JI=; b=X7YjSmgDgqw/GkR1lRrxq4ovWrU12ui5KYT7RQigdLleKzs3agIiKQA8S0UX/pfOTv fFXzdJtzRSEnaE8zcnIU91PxCq4+8mq1wvwz2GCDbmUiR2JOkIEbDOfEsszMz3WUR1vM Zb4m3V7CdtBtZFoZ1WuV/LYlJ6BAmV7RY1lwBLT5MxkYs/KbVV6kZYBpQu5S7QdQuVIm YyUu4xi6ET0N8RnOxHdQIKmxFbYjGmlu4OlHOg5Wk7MDoBqupPdhroimN8NNRQ0JzZr1 qeshPt5bunj4WBxX+rDuqWRjGbEphczywT15/j3E21j469Ax/hVf5pdggblQgax2ymHt Dszg== 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=f+E/U7KjS3eO8ZHDl6v4LSa9uLmsgT0jRyLIgabh0JI=; b=J6G0dH1l+LkfAevxu1Z72a882irU5kzDfmtfcYk6h0gsffE0aAuuD4a0Wn4whvYmbe xgBmGf+JSB9kGktPr0nEBsPxENxkciA0kSCBnJOSQjlKbLhColW2E1yiLY61qGItdNPN 8yXjScEmaCcxyfAU/MU+6GIpnb7Sx4MJfF+gJpLKzgRWGbGDjVQLegTXrS37RnXjlmDa e54ZkzauJFdoIJPJfZM7BdSDPQjkDebpkT+6a2gxlXYtnztT9IhgKsoII+jfPjcY3zeN oez84LzorHxBE4tifA/niQTZeRLooAeq6c68DmnmOHRtUZOY/uNvl2AugA04yLxX4rlB aRNA== X-Gm-Message-State: AOAM5320O2auZAB27/oUoh+keIT9Qg1+O4tmJ97TB5TU3CLP5Y8wgvje c3Us/QY4JVoliYR4JEiGFyXty0pYGaj/Ta1k X-Google-Smtp-Source: ABdhPJwbVtcgj+xi/Fz4l7oVykIlMjQWukNzC5AJLtbBDxGuK7HJnhq7/szbmS7dFWsufi9txYoAQR1MH5W01KgZ X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a5d:530c:: with SMTP id e12mr20014512wrv.355.1605046312145; Tue, 10 Nov 2020 14:11:52 -0800 (PST) Date: Tue, 10 Nov 2020 23:10:16 +0100 In-Reply-To: Message-Id: <1034f823921727b3c5819f6d2cdfc64251476862.1605046192.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8-goog Subject: [PATCH v9 19/44] 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-20201110_171155_686878_C3157275 X-CRM114-Status: GOOD ( 15.34 ) 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 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 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); }