projects
/
centaur.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
264965b
)
Fix alignment error in mInsertSpaceBefore
author
norly
<ny-git@enpas.org>
Fri, 24 May 2013 23:45:39 +0000
(
00:45
+0100)
committer
norly
<ny-git@enpas.org>
Fri, 24 May 2013 23:45:39 +0000
(
00:45
+0100)
src/model/insert.c
patch
|
blob
|
history
diff --git
a/src/model/insert.c
b/src/model/insert.c
index 312be26c79393d2723e15a115feb37071d7206c7..b18aa8aed80ade86b52d5fb4a6df8274c142b646 100644
(file)
--- a/
src/model/insert.c
+++ b/
src/model/insert.c
@@
-27,6
+27,11
@@
GElf_Xword elfu_mInsertSpaceBefore(ElfuElf *me, GElf_Off off, GElf_Xword size)
assert(me);
+ /* Round up size to 4096 bytes to keep page alignment on x86 when
+ * remapping existing data to lower addresses. */
+ size += (4096 - (size % 4096)) % 4096;
+ // TODO: Find alignment size by checking p_align in PHDRs
+
/* Move SHDRs and PHDRs */
if (me->ehdr.e_shoff >= off) {
me->ehdr.e_shoff += size;