Modify

Opened 5 years ago

Closed 3 years ago

#13186 closed defect (fixed)

LD_PRELOAD does not work anymore with ATTITUDE ADJUSTMENT (12.09-rc1, r34185)

Reported by: kontakt@… Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: Cc:

Description

root@OpenWrt:~# export LD_PRELOAD=/opt/lib/libmediaclient.so
root@OpenWrt:~# ldd /bin/ls

libcrypt.so.0 => /lib/libcrypt.so.0 (0x77a21000)
libm.so.0 => /lib/libm.so.0 (0x779fc000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x779d9000)
libc.so.0 => /lib/libc.so.0 (0x7796d000)
ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x77a48000)

it worked with every previous release, can someone please fix that?

I guess it's disabled since it's a new feature in uclibc to turn it off?

Enable library loader LD_PRELOAD environment (LDSO_PRELOAD_ENV_SUPPORT) [Y/n/?] (NEW)
Enable library loader preload file (ld.so.preload (LDSO_PRELOAD_FILE_SUPPORT) [N/y/?] (NEW)

ld.so.preload works on every linux system by default, it should be Y by default, however it's not as important as the LD_PRELOAD parameter itself.

Attachments (0)

Change History (9)

comment:1 Changed 5 years ago by florian

Can you test if trunk is also affected by this bug? Thanks!

comment:2 Changed 5 years ago by nbd

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

comment:3 Changed 5 years ago by SB_Prime@…

  • Resolution no_response deleted
  • Status changed from closed to reopened

I tested this on:

  • 12.09-rc1
  • 12.09-rc2
  • 12.09
  • trunk (r36570 07-May-2013 17:32)

I used the brcm47xx-squashfs binaries.

On all those builds the LD_PRELOAD does not work.

comment:4 Changed 4 years ago by anonymous

does anyone know where the uclibc configuration file is? Because it has to be enabled there. Unfortunately I lost the exact link to it.

comment:5 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

comment:6 Changed 3 years ago by rmilecki

When using uClibc (it's default unless you're using OpenWrt svn branch for DD or later release) you need to enable LDSO_PRELOAD_ENV_SUPPORT option to have LD_PRELOAD support.

OpenWrt keeps uClibc specific files in toolchain/uClibc/ directory (you can find configs & patches there).
OpenWrt builds uClibc in the build_dir/toolchain-*/uClibc/ directory.

If you take a look at the place where LDSO_PRELOAD_ENV_SUPPORT is defined:

vim build_dir/toolchain-*/uClibc/extra/Configs/Config.in

you'll see that LDSO_PRELOAD_ENV_SUPPORT is default y and it only depends on HAVE_SHARED.

A quick test how OpenWrt compiles uClibc:

egrep "HAVE_SHARED|LDSO_PRELOAD_ENV_SUPPORT" build_dir/toolchain-*/uClibc/.config
HAVE_SHARED=y
# LDSO_PRELOAD_ENV_SUPPORT is not set

So there is something disabling LDSO_PRELOAD_ENV_SUPPORT, but I don't know yet what...

comment:7 Changed 3 years ago by rmilecki

There is some log (grabbed from bcm53xx) how .config gets generated:

make[2]: Entering directory `$OPENWRT/toolchain/uClibc/headers'
$OPENWRT/scripts/kconfig.pl -n '+' ../config-0.9.33.2/common  ../config-0.9.33.2/arm > $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/uClibc-0.9.33.2/.config.new
$OPENWRT/staging_dir/host/bin/sed -i -e 's,^KERNEL_HEADERS=.*,KERNEL_HEADERS=\"$OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/linux-dev/include\",g' -e 's,^.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=n,g' -e 's,^.*UCLIBC_HAS_SOFT_FLOAT.*,UCLIBC_HAS_SOFT_FLOAT=y,g' -e 's,^.*UCLIBC_HAS_SHADOW.*,UCLIBC_HAS_SHADOW=y,g' -e 's,^.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=n,g' -e 's,^.*UCLIBC_BUILD_ALL_LOCALE.*,UCLIBC_BUILD_ALL_LOCALE=n,g' -e 's,^.*UCLIBC_HAS_SSP.*,UCLIBC_HAS_SSP=n,g' $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/uClibc-0.9.33.2/.config.new
cmp -s $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/uClibc-0.9.33.2/.config.new $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/uClibc-0.9.33.2/.config.last || { cp $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/uClibc-0.9.33.2/.config.new $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/uClibc-0.9.33.2/.config && make -C $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/uClibc-0.9.33.2 oldconfig KBUILD_HAVE_NLS= HOSTCFLAGS="-DKBUILD_NO_NLS" && make -C $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/uClibc-0.9.33.2/extra/config conf KBUILD_HAVE_NLS= HOSTCFLAGS="-DKBUILD_NO_NLS" && cp $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/uClibc-0.9.33.2/.config.new $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/uClibc-0.9.33.2/.config.last; }
make[3]: Entering directory `$OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/uClibc-0.9.33.2'
install -d include/config
make -C extra/config conf
gcc $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/uClibc-0.9.33.2/extra/config/conf.c  -c -o ../../extra/config/conf.o -DCURSES_LOC="<ncurses.h>" -DLOCALE  -DKBUILD_NO_NLS   
cat $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/uClibc-0.9.33.2/extra/config/zconf.tab.c_shipped > ../../extra/config/zconf.tab.c
cat $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/uClibc-0.9.33.2/extra/config/lex.zconf.c_shipped > ../../extra/config/lex.zconf.c
cat $OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/uClibc-0.9.33.2/extra/config/zconf.hash.c_shipped > ../../extra/config/zconf.hash.c
gcc ../../extra/config/zconf.tab.c  -c -o ../../extra/config/zconf.tab.o -DCURSES_LOC="<ncurses.h>" -DLOCALE  -DKBUILD_NO_NLS -I$OPENWRT/build_dir/toolchain-arm_cortex-a9_gcc-4.8-linaro_uClibc-0.9.33.2_eabi/uClibc-0.9.33.2/extra/config  
gcc ../../extra/config/conf.o ../../extra/config/zconf.tab.o  -o ../../extra/config/conf -lncurses   -DCURSES_LOC="<ncurses.h>" -DLOCALE  -DKBUILD_NO_NLS   
extra/config/conf -o extra/Configs/Config.in
#
# configuration written to ./.config
#
Last edited 3 years ago by rmilecki (previous) (diff)

comment:8 Changed 3 years ago by rmilecki

Oh wait, it was fixed in r45004. I just had to do make toolchain/clean V=s to force OpenWrt recompile uClibc properly.

comment:9 Changed 3 years ago by rmilecki

  • Resolution set to fixed
  • Status changed from reopened to closed

Fixed in CC release.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.