Android7.0后JNI库必须保留Section Headers

此修改在官网的描述如下:

Each ELF file has additional information contained in the section headers. These headers must be present now, because the dynamic linker uses them for sanity checking. Some developers try to strip them in an attempt to obfuscate the binary and prevent reverse engineering. (This doesn’t really help because it is possible to reconstruct the stripped information using widely-available tools.)

$ readelf --header libBroken.so | grep 'section headers'
  Start of section headers:          0 (bytes into file)
  Size of section headers:           0 (bytes)
  Number of section headers:         0
$

Resolution: remove the extra steps from your build that strip section headers.

理解:

1.ELF文件,必须要保留 section headers,Android7.0后dynamic linker会对这个字段做检查

2.一些app开发者之前去掉section headers的目的是为了混淆或保护,其实效果不大

3.修复方法是在编译JNI库时去掉strip section headers步骤

posted @ 2017-04-05 18:00  Jason207489550  阅读(1161)  评论(0编辑  收藏  举报