textrelro 解决

2018-01-13 11:10:55来源:oschina作者:貌似高手人点击

分享

android 官网推荐的解决方案:https://wiki.gentoo.org/wiki/Hardened/Textrels_Guide


下面是实例:


[==========] upload files
libs/armeabi-v7a/libplayer-1.1.7.so: 1 file pushed. 6.0 MB/s (10630176 bytes in 1.690s)
libs/armeabi-v7a/test_player: 1 file pushed. 5.8 MB/s (493264 bytes in 0.080s)
libs/armeabi-v7a/gdbserver: 1 file pushed. 6.1 MB/s (596484 bytes in 0.094s)
[==========] run tests
WARNING: linker: /data/local/tmp/libplayer-1.1.7.so has text relocations. This is wasting memory and prevents security hardening. Please fix.

在link libplayer-1.1.7.so 发现有text relocations;textrelor 即有安全隐患,有浪费空间。

现在问题暴露出来了,在android sdk 23之后要求消除 text relocations;下面是消除步骤:


1,下载elf 扫描工具



2,扫描 text relocation 位置。


scanelf -qT out/target/product/generic/symbols/system/lib/libplayer-1.1.7.so



3,查找没有解析出来的symbols 0x47d724


arm-linux-androideabi-objdump -d out/target/product/generic/symbols/system/lib/libplayer-1.1.7.so > libplayer-1.1.7.so.s


最新文章

123

最新摄影

闪念基因

微信扫一扫

第七城市微信公众平台