Message ID | 166730844138.2095228.4225918836201778608.stgit@devnote3 |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2962440wru; Tue, 1 Nov 2022 06:23:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tVwWSyDJgj+V9c5UyDguZhGXvRy2Jx8asl6mW2S6IdIvtREMfbcbQzo/nLIzyAnlxa2uH X-Received: by 2002:a05:6a00:e0f:b0:56d:6e51:3060 with SMTP id bq15-20020a056a000e0f00b0056d6e513060mr11477354pfb.55.1667308982880; Tue, 01 Nov 2022 06:23:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667308982; cv=none; d=google.com; s=arc-20160816; b=NCO2oXYbFq8zo0tzZCyUmvdBOBGDsjWZeXsqiqFvpfyWKz/X4xQJkapYovxhzyYtIh qLeWrBvYajEIPHSrKGl5+5vgl/zwqE+7dD4rcBf4Z1RoUKgI7j+9c0RqKC6CjgzMA/72 A/pNm/x+avFUAEJx/UQwQnDYNdJ1RJHrMs58B+KQmriQjytZxE6nOg46m1CuhQcOA2mz 7ZrE7cxnGV5EdOEdX0Wjq9qR5hlLnTIBPetldm8pS7fHCdmnF5Wtb086SOl9wRyNTwXe 9kIVJn2pdwduNl4pkDiCiJpm8WfzghI+AQfNRV1PJoTw5ksQKKx5plVzLorPPiH16BJ5 zGnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:date:subject:cc:to:from:dkim-signature; bh=bhOZtPUZEZJsZkSzrYPBj5EHA3xuxerZ7afFmwmOysY=; b=Y7l+PajrvMxE9XivdKzP0ipHv/D5D+doIzRGxg0RDxzWQgQmJhvjIVrv0V88JIwfwV S2JoH4Or58BLrA1fuTwuD0EcW+Y+4ZlEjY9kZtRwX+WEg5kY+vC0T+LARenBTdkkcCMz I3UM5M17EghEW3lhe3PlbHRwh+8dKijljlS9CxWX1nBvHtYAObT2hUs/QLqEc9xY8FbQ 5g6EuHVn+5WwDF4t5ooKFp0YbMn78uanFdGwJIt9rEVYqrL5MnSu083zwahrmCSk07CM lxKmhVTE0yFrEJL7JXAF3EKKTpsA82gNygnzi1Utt7a37zY/yy7LZqdaFxQd3YD4nEtO YU3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rCHiuN2j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b1-20020a170902ed0100b001870a181f24si10109085pld.222.2022.11.01.06.22.34; Tue, 01 Nov 2022 06:23:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rCHiuN2j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229475AbiKANOJ (ORCPT <rfc822;kartikey406@gmail.com> + 99 others); Tue, 1 Nov 2022 09:14:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229841AbiKANOH (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 1 Nov 2022 09:14:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5173D63A4; Tue, 1 Nov 2022 06:14:06 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id DFCE560B08; Tue, 1 Nov 2022 13:14:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FE1BC433D6; Tue, 1 Nov 2022 13:14:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667308445; bh=HdynqWV3zJNf8wdpTZitVUjqPw4u0VHzGnPqRvKGnUQ=; h=From:To:Cc:Subject:Date:From; b=rCHiuN2j57z89+8MVaN1hHdTlBE/bmvPjcB3strnvvklfUWxRM8IEn7BIusFozlso fudevNRSh2d/IoNPnePTiaEEDG6jAFw0UUUbboC60c4hQdY28btkbzTNad62DVhCja wza6p4y9+047PTpA8qRoMKWIuTAST3ctw6V9R6KoZO6oUCgEf236TQHy6lrKM5Zsag afgps7gF67A62waXTnJfznUGlFalWtiqiVU8Ps7t12nSCvf94N1SwudHgqhCc9cca0 Ssyev8f0uu66j7SN676ruZNJfForqolgXbWUR5M/9CnJrJdfrUSO13s4yLDniBkJI3 vjPXU/fJPMzmA== From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org> To: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Masami Hiramatsu <mhiramat@kernel.org>, Steven Rostedt <rostedt@goodmis.org> Subject: [PATCH 0/3] tools/perf: Fix perf probe crash by broken DWARF file Date: Tue, 1 Nov 2022 22:14:01 +0900 Message-Id: <166730844138.2095228.4225918836201778608.stgit@devnote3> X-Mailer: git-send-email 2.38.1.273.g43a17bfeac-goog User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748300183991326531?= X-GMAIL-MSGID: =?utf-8?q?1748300183991326531?= |
Series |
tools/perf: Fix perf probe crash by broken DWARF file
|
|
Message
Masami Hiramatsu (Google)
Nov. 1, 2022, 1:14 p.m. UTC
Hi, Here is a series of patches for perf probe which improves the robustness against broken DWARF file. Since the Clang generates the out of standard DWARF5 file, the perf probe crashes or failed to analyze it. There are actually fragile code against it, so I fixed it ([1/3]) to avoid crash by SEGV. And make it accepts Clang's DWARF5 file ([2/3],[3/3]). Without this series, the perf probe crashes with the DWARF5 file which generated by clang as below; $ ./perf probe -k $BIN_PATH/vmlinux -s $SRC_PATH -L vfs_read:10 Segmentation fault This series fixes it to handle such file correctly; $ ./perf probe -k $BIN_PATH/vmlinux -s $SRC_PATH -L vfs_read:10 <vfs_read@$SRC_PATH/fs/read_write.c:10> 11 ret = rw_verify_area(READ, file, pos, count); 12 if (ret) return ret; This issue is reported on LLVM ML; https://www.mail-archive.com/dwarf-discuss@lists.dwarfstd.org/msg00884.html Thank you, --- Masami Hiramatsu (Google) (3): tools/perf: Fix to avoid crashing with a broken DWARF file tools/perf: Fix to use dwarf_attr_integrate for generic attr accessor tools/perf: Fix to get declared file name from broken DWARF5 tools/perf/util/dwarf-aux.c | 58 ++++++++++++++++++++++++++++------------ tools/perf/util/dwarf-aux.h | 3 ++ tools/perf/util/probe-finder.c | 37 +++++++++++++++++--------- 3 files changed, 68 insertions(+), 30 deletions(-) -- Masami Hiramatsu (Google) <mhiramat@kernel.org>
Comments
On Tue, 1 Nov 2022 22:14:01 +0900 "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote: > Hi, > > Here is a series of patches for perf probe which improves the robustness > against broken DWARF file. > > Since the Clang generates the out of standard DWARF5 file, the perf probe > crashes or failed to analyze it. There are actually fragile code against > it, so I fixed it ([1/3]) to avoid crash by SEGV. And make it accepts > Clang's DWARF5 file ([2/3],[3/3]). > > Without this series, the perf probe crashes with the DWARF5 file > which generated by clang as below; > > $ ./perf probe -k $BIN_PATH/vmlinux -s $SRC_PATH -L vfs_read:10 > Segmentation fault > > This series fixes it to handle such file correctly; > > $ ./perf probe -k $BIN_PATH/vmlinux -s $SRC_PATH -L vfs_read:10 > <vfs_read@$SRC_PATH/fs/read_write.c:10> > > 11 ret = rw_verify_area(READ, file, pos, count); > 12 if (ret) > return ret; > > This issue is reported on LLVM ML; > https://www.mail-archive.com/dwarf-discuss@lists.dwarfstd.org/msg00884.html Hmm, according to the discussion in this thread, this spec is under discussion (still?). As far as I can see the "DWARF Debugging Information Format Version 5" 2.14, it says "The value 0 indicates that no source line has been specified." But the description will be updated(?) http://wiki.dwarfstd.org/index.php?title=DWARF5_Line_Table_File_Numbers Let me update the series so that carefully remove the "broken". Maybe "clang" DWARF5? Thank you, > > Thank you, > > --- > > Masami Hiramatsu (Google) (3): > tools/perf: Fix to avoid crashing with a broken DWARF file > tools/perf: Fix to use dwarf_attr_integrate for generic attr accessor > tools/perf: Fix to get declared file name from broken DWARF5 > > > tools/perf/util/dwarf-aux.c | 58 ++++++++++++++++++++++++++++------------ > tools/perf/util/dwarf-aux.h | 3 ++ > tools/perf/util/probe-finder.c | 37 +++++++++++++++++--------- > 3 files changed, 68 insertions(+), 30 deletions(-) > > -- > Masami Hiramatsu (Google) <mhiramat@kernel.org>