From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D42EC433FE for ; Tue, 1 Nov 2022 13:30:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229591AbiKANaW (ORCPT ); Tue, 1 Nov 2022 09:30:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230149AbiKANaE (ORCPT ); Tue, 1 Nov 2022 09:30:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2AA513E20; Tue, 1 Nov 2022 06:30:03 -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 783C361326; Tue, 1 Nov 2022 13:30:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B30FC433C1; Tue, 1 Nov 2022 13:30:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667309402; bh=dOBkh2Voj6UgfzAK9AwIha7a75ZaMGSpzsdKHn+BTOM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KEP7pSmtclln9h4NGUy/PbL5ZX3RG/w3N2KGYv22vLb7y/T40LC3SKX0yxIDcjjwx XJyNuaEvsvkfYOzbq/32yf58O8/b8j29D09D8HyJd43pgeqD4YEeuguD3aCotbl19o ftMS3gPJoF+fOvaruD6CcIxtS7iVsPIMqfO3nNloazTOWZWgwYudz9hb4+oQtbIgMg N/blHjI1Ohddox0cIeGlNmq/hG1ACP5n/E8unZISHknkfHk2+3uc3E5PWxfdsjNaKa UHc5VIGEufpomBchRrP7BFOBFuwt4qHhye7Pz+jKoGkK208Zc1IzcLF18Hu1Uh5vRV QsCAfUL0AmRyQ== Date: Tue, 1 Nov 2022 22:29:59 +0900 From: Masami Hiramatsu (Google) To: "Masami Hiramatsu (Google)" Cc: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Steven Rostedt Subject: Re: [PATCH 0/3] tools/perf: Fix perf probe crash by broken DWARF file Message-Id: <20221101222959.0815521a31e45c1ddabad756@kernel.org> In-Reply-To: <166730844138.2095228.4225918836201778608.stgit@devnote3> References: <166730844138.2095228.4225918836201778608.stgit@devnote3> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org On Tue, 1 Nov 2022 22:14:01 +0900 "Masami Hiramatsu (Google)" 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 > > > 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) -- Masami Hiramatsu (Google)