From patchwork Fri Mar 25 01:12:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12791174 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75358C433F5 for ; Fri, 25 Mar 2022 01:12:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 008A48D0020; Thu, 24 Mar 2022 21:12:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EF9448D0005; Thu, 24 Mar 2022 21:12:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC1398D0020; Thu, 24 Mar 2022 21:12:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id CD1A98D0005 for ; Thu, 24 Mar 2022 21:12:20 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A6431CFA for ; Fri, 25 Mar 2022 01:12:20 +0000 (UTC) X-FDA: 79281132840.04.D24DB41 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf24.hostedemail.com (Postfix) with ESMTP id 29286180017 for ; Fri, 25 Mar 2022 01:12:20 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 30DC0B82709; Fri, 25 Mar 2022 01:12:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBAFBC340EC; Fri, 25 Mar 2022 01:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1648170737; bh=3qvwsQTjMidRCLTYP6z768o2hxVRhUmxnEZJGnCFHmA=; h=Date:To:From:In-Reply-To:Subject:From; b=NKYd3rM//YmT3JOOVIB2QTUd9nOldmo+9sIev4/6KBZstm2Co7Q/TRWBzaUBX+txU ueCDN5pIPIN309IV5QZtENFGORJIDK0zDMODiRnfofVLmbRR27gpU63+zZ5o1orwTe zUc2hTJGesUweTrXn2ifHaaeMGPJy+s3MeQK/DFU= Date: Thu, 24 Mar 2022 18:12:17 -0700 To: ryabinin.a.a@gmail.com,glider@google.com,elver@google.com,dvyukov@google.com,andreyknvl@google.com,akpm@linux-foundation.org,patches@lists.linux.dev,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220324180758.96b1ac7e17675d6bc474485e@linux-foundation.org> Subject: [patch 074/114] kasan: more line breaks in reports Message-Id: <20220325011217.BBAFBC340EC@smtp.kernel.org> X-Stat-Signature: d7zi4f1x1tuk6tbjcszyupgxac6paum1 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="NKYd3rM/"; spf=pass (imf24.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 29286180017 X-HE-Tag: 1648170740-61923 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Andrey Konovalov Subject: kasan: more line breaks in reports Add a line break after each part that describes the buggy address. Improves readability of reports. Link: https://lkml.kernel.org/r/8682c4558e533cd0f99bdb964ce2fe741f2a9212.1646237226.git.andreyknvl@google.com Signed-off-by: Andrey Konovalov Reviewed-by: Alexander Potapenko Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Marco Elver Signed-off-by: Andrew Morton --- mm/kasan/report.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/mm/kasan/report.c~kasan-more-line-breaks-in-reports +++ a/mm/kasan/report.c @@ -250,11 +250,13 @@ static void print_address_description(vo void *object = nearest_obj(cache, slab, addr); describe_object(cache, object, addr, tag); + pr_err("\n"); } if (kernel_or_module_addr(addr) && !init_task_stack_addr(addr)) { pr_err("The buggy address belongs to the variable:\n"); pr_err(" %pS\n", addr); + pr_err("\n"); } if (is_vmalloc_addr(addr)) { @@ -265,6 +267,7 @@ static void print_address_description(vo " [%px, %px) created by:\n" " %pS\n", va->addr, va->addr + va->size, va->caller); + pr_err("\n"); page = vmalloc_to_page(page); } @@ -273,9 +276,11 @@ static void print_address_description(vo if (page) { pr_err("The buggy address belongs to the physical page:\n"); dump_page(page, "kasan: bad access detected"); + pr_err("\n"); } kasan_print_address_stack_frame(addr); + pr_err("\n"); } static bool meta_row_is_guilty(const void *row, const void *addr) @@ -382,7 +387,6 @@ void kasan_report_invalid_free(void *obj kasan_print_tags(tag, object); pr_err("\n"); print_address_description(object, tag); - pr_err("\n"); print_memory_metadata(object); end_report(&flags, (unsigned long)object); } @@ -443,7 +447,6 @@ static void __kasan_report(unsigned long if (addr_has_metadata(untagged_addr)) { print_address_description(untagged_addr, get_tag(tagged_addr)); - pr_err("\n"); print_memory_metadata(info.first_bad_addr); } else { dump_stack_lvl(KERN_ERR);