** Description changed: run qemu with QEMU_LD_PREFIX argument will not load correct library order in the PATH. How to reproduce this bug: These command will download the library of other architectures wget https://raw.githubusercontent.com/BinaryAnalysisPlatform/qira/master/fetchlibs.sh ./fetchlibs.sh This is 32bit binary file, wget http://train.cs.nctu.edu.tw/files/magic chmod +x ./magic qemu-i386 -L /home/apple/libs/i386 /home/apple/magic This is work fine. But after you install gcc-multilib, it failed. sudo apt-get install gcc-multilib qemu-i386 -L /home/apple/libs/i386 /home/apple/magic The following is the error message /home/apple/magic: 0���: ̀Í�: D$(�$: Error 18446744073549536926 Because the order of dynamic linker search the shared library is wrong. When your system has /lib32 directory, its priority is higher than the QEMU_LD_PREFIX. If the system not loaded correspond with the dynamic linker, it will crash. Code flow: - linux-user/main.c: - call loader_exec - linuxload.c: - call load_elf_binary - elfload.c: - in load_elf_binary function - dynamic loader will be elf_interpreter + linux-user/main.c: + call loader_exec + linuxload.c: + call load_elf_binary + elfload.c: + in load_elf_binary function + dynamic loader will be elf_interpreter I think the problem should be here.
** Also affects: gcc-defaults (Ubuntu) Importance: Undecided Status: New ** No longer affects: gcc-defaults (Ubuntu) -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1531352 Title: QEMU_LD_PREFIX not load correct library order in the PATH Status in QEMU: New Bug description: run qemu with QEMU_LD_PREFIX argument will not load correct library order in the PATH. How to reproduce this bug: These command will download the library of other architectures wget https://raw.githubusercontent.com/BinaryAnalysisPlatform/qira/master/fetchlibs.sh ./fetchlibs.sh This is 32bit binary file, wget http://train.cs.nctu.edu.tw/files/magic chmod +x ./magic qemu-i386 -L /home/apple/libs/i386 /home/apple/magic This is work fine. But after you install gcc-multilib, it failed. sudo apt-get install gcc-multilib qemu-i386 -L /home/apple/libs/i386 /home/apple/magic The following is the error message /home/apple/magic: 0���: ̀Í�: D$(�$: Error 18446744073549536926 Because the order of dynamic linker search the shared library is wrong. When your system has /lib32 directory, its priority is higher than the QEMU_LD_PREFIX. If the system not loaded correspond with the dynamic linker, it will crash. Code flow: linux-user/main.c: call loader_exec linuxload.c: call load_elf_binary elfload.c: in load_elf_binary function dynamic loader will be elf_interpreter I think the problem should be here. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1531352/+subscriptions