Bug 1986555

Summary: Comments for dwfl_module_addrinfo in /usr/include/elfutils/libdwfl.h inaccurate
Product: [Fedora] Fedora Reporter: William Cohen <wcohen>
Component: elfutilsAssignee: Mark Wielaard <mjw>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 34CC: aoliva, fche, jakub, me, mjw
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-27 15:12:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
change in code to trigger issue. none

Description William Cohen 2021-07-27 18:40:49 UTC
Created attachment 1806404 [details]
change in code to trigger issue.

Description of problem:  The comment for dwfl_module_addrinfo says that offset and sym can be NULL in the following comment lifted from libdwfl.h:

   If
   OFFSET is not NULL it will be filled in with the difference from
   the start of the symbol (or function entry).  If SYM is not NULL it
   is filled in with the symbol associated with the matched ADDRESS.

However, the  __nonnull_attribute__ (3) will prevent any code passing in a const NULL for offset for compiling. Also when attempting to simplfy systemtap tapset.cxx:2287 and eliminated sym found that the code would crash in libdwfl.


Version-Release number of selected component (if applicable):
elfutils-devel-0.185-2.fc34.x86_64


How reproducible:
Every time


Steps to Reproduce:
1. Set up a local build of systemtap from systemtap git repo
2. patch -p1 < sym_null.patch
3. make
4. sudo make install
5. ~/research/profiling/systemtap_write/install/bin/stap -v -L 'kernel.function("*")'
6. git reset --hard
7. patch -p1 < offset_null.patch
8. make

Actual results:

The first build with the sym_null builds and installs, but core dumps when trying to use it to list out the functions available.  The build with offset_null.patch fails to build.


Expected results:

The comments in libdwfl.h are accurate and following information in the comment sections for a function work as advertised.


Additional info:

Suspect there other inaccuracies in the comments of libdwfl.h.

Comment 2 Ben Cotton 2022-05-12 16:14:34 UTC
This message is a reminder that Fedora Linux 34 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 34 on 2022-06-07.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '34'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 34 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 3 Mark Wielaard 2022-05-15 20:02:26 UTC
Proposed patch: https://sourceware.org/pipermail/elfutils-devel/2022q2/005063.html

Comment 4 Mark Wielaard 2022-05-27 15:12:59 UTC
Proposed patch pushed upstream now. Fix should come with the next release 0.188.