读书人

Jellybean下relro引起的 SEGV_ACCERR段

发布时间: 2012-11-09 10:18:48 作者: rapoo

Jellybean上relro引起的 SEGV_ACCERR段错误问题

在JB上,有时候会发现,以前在ICS上跑的好好的程序,在JB上一运行,就发生 SEGV_ACCERR 问题,比如上一篇文章说到的,HAL模块的HMI中修改dso会造成段错误。

出错时的debuggerd输出,大约有如下信息:

commit 9ec0f03a0d0b17bbb94ac0b9fef6add28a133c3aAuthor: Nick Kralevich <nnk@google.com>Date:   Tue Feb 28 10:40:00 2012 -0800    Add relro support        Add support for PT_GNU_RELRO. This allows the static linker to    indicate that certain regions of memory should be marked as    "read-only" after dynamic linking is complete.        See:      * http://www.akkadia.org/drepper/nonselsec.pdf (section 6)      * http://tk-blog.blogspot.com/2009/02/relro-not-so-well-known-memory.html        Note that this change has no effect on Android right now, because    we don't compile our code with relro enabled.    Change-Id: I6541f8775367e8558b4388f7d105b1ae6e8f046b

正是google加入了relro的支持,导致了这些问题(google说没影响,实际上还是看到了)。具体原因这里有说明,主要是安全性考量。可以看下链接中的文章的详细说明。

解决方法也很简单,一是将它revert掉就好了,或者是修改源代码,将要修改的const全局变量的const都给去掉。


读书人网 >移动开发

热点推荐