Modify

Opened 3 years ago

Last modified 3 years ago

#19771 reopened defect

buildroot/strongswan: 5.3.0 regression - ipsec won't start when build with CONFIG_USE_STRIP=y

Reported by: Damian Kaczkowski Owned by: developers
Priority: normal Milestone: Chaos Calmer 15.05
Component: base system Version: Trunk
Keywords: Cc:

Description

Not sure if this is buildroot or strongswan issue. Please read this for more info:

https://github.com/openwrt/packages/issues/1332

Attachments (0)

Change History (14)

comment:1 Changed 3 years ago by jow

  • Resolution set to moved_to_github
  • Status changed from new to closed

comment:2 Changed 3 years ago by anonymous

Hi jow,
This might be a bug in rstrip.sh rpath cleanup, please don't close so fast :)

comment:3 Changed 3 years ago by jow

The path cleanup explicitely retains stuff beneath /usr/lib, so /usr/lib/ipsec is not cleared out. I also test-compiled strongswan here and didn't notice any "removing rpath /usr/lib/ipsec" in the build log.

And indeed, its not an rstrip issue:

$ ./staging_dir/toolchain-arm_cortex-a9+vfpv3_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/bin/arm-openwrt-linux-readelf -d ./build_dir/target-arm_cortex-a9+vfpv3_uClibc-0.9.33.2_eabi/strongswan-5.3.0/ipkg-install/usr/lib/ipsec/stroke | grep RPATH
 0x0000000f (RPATH)                      Library rpath: [/usr/lib/ipsec]

It also ends up in the .ipk:

$ tar -Oxzf bin/omap/packages/packages/strongswan-mod-stroke_5.3.0-1_omap.ipk ./data.tar.gz | tar -Oxz ./usr/lib/ipsec/starter > starter.elf
$ ./staging_dir/toolchain-arm_cortex-a9+vfpv3_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/bin/arm-openwrt-linux-readelf -d starter.elf | grep RPATH
 0x0000000f (RPATH)                      Library rpath: [/usr/lib/ipsec]

comment:4 Changed 3 years ago by Damian Kaczkowski

  • Resolution moved_to_github deleted
  • Status changed from closed to reopened

Well, if I disable stripping then all works fine. Here is readelf from stripped and unstripped binaries:

UNSTRIPPED BINARY:

/opt/cross/openwrt/toolchains/toolchain-mips_34kc/bin/mips-openwrt-linux-readelf -d ./starter | egrep RPATH
 0x0000000f (RPATH)                      Library rpath: [/opt/cross/openwrt/toolchains/OpenWrt-Toolchain-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin//../lib:/opt/cross/openwrt/toolchains/OpenWrt-Toolchain-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin//../usr/lib:/usr/lib/ipsec]

STRIPPED BINARY:
Compile log shows only:

rstrip.sh: /home/owrt/150409a/openwrt/build_dir/target-mips-openwrt-linux-uclibc/strongswan-5.3.0/ipkg-ar71xx/strongswan-mod-stroke/usr/lib/ipsec/starter: removing rpath /opt/cross/openwrt/toolchains/OpenWrt-Toolchain-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin//../lib
rstrip.sh: /home/owrt/150409a/openwrt/build_dir/target-mips-openwrt-linux-uclibc/strongswan-5.3.0/ipkg-ar71xx/strongswan-mod-stroke/usr/lib/ipsec/starter: removing rpath /opt/cross/openwrt/toolchains/OpenWrt-Toolchain-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin//../usr/lib
Packaged contents of /home/owrt/150409a/openwrt/build_dir/target-mips-openwrt-linux-uclibc/strongswan-5.3.0/ipkg-ar71xx/strongswan-mod-stroke into /home/owrt/150409a/openwrt/bin/ar71xx/packages/packages/strongswan-mod-stroke_5.3.0-1_ar71xx.ipk

But no RPATH at all in the binary:

tar -Oxzf bin/ar71xx/packages/packages/strongswan-mod-stroke_5.3.0-1_ar71xx.ipk ./data.tar.gz | tar -Oxz ./usr/lib/ipsec/starter > starter.elf
/opt/cross/openwrt/toolchains/toolchain-mips_34kc/bin/mips-openwrt-linux-readelf -d starter.elf | grep RPATH

It must be something related to stripping code. Jow could you please look into this one last time? Thanks in advance.

comment:5 Changed 3 years ago by jow

Its probably a bug in your external toolchain, using the normal buildroot works as expected here and I cannot reproduce your problem.

comment:6 Changed 3 years ago by jow

You could edit the rstrip.sh script and echo out the final "patchelf --set-rpath" invocation to see if /usr/lib/ipsec is retained at least on the command line, if so it might be a bug in patchelf.

comment:7 Changed 3 years ago by Damian Kaczkowski

Thanks for a tip. After echoing out patchelf:

tar -Oxzf bin/ar71xx/packages/packages/strongswan-mod-stroke_5.3.0-1_ar71xx.ipk ./data.tar.gz | tar -Oxz ./usr/lib/ipsec/starter > starter2.elf
/opt/cross/openwrt/toolchains/toolchain-mips_34kc/bin/mips-openwrt-linux-readelf -d starter2.elf | grep RPATH
 0x0000000f (RPATH)                      Library rpath: [/opt/cross/openwrt/toolchains/OpenWrt-Toolchain-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin//../lib:/opt/cross/openwrt/toolchains/OpenWrt-Toolchain-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin//../usr/lib:/usr/lib/ipsec]

I will update toolchains to latest trunk and check if it is a patchelf bug.

comment:8 Changed 3 years ago by Damian Kaczkowski

Here is a readelf from r45875 toolchain used to compilile r45314 buildroot.

tar -Oxzf bin/ar71xx/packages/packages/strongswan-mod-stroke_5.3.0-1_ar71xx.ipk ./data.tar.gz | tar -Oxz ./usr/lib/ipsec/starter > starter3.elf
/opt/cross/openwrt/toolchains/toolchain-mips_34kc/bin/mips-openwrt-linux-readelf -d starter3.elf | grep RPATH

No RPATH at all. Jow do you have more tips? What to check now?

comment:9 Changed 3 years ago by jow

So what is the "patchelf" commandline called by rstrip.sh?

comment:10 Changed 3 years ago by Damian Kaczkowski

patchelf called by rstrip.sh

/home/owrt/150409a/openwrt/staging_dir/host/bin/patchelf --set-rpath /usr/lib/ipsec /home/owrt/150409a/openwrt/build_dir/target-mips-openwrt-linux-uclibc/strongswan-5.3.0/ipkg-ar71xx/strongswan-mod-stroke/usr/lib/ipsec/starter

VERSIONS:

/home/owrt/150409a/openwrt/staging_dir/host/bin/patchelf --version
patchelf 0.8

comment:11 Changed 3 years ago by Damian Kaczkowski

Still the same on r46090 and the fresh new musl toolchain.

comment:12 Changed 3 years ago by jow

What is the host system? Maybe patchelf gets recompiled by your host gcc.

comment:13 Changed 3 years ago by jow

The above should read "gets miscompiled"...

comment:14 Changed 3 years ago by Damian Kaczkowski

Thanks for tip. It's Debian 7, gcc 4.7.2. Will upgrade to Debian 8 soon and report back if this changes anything.

Add Comment

Modify Ticket

Action
as reopened .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.