SEGV_ACCERR segment error caused by relro on Jellybean

Source: Internet
Author: User

On JB, we sometimes find that the SEGV_ACCERR problem occurs when we run a good program on ICS and run it on JB. As mentioned in the previous article, modifying dso in the hmi of the hal module may cause a segment error.

When an error occurs, about the following information is output:

[Html] www.2cto.com
Fault addr 3cde4bf4
3cde2000-3cde5000 r -- p 00050000 b3: 01 595/system/lib/libwilhelm. so
 
0x3cde4bf4 <IObject_Itf>: 0x3cdbf5ac 0x3cdbf3b4 0x3cdbed64 0x3cdbf1d4
0x3cde4c04 <IObject_Itf + 16>: 0x3cdbeca8 0x3cdbf150 0x3cdbf8a0 0x3cdbec54
0x3cde4c14 <IObject_Itf + 32>: 0x3cdbec00 0x3cdbebac
Here we can see that linker maps this segment of address into a read-only address, but the code is intended to write it, which leads to access errors and death.

Why is it good on ICS, but it won't work on JB?

From the error phenomena and maps, this should be caused by jellybean's new changes to linker. Go to bionic to view the linker Update log:

[Html]
$ Git log linker/linker. c

Find the following update information:

[Html]
Commit 9ec0f03a0d0b17bbb94ac0b9fef6add28a133c3a
Author: 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
Indicate that certain regions of memory shoshould be marked
"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: i6541f8775415e8558b4388f7d105b1ae6e8f046b

Google added support for relro, which caused these problems (google said there was no impact, but we still saw it ). The specific reasons are described here, mainly for security considerations. You can refer to the detailed description of the article in the link.

The solution is also very simple. One is to revert it, or modify the source code, and remove the const of the const global variable to be modified.

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.