From patchwork Wed Mar 2 16:36:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrey.konovalov@linux.dev X-Patchwork-Id: 12766292 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 4543EC433F5 for ; Wed, 2 Mar 2022 16:37:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C2EE98D0008; Wed, 2 Mar 2022 11:37:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BDD468D0001; Wed, 2 Mar 2022 11:37:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ACDD58D0008; Wed, 2 Mar 2022 11:37:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0008.hostedemail.com [216.40.44.8]) by kanga.kvack.org (Postfix) with ESMTP id 9CA068D0001 for ; Wed, 2 Mar 2022 11:37:28 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 4BC879CD48 for ; Wed, 2 Mar 2022 16:37:28 +0000 (UTC) X-FDA: 79200001776.29.BB78601 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf16.hostedemail.com (Postfix) with ESMTP id EF577180019 for ; Wed, 2 Mar 2022 16:36:48 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1646239007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ReVQg90bpO6aQ9p1E17mGNBQrTUFi/5PZoBeBo27NeE=; b=CkSxgq2C4AQd4Hc/5oIgvZVdzS8i0G/red+aOhMvBK+qP+KWRBe1leENjyQER0Scn8x8s+ +JQ5jqkF9/rAvHLfhxTpE1MaNTAH3+5lHi+ABoT3biafZUWNz1r9qlaCCnYaOH+mR/AO56 glUtZxXMxV9DzLCbZno4jG0eTH+Qnxc= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH mm 02/22] kasan: more line breaks in reports Date: Wed, 2 Mar 2022 17:36:22 +0100 Message-Id: <8682c4558e533cd0f99bdb964ce2fe741f2a9212.1646237226.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: EF577180019 X-Stat-Signature: eafs3z4a9uafsf5f1h5be9g89xb98akk Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=CkSxgq2C; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf16.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev X-HE-Tag: 1646239008-801368 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 Add a line break after each part that describes the buggy address. Improves readability of reports. Signed-off-by: Andrey Konovalov Reviewed-by: Alexander Potapenko --- mm/kasan/report.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm/kasan/report.c b/mm/kasan/report.c index 607a8c2e4674..ded648c0a0e4 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -250,11 +250,13 @@ static void print_address_description(void *addr, u8 tag) 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(void *addr, u8 tag) " [%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(void *addr, u8 tag) 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 *object, unsigned long ip) 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 addr, size_t size, bool is_write, 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);