2017-11-23 07:20 UTC

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0013940CentOS-6kernelpublic2017-10-30 22:39
Reporterxyh 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version6.5 
Target VersionFixed in Version 
Summary0013940: perf: symbol lookup error: perf: undefined symbol: _hex_value
Descriptionafter i install kernel-lt rpm http://cbs.centos.org/koji/buildinfo?buildID=19747

kernel-4.9.48-29.el6.x86_64.rpm
perf-4.9.48-29.el6.x86_64.rpm

i found perf app can't run

[root@lc39 builder]# ldd -r /usr/bin/perf
        linux-vdso.so.1 => (0x00007ffed5a37000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f6a0e2a3000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f6a0e09b000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f6a0de17000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f6a0dc13000)
        libelf.so.1 => /usr/lib64/libelf.so.1 (0x00007f6a0d9fd000)
        libaudit.so.1 => /lib64/libaudit.so.1 (0x0000003a39a00000)
        libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x00007f6a0d619000)
        libslang.so.2 => /usr/lib64/libslang.so.2 (0x0000003a31e00000)
        libperl.so => /usr/lib64/perl5/CORE/libperl.so (0x000000308c000000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f6a0d3ff000)
        libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f6a0d1e6000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f6a0cfaf000)
        libutil.so.1 => /lib64/libutil.so.1 (0x00007f6a0cdac000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f6a0ca18000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f6a0e4c0000)
        libpython2.6.so.1.0 => /usr/lib64/libpython2.6.so.1.0 (0x0000003d6c000000)
        libz.so.1 => /lib64/libz.so.1 (0x0000003a31600000)
        libnuma.so.1 => /usr/lib64/libnuma.so.1 (0x0000003a3c200000)
        libfreebl3.so => /usr/lib64/libfreebl3.so (0x0000003c3e200000)
undefined symbol: _hex_value (/usr/bin/perf)
undefined symbol: _xexit_cleanup (/usr/bin/perf)
undefined symbol: __pr_debug (/usr/bin/perf)
undefined symbol: cplus_demangle_operators (/usr/bin/perf)
undefined symbol: cmdname_compare (/usr/bin/perf)
undefined symbol: scripting_max_stack (/usr/bin/perf)
undefined symbol: libiberty_demanglers (/usr/bin/perf)
undefined symbol: current_demangling_style (/usr/bin/perf)
undefined symbol: tracing_mnt (/usr/bin/perf)
undefined symbol: subcmd_config (/usr/bin/perf)
undefined symbol: __pr_warning (/usr/bin/perf)
undefined symbol: scripting_context (/usr/bin/perf)
undefined symbol: symbol_conf (/usr/bin/perf)
undefined symbol: tracing_path (/usr/bin/perf)
undefined symbol: cplus_demangle_builtin_types (/usr/bin/perf)
undefined symbol: verbose (/usr/bin/perf)
undefined symbol: error_buf (/usr/bin/perf)
undefined symbol: __pr_info (/usr/bin/perf)
undefined symbol: callchain_cursor (/usr/bin/perf)
undefined symbol: xcalloc (/usr/bin/perf)
undefined symbol: tracing_events_path (/usr/bin/perf)
undefined symbol: _sch_toupper (/usr/bin/perf)
undefined symbol: _sch_istable (/usr/bin/perf)


i found this because during rpmbuild , /usr/lib/rpm/find-debuginfo.sh will call
eu-strip to extract debuginfo
and it seems eu-strip did some thing bad
Steps To Reproducecd rpmbuild/BUILD/kernel-4.9.48-29.el6/linux-4.9.48-29.el6.x86_64/tools/perf

cp perf perf.bak
./perf
ldd -r perf

#everything is ok ,perf can run correctly
#then run follow cmd

eu-strip --remove-comment -f perf.debug perf

1、 ./perf
#output: perf: symbol lookup error: perf: undefined symbol: _hex_value
2、 ldd -r perf
# lots of "undefined symbol:"
TagsNo tags attached.
Attached Files
  • patch file icon perf-fix-debuginfo-build-bug13940.patch (2,158 bytes) 2017-10-18 23:03 -
    A patch that allows perf build in kernels 4.x with debuginfo enabled.
    https://bugs.centos.org/view.php?id=13940
    
    --- kernel.spec.centos	2017-10-10 07:51:48.000000000 -0700
    +++ kernel.spec	2017-10-18 12:13:42.649191276 -0700
    @@ -8,7 +8,7 @@
     %endif
      
     # Define the version of the Linux Kernel Archive tarball.
    -%define LKAver 4.9.54 
    +%define LKAver 4.9.57
     
     # Define the buildid, if required.
     #define buildid .1
    @@ -185,7 +185,7 @@ BuildRequires: python openssl-devel
     BuildConflicts: rhbuildsys(DiskFree) < 7Gb
     
     # Sources.
    -Source0: ftp://ftp.kernel.org/pub/linux/kernel/v3.x/linux-%{LKAver}.tar.xz
    +Source0: ftp://ftp.kernel.org/pub/linux/kernel/v4.x/linux-%{LKAver}.tar.xz
     Source1: config-i686
     Source2: config-i686-NONPAE
     Source3: config-x86_64
    @@ -605,9 +605,16 @@ popd > /dev/null
     
     %if %{with_debuginfo}
     
    +%if "%{rhel}" == "6"
     %define __debug_install_post \
       /usr/lib/rpm/find-debuginfo.sh --strict-build-id %{_builddir}/%{?buildsubdir}\
    +  %{__cp} %{_builddir}/%{?buildsubdir}/linux-%{version}-%{release}.%{_target_cpu}/tools/perf/perf $RPM_BUILD_ROOT/usr/bin/\
     %{nil}
    +%else
    +%define __debug_install_post \
    +  /usr/lib/rpm/find-debuginfo.sh --strict-build-id %{_builddir}/%{?buildsubdir}\
    +%{nil}
    +%endif
     
     %ifnarch noarch
     %global __debug_package 1
    @@ -667,6 +674,8 @@ find $RPM_BUILD_ROOT/usr/include \
     %if %{with_perf}
     # perf tool binary and supporting scripts/binaries.
     %{perf_make} DESTDIR=$RPM_BUILD_ROOT install
    +# remove the 'trace' symlink.
    +rm -f $RPM_BUILD_ROOT/%{_bindir}/trace
     
     # perf man pages. (Note: implicit rpm magic compresses them later.)
     %{perf_make} DESTDIR=$RPM_BUILD_ROOT install-man || false
    @@ -878,7 +887,6 @@ fi
     %defattr(-,root,root)
     /etc/bash_completion.d/perf
     %{_bindir}/perf
    -%{_bindir}/trace
     %{_libdir}/libperf-gtk.so
     %dir %{_libdir}/traceevent/plugins
     %{_libdir}/traceevent/plugins/*
    @@ -890,6 +898,10 @@ fi
     %endif
     
     %changelog
    +* Wed Oct 18 2017 Akemi Yagi <toracat@centos.org> 4.9.57-29
    +- Upgraded to upstream 4.9.57
    +- Fixed perf build issue (https://bugs.centos.org/view.php?id=13940)
    +
     * Tue Oct 10 2017 Johnny Hughes <johnny@centos.org> 4.9.54-29
     - Upgraded to upstream 4.9.54
     
    
    patch file icon perf-fix-debuginfo-build-bug13940.patch (2,158 bytes) 2017-10-18 23:03 +

-Relationships
+Relationships

-Notes

~0030252

toracat (manager)

Confirmed.

debuginfo was added as of kernel 4.9.31-28. The perf package prior to that kernel version did not have this problem.

~0030391

toracat (manager)

About the eu-strip command,

(1) NOTE 1
The perf file taken from the BUILD dir of the distro kernel survives the above eu-strip command.

The perf file taken from the BUILD dir of kernel-ml v4.13 fails just like the one from kernel 4.9.

(2) NOTE 2
A newer version (0.168) of eu-strip works fine on the perf file from kernels 4.9 and 4.13.

Some details:
$ sudo yum install centos-release-scl-rh
$ sudo yum install devtoolset-6-elfutils
$ scl enable devtoolset-6 bash
$ which eu-strip
/opt/rh/devtoolset-6/root/usr/bin/eu-strip
$ eu-strip -V
eu-strip (elfutils) 0.168

As expected, building kernel 4.9 using this eu-strip produces a "good" perf package.

~0030393

toracat (manager)

So, a combination of the current version (0.164) of eu-strip and newer kernels causes the reported issue.

Possible fix includes:

(1) Use a newer version of eu-strip to build the kernel (use of devtoolset-6).
(2) Apply a rather ugly patch (uploaded). It copies the perf file from the BUILD directory to the destination directory _after_ the find-debuginfo.sh has been run.

~0030404

toracat (manager)

According to @JohnnyHughes the spec file is used for both el6 and el7.

The perf package of the el7 kernel has no issue because eu-strip is 0.168 in el7. Therefore, the spec file has been modified by using '%if "%{rhel}" == "6"' . A new patch file uploaded.

~0030450

JohnnyHughes (administrator)

This issue should be fixed in kernel-4.9.58-29.el6. Please verify that one works from here:

http://cbs.centos.org/repos/virt6-xen-common-testing/x86_64/os/

~0030465

xyh (reporter)

bravo!
+Notes

-Issue History
Date Modified Username Field Change
2017-09-29 01:39 xyh New Issue
2017-09-29 05:01 toracat Status new => confirmed
2017-09-29 05:01 toracat Steps to Reproduce Updated View Revisions
2017-09-29 05:01 toracat Note Added: 0030252
2017-10-17 17:30 toracat Note Added: 0030391
2017-10-17 17:39 toracat File Added: perf-fix-debuginfo-build.patch
2017-10-17 17:42 toracat Note Added: 0030393
2017-10-18 04:37 toracat File Deleted: perf-fix-debuginfo-build.patch
2017-10-18 04:38 toracat File Added: perf-fix-debuginfo-build.patch
2017-10-18 23:03 toracat File Added: perf-fix-debuginfo-build-bug13940.patch
2017-10-18 23:07 toracat Note Added: 0030404
2017-10-18 23:07 toracat File Deleted: perf-fix-debuginfo-build.patch
2017-10-18 23:23 toracat Status confirmed => assigned
2017-10-23 20:55 JohnnyHughes Status assigned => feedback
2017-10-23 20:55 JohnnyHughes Note Added: 0030450
2017-10-25 12:17 xyh Note Added: 0030465
2017-10-25 12:17 xyh Status feedback => assigned
2017-10-30 22:39 toracat Status assigned => resolved
2017-10-30 22:39 toracat Resolution open => fixed
+Issue History