OSDN Git Service

Handle empty relro segment or incorrectly sized file.
authorTorne (Richard Coles) <torne@google.com>
Wed, 30 Apr 2014 14:48:40 +0000 (15:48 +0100)
committerTorne (Richard Coles) <torne@google.com>
Fri, 2 May 2014 13:25:45 +0000 (14:25 +0100)
commit26ec9679ff01fb155ae21015f31cc95bed24f670
tree97478537891feb00d442d1e0eba5be1c0d64eefc
parent07bab525e24725aaacd71e7cc63dfc31d48ba8a7
Handle empty relro segment or incorrectly sized file.

If the file has no relro segment, the generated relro file will have
length 0, which caused mmap to fail. If the relro file has nonzero size,
but is too short (e.g. because it's for the wrong version of the
library), the linker would segfault while comparing the data. Fix both
these issues: don't try to map a zero length file, and don't try to
compare data that would be beyond the end of the file.

Improve test to explicitly generate two versions of the library: one
with -z relro, and one with -z norelro, so we can test both cases; also
explicitly test the case where the relro file has length 0.

Bug: 14299541
Change-Id: Id8b95585edda90e8bb5de452a35b70ed2d224934
linker/linker_phdr.cpp
tests/Android.mk
tests/dlext_test.cpp