Bug 2219333

Summary: regression: perf probe fails to add uprobes for certain binaries
Product: [Fedora] Fedora Reporter: Georg Müller <georgmueller>
Component: kernel-toolsAssignee: Justin M. Forbes <jforbes>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 38CC: acaringi, jforbes, jwboyer, lgoncalv, pbrobinson, ptalbert
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Georg Müller 2023-07-03 09:05:38 UTC
When trying to add a probe point for systemd (with systemd-debuginfo installed), perf returns an error:

  A function DIE doesn't have decl_line. Maybe broken DWARF?

The problem comes down to kernel commit dc9a5d2ccd5c ("perf probe: Fix to get declared file name from clang DWARF5")

I tried to report and patch the issue directly on LKML, but I got no response so far:
https://lore.kernel.org/all/5a00d5a5-7be7-ef8a-4044-9a16249fff25@gmx.net/


Reproducible: Always

Steps to Reproduce:
1. install systemd and systemd-debuginfo
2. run 'sudo perf probe -x /usr/lib/systemd/systemd-logind match_unit_removed'

Actual Results:  
perf probe returns an error with the following output:

A function DIE doesn't have decl_line. Maybe broken DWARF?
A function DIE doesn't have decl_line. Maybe broken DWARF?
Probe point 'match_unit_removed' not found.
  Error: Failed to add events.


Expected Results:  
With the patch applied, perf probe returns the following output:

Added new event:
  probe_systemd:match_unit_removed (on match_unit_removed in /usr/lib/systemd/systemd-logind)

You can now use it in all perf tools, such as:

	perf record -e probe_systemd:match_unit_removed -aR sleep 1



The patch is inspired by a patch to elfutils:

https://sourceware.org/git/?p=elfutils.git;a=commitdiff;h=e1db5cdc9f230f8de4df1a0f38dca69b283ee57a

Full information is available in the upstream email:

https://lore.kernel.org/lkml/20230628084551.1860532-3-georgmueller@gmx.net/