Commit Graph

9 Commits

Author SHA1 Message Date
Mike Hommey
0e0c6496e4 Bug 1470701 - Use run-time page size when changing mapping permissions in elfhack injected code. r=froydnj
When a binary has a PT_GNU_RELRO segment, the elfhack injected code
uses mprotect to add the writable flag to relocated pages before
applying relocations, removing it afterwards. To do so, the elfhack
program uses the location and size of the PT_GNU_RELRO segment, and
adjusts it to be aligned according to the PT_LOAD alignment.

The problem here is that the PT_LOAD alignment doesn't necessarily match
the actual page alignment, and the resulting mprotect may end up not
covering the full extent of what the dynamic linker has protected
read-only according to the PT_GNU_RELRO segment. In turn, this can lead
to a crash on startup when trying to apply relocations to the still
read-only locations.

Practically speaking, this doesn't end up being a problem on x86, where
the PT_LOAD alignment is usually 4096, which happens to be the page
size, but on Debian armhf, it is 64k, while the run time page size can be
4k.
2018-06-24 09:02:38 +09:00
Mike Hommey
c0b84a749c Bug 635961 - Allow elfhack to relocate data under the GNU_RELRO segment. r=froydnj 2017-07-11 07:41:07 +09:00
Wes Kocher
cc389365c2 Backed out 2 changesets (bug 635961) at developer's request a=backout
Backed out changeset c56fa9c1eda0 (bug 635961)
Backed out changeset ddda63d5366e (bug 635961)

MozReview-Commit-ID: I6NxBctFn8e
2017-07-25 17:57:43 -07:00
Mike Hommey
870d2795e2 Bug 635961 - Allow elfhack to relocate data under the GNU_RELRO segment. r=froydnj 2017-07-11 07:41:07 +09:00
Mike Hommey
cb01e14b48 Bug 932737 - Change elfhack such that it doesn't require two injection objects. r=nfroyd 2013-11-02 08:47:24 +09:00
Nathan Froyd
3394af2409 Bug 925330 - don't use HAVE_64BIT_OS when building elfhack; r=glandium 2013-10-10 09:31:29 -04:00
Mike Hommey
a92de2ca33 Bug 898998 - Turn BL into BLX when doing thumb call relocations and the target is ARM. r=nfroyd 2013-07-30 08:57:28 +09:00
Gervase Markham
cb6a072c2a Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
Mike Hommey
4ca328c3c5 Bug 606145 part 2 - Import elfhack code. r=tglek,a=bsmedberg 2011-01-24 09:56:40 +01:00