[strongSwan-dev] Android x86 crash

Tobias Brunner tobias at strongswan.org
Mon Oct 20 19:31:06 CEST 2014

Hi Alexander,

>    Just tried to compile client for android and found it is not working 
> under x86 emulator.
> As soon as you try to connect to peer it crash inside native code 
> loading dynamic symbols.
> I suppose it can be google fault as Qt folks experienced similar kind of 
> problems:
> https://bugreports.qt-project.org/browse/QTBUG-37211
> ARM emulator looks to be immune to this problem but it boringly slow. :(
> My question is it a known problem?

I wasn't aware of this.  Which is partially due to problems I had in
getting a 4.4.2 emulator image running at all for a while.

> I/DEBUG   (  924):     #00  pc 00006ac8  /system/bin/linker 
> (__dl__Z19dlsym_linear_lookupPKcPP6soinfoS2_+216)
> I/DEBUG   (  924):     #01  pc 00001265  /system/bin/linker (__dl_dlsym+325)
> I/DEBUG   (  924):     #02  pc 000510d7 
> /data/app-lib/org.strongswan.android-2/libstrongswan.so

The crash happens when the plugin loader tries to resolve the
constructor function of the first plugin (android_log_plugin_create).
Apparently dlsym() causes a SIGFPE that crashes the process.

I did some experiments and the only way to avoid the crash and to find
the symbol on the 4.4.2 x86 emulator image is by dlopen()-ing the
library and then passing the returned handle to dlsym().  Calling
dlsym() with RTLD_DEFAULT, as we do, does not work, even though the
symbol is resolved properly when called directly.  So the loader can
resolve it it's just dlsym() that fails, which seems to indicate that
it's really just a bug in dlsym() (could actually be this bug [1]).

As is mentioned in the Qt bug report it works on older x86 images (e.g.
the ones for 4.3 or 4.2.2).  And fortunately it also works in the new
Android 5.0 x86 image.  So it looks like this was just a temporary issue
with the 4.4.2 x86 image.


[1] https://code.google.com/p/android/issues/detail?id=61799

More information about the Dev mailing list