From f2eceb525cf0d5624cb4cf06dd339e309972b967 Mon Sep 17 00:00:00 2001 From: Peter Waller
Date: Sun, 1 Jun 2014 16:01:57 +0100 Subject: Only consider PT_LOAD at Offset == 0 --- hemfix/hemfix.go | 5 +++++ 1 file changed, 5 insertions(+) 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 -- cgit v1.2.3