Bug#674602: libc6: arm processes are exited on .so load if armhf/armel mismatch
Package: libc6
Version: 2.13-32
Severity: important
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: armhf (armv7l)
Kernel: Linux 3.1.10-l4t.r15.01 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libc6 depends on:
ii libc-bin 2.13-32
ii libgcc1 1:4.7.0-7
libc6 recommends no packages.
Versions of packages libc6 suggests:
ii debconf [debconf-2.0] 1.5.43
ii glibc-doc <none>
ii locales 2.13-32
-- debconf information excluded
Example :
#include <dlfcn.h>
#include <stdio.h>
#include <string.h>
int main()
{
printf("Opening ...\n");
dlopen("./libsoftfloat.so",RTLD_LAZY); /* exits application */
printf("Opened\n");
return 0;
}
This program will never print Opened if run on armhf, and libsoftfloat is an armel binary, since dlopen will exit the entire process group. This is not acceptable, as dlopen should simply just fail, allowing the program to continue.
This also means that if you install something that adds an armel .so to /etc/ld.so.preload the system is rendered unusable as no process will be able to start. It should be possible to have an armel and armhf added to preload, and only have the one matching the architecture loaded.
The affected code is in a debian specific patch that is applied to elf/dl-load.c - the lines are in the function arm_specific_checks:
#ifdef __ARM_PCS_VFP
if (!is_hf)
_exit(1);
#else
if (is_hf)
_exit(1);
#endif
It should NOT exit the process group like that, but rather return an error:
#ifdef __ARM_PCS_VFP
if (!is_hf)
return EINVAL;
#else
if (is_hf)
return EINVAL;
#endif
making dlopen fail gracefully.
Reply to: