<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>32826</bug_id>
          
          <creation_ts>2016-11-30 13:23:32 +0300</creation_ts>
          <short_desc>verify_rpath when both RUNPATH and RPATH are set</short_desc>
          <delta_ts>2016-12-01 10:06:31 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>rpm-build</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>32821</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Ivan Zakharyaschev">imz</reporter>
          <assigned_to name="placeholder@altlinux.org">placeholder</assigned_to>
          <cc>arseny</cc>
    
    <cc>glebfm</cc>
    
    <cc>imz</cc>
    
    <cc>ldv</cc>
    
    <cc>placeholder</cc>
    
    <cc>vt</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>160325</commentid>
    <comment_count>0</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2016-11-30 13:23:32 +0300</bug_when>
    <thetext>rpm-build-4.0.4-alt100.95

In the last release, I have made verify-elf to pass both RUNPATH and RPATH to verify_rpath(). This is a buggy.

If both are set, now, this makes such ELFs be discarded:


$ RPM_BUILD_ROOT=/usr /usr/lib/rpm/verify-elf /usr/lib64/libdw-0.155.so
section [18] &apos;.tbss&apos;: alloc flag set but section not in any loaded segment
verify-elf: ERROR: /usr/lib64/libdw-0.155.so: eu-elflint failed
verify-elf: ERROR: /usr/lib64/libdw-0.155.so: RPATH contains a non-ascii entry: /usr/lib64/elfutils
/usr/lib64/elfutils
verify-elf: ERROR: /usr/lib64/libdw-0.155.so: RPATH contains illegal entry &quot;/usr&quot;: /usr/lib64/elfutils
/usr/lib64/elfutils
$ objdump -p /usr/lib64/libdw-0.155.so | fgrep PATH
  RPATH                /usr/lib64/elfutils
  RUNPATH              /usr/lib64/elfutils
$ rpm -qf /usr/lib64/libdw-0.155.so
elfutils-0.155-alt2
$ 

(This is an old version of elfutils, just used as an example here.)

Hopefully, this is a very rare case that both are set in Sisyphus.

This case should be error_strict.

(I have overlooked that in verify_rpath(), unlike in other 3 cses where rpath is analyzed, it is not split into lines by : first.)

BTW, here is an example of the output of LD_DEBUG=libs , which I&apos;d like to use in a further enhancement to get the standard search path (and to prefix it with RPM_BUILD_ROOT) -- to be as close to the real behavior of the runtime linker as possible. (As for verify_rpath()&apos;s check for the presence of standard patsh in rpath, it should probably take into account not only the arch-specific set of search paths, but all possible ones as looked into by ldconfig, because their presence may signal an error, too.)


$ LD_TRACE_LOADED_OBJECTS=1 LD_DEBUG=libs /lib64/ld-linux-x86-64.so.2 --inhibit-cache /usr/lib64/libdw-0.155.so
      9473:	find library=libelf.so.1 [0]; searching
      9473:	 search path=/usr/lib64/elfutils/tls/x86_64:/usr/lib64/elfutils/tls:/usr/lib64/elfutils/x86_64:/usr/lib64/elfutils		(RUNPATH from file /usr/lib64/libdw-0.155.so)
      9473:	  trying file=/usr/lib64/elfutils/tls/x86_64/libelf.so.1
      9473:	  trying file=/usr/lib64/elfutils/tls/libelf.so.1
      9473:	  trying file=/usr/lib64/elfutils/x86_64/libelf.so.1
      9473:	  trying file=/usr/lib64/elfutils/libelf.so.1
      9473:	 search path=/lib64/tls/x86_64:/lib64/tls:/lib64/x86_64:/lib64:/usr/lib64/tls/x86_64:/usr/lib64/tls:/usr/lib64/x86_64:/usr/lib64		(system search path)
      9473:	  trying file=/lib64/tls/x86_64/libelf.so.1
      9473:	  trying file=/lib64/tls/libelf.so.1
      9473:	  trying file=/lib64/x86_64/libelf.so.1
      9473:	  trying file=/lib64/libelf.so.1
      9473:	  trying file=/usr/lib64/tls/x86_64/libelf.so.1
      9473:	  trying file=/usr/lib64/tls/libelf.so.1
      9473:	  trying file=/usr/lib64/x86_64/libelf.so.1
      9473:	  trying file=/usr/lib64/libelf.so.1
      9473:	
      9473:	find library=libdl.so.2 [0]; searching
      9473:	 search path=/usr/lib64/elfutils		(RUNPATH from file /usr/lib64/libdw-0.155.so)
      9473:	  trying file=/usr/lib64/elfutils/libdl.so.2
      9473:	 search path=/lib64:/usr/lib64		(system search path)
      9473:	  trying file=/lib64/libdl.so.2
      9473:	
      9473:	find library=liblzma.so.5 [0]; searching
      9473:	 search path=/usr/lib64/elfutils		(RUNPATH from file /usr/lib64/libdw-0.155.so)
      9473:	  trying file=/usr/lib64/elfutils/liblzma.so.5
      9473:	 search path=/lib64:/usr/lib64		(system search path)
      9473:	  trying file=/lib64/liblzma.so.5
      9473:	
      9473:	find library=libbz2.so.1 [0]; searching
      9473:	 search path=/usr/lib64/elfutils		(RUNPATH from file /usr/lib64/libdw-0.155.so)
      9473:	  trying file=/usr/lib64/elfutils/libbz2.so.1
      9473:	 search path=/lib64:/usr/lib64		(system search path)
      9473:	  trying file=/lib64/libbz2.so.1
      9473:	
      9473:	find library=libz.so.1 [0]; searching
      9473:	 search path=/usr/lib64/elfutils		(RUNPATH from file /usr/lib64/libdw-0.155.so)
      9473:	  trying file=/usr/lib64/elfutils/libz.so.1
      9473:	 search path=/lib64:/usr/lib64		(system search path)
      9473:	  trying file=/lib64/libz.so.1
      9473:	
      9473:	find library=libgcc_s.so.1 [0]; searching
      9473:	 search path=/usr/lib64/elfutils		(RUNPATH from file /usr/lib64/libdw-0.155.so)
      9473:	  trying file=/usr/lib64/elfutils/libgcc_s.so.1
      9473:	 search path=/lib64:/usr/lib64		(system search path)
      9473:	  trying file=/lib64/libgcc_s.so.1
      9473:	
      9473:	find library=libc.so.6 [0]; searching
      9473:	 search path=/usr/lib64/elfutils		(RUNPATH from file /usr/lib64/libdw-0.155.so)
      9473:	  trying file=/usr/lib64/elfutils/libc.so.6
      9473:	 search path=/lib64:/usr/lib64		(system search path)
      9473:	  trying file=/lib64/libc.so.6
      9473:	
	linux-vdso.so.1 (0x00007fff157fe000)
	libelf.so.1 =&gt; /usr/lib64/libelf.so.1 (0x0000003de3400000)
	libdl.so.2 =&gt; /lib64/libdl.so.2 (0x0000003ddc800000)
	liblzma.so.5 =&gt; /lib64/liblzma.so.5 (0x0000003dec200000)
	libbz2.so.1 =&gt; /lib64/libbz2.so.1 (0x0000003df0800000)
	libz.so.1 =&gt; /lib64/libz.so.1 (0x0000003ddd400000)
	libgcc_s.so.1 =&gt; /lib64/libgcc_s.so.1 (0x0000003dddc00000)
	libc.so.6 =&gt; /lib64/libc.so.6 (0x0000003ddc400000)
	/lib64/ld-linux-x86-64.so.2 (0x0000003ddc000000)
$</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>160326</commentid>
    <comment_count>1</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2016-11-30 13:25:21 +0300</bug_when>
    <thetext>$ RPM_BUILD_ROOT=/var/empty /usr/lib/rpm/verify-elf /usr/lib64/libdw-0.155.so
section [18] &apos;.tbss&apos;: alloc flag set but section not in any loaded segment
verify-elf: ERROR: /usr/lib64/libdw-0.155.so: eu-elflint failed
verify-elf: ERROR: /usr/lib64/libdw-0.155.so: RPATH contains a non-ascii entry: /usr/lib64/elfutils
/usr/lib64/elfutils
$</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>160339</commentid>
    <comment_count>2</comment_count>
    <who name="Repository Robot">repository-robot</who>
    <bug_when>2016-11-30 20:07:10 +0300</bug_when>
    <thetext>rpm-4.0.4-alt100.96 -&gt; sisyphus:

* Wed Nov 30 2016 Ivan Zakharyaschev &lt;imz@altlinux&gt; 4.0.4-alt100.96
- verify-elf: don&apos;t confuse the initial verify_rpath() in case
  of two RUNPATH/RPATHs (ALT#32826).</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>