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:

fault addr 3cde4bf43cde2000-3cde5000 r--p 00050000 b3:01 595        /system/lib/libwilhelm.so0x3cde4bf4 <IObject_Itf>:       0x3cdbf5ac      0x3cdbf3b4      0x3cdbed64      0x3cdbf1d40x3cde4c04 <IObject_Itf+16>:    0x3cdbeca8      0x3cdbf150      0x3cdbf8a0      0x3cdbec540x3cde4c14 <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:

 $ git log linker/linker.c

Find the following update information:

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 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.

 

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.