Skip to content

Commit

Permalink
fix: __libc_dlopen_mode deprecated in favor of dlopen as libdl.so…
Browse files Browse the repository at this point in the history
… has been merged into libc.so
  • Loading branch information
jm33-m0 committed Dec 19, 2024
1 parent 78ac77b commit 5285b93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/lib/agent/elf.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func GetSymFromLibc(pid int, sym string) (addr int64, err error) {
return
}
defer elf_file.Close()
syms, err := elf_file.Symbols()
syms, err := elf_file.DynamicSymbols()
if err != nil {
err = fmt.Errorf("ELF symbols: %v", err)
return
Expand Down
6 changes: 5 additions & 1 deletion core/lib/agent/injector.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,11 @@ func InjectorHandler(pid int, method string) (err error) {
func InjectSharedLib(so_path string, pid int) (err error) {
dlopen_addr, err := GetSymFromLibc(pid, "__libc_dlopen_mode")
if err != nil {
return fmt.Errorf("failed to get __libc_dlopen_mode address for %d: %v", pid, err)
log.Printf("failed to get __libc_dlopen_mode address for %d: %v, trying `dlopen`", pid, err)
}
dlopen_addr, err = GetSymFromLibc(pid, "dlopen")
if err != nil {
return fmt.Errorf("failed to get dlopen address for %d: %v", pid, err)
}
shellcode := gen_dlopen_shellcode(so_path, dlopen_addr)
if len(shellcode) == 0 {
Expand Down

0 comments on commit 5285b93

Please sign in to comment.