Skip to content

Commit

Permalink
fix: amd64, offset read error issue for PIE executable.
Browse files Browse the repository at this point in the history
On amd64, when the executable program in PIE format compiled by golang reads the return instruction of the function, the start address of inst is incorrect, resulting in an exception, see PR #516 for details.

Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
  • Loading branch information
cfc4n committed Apr 12, 2024
1 parent 043c39d commit 64ae3d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion user/config/config_gotls.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ func (gc *GoTLSConfig) findRetOffsetsPie(lfunc string) ([]int, error) {
continue
}
data := make([]byte, funcLen)
_, err = prog.ReadAt(data, int64(address))
_, err = prog.ReadAt(data, int64(address-prog.Vaddr))
if err != nil {
return offsets, fmt.Errorf("finding function return: %w", err)
}
Expand Down

0 comments on commit 64ae3d6

Please sign in to comment.