Android11 模拟器启动失败分析
Contents
遇到android11模拟器启动,直接segment fault,简单分析了下原因。
- 启动模拟器命令:
./emulator -writable-system -netdelay none -netspeed full @android11_x86_64 -no-window
- gdb –args 调试启动,报错后bt栈回溯如下:
#0 0x000000000e95b080 in ?? ()
#1 0x00007fffeb1e76aa in ?? () from /home/install/android-sdk/emulator/lib64/gles_swiftshader/libGLESv2.so
#2 0x00007fffeb1e6afd in ?? () from /home/install/android-sdk/emulator/lib64/gles_swiftshader/libGLESv2.so
#3 0x00007fffeb1e68b1 in ?? () from /home/install/android-sdk/emulator/lib64/gles_swiftshader/libGLESv2.so
#4 0x00007fffeb1e6803 in ?? () from /home/install/android-sdk/emulator/lib64/gles_swiftshader/libGLESv2.so
#5 0x00007fffeb1db921 in ?? () from /home/install/android-sdk/emulator/lib64/gles_swiftshader/libGLESv2.so
#6 0x00007ffff79beea5 in start_thread () from /lib64/libpthread.so.0
#7 0x00007ffff69d79fd in clone () from /lib64/libc.so.6
很奇怪,0xe95b080没有所属模块,开始以为是跑飞了,后面disassembly发现是动态分配的内存,然后代码没执行权限。
想到了selinux,一看果然开启在,于是setenforce 0 临时关掉,it works…
没具体看代码了,猜测是分配了内存,mportect调用没判断返回值,导致执行失败。
参考资料: 《selinux影响mprotect》 《what-do-i-have-to-do-to-execute-code-in-data-areas-segment-protection》