aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Waller <[email protected]>2014-06-01 16:01:57 +0100
committerPeter Waller <[email protected]>2014-06-01 16:01:57 +0100
commitf2eceb525cf0d5624cb4cf06dd339e309972b967 (patch)
tree5d069f25dab7f4c40589211079f0f545c6089619
parentMerge pull request #6 from tmc/master (diff)
downloadgoupx-f2eceb525cf0d5624cb4cf06dd339e309972b967.tar.xz
goupx-f2eceb525cf0d5624cb4cf06dd339e309972b967.zip
Only consider PT_LOAD at Offset == 0
-rw-r--r--hemfix/hemfix.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/hemfix/hemfix.go b/hemfix/hemfix.go
index 2425df1..8fa0be0 100644
--- a/hemfix/hemfix.go
+++ b/hemfix/hemfix.go
@@ -116,6 +116,10 @@ func fixelf(elf *ELF.File, fd io.ReadWriteSeeker) error {
continue
}
+ if p.Off != 0 {
+ continue
+ }
+
mask := -p.Align
if ^mask&p.Vaddr != 0 && (^mask&(p.Vaddr-p.Off)) == 0 {
log.Printf("Hemming PT_LOAD section")
@@ -130,6 +134,7 @@ func fixelf(elf *ELF.File, fd io.ReadWriteSeeker) error {
dst := off + int64(sz*i)
writephdr(elf, dst, fd, p)
+ break
}
}
return nil