mirror of
https://github.com/sliverarmory/reflektor
synced 2026-08-25 09:14:48 +00:00
c7ee9636e9
Enable BOF and ELF shared-library loading on FreeBSD, including recursive dependency handling and exact symbol-version resolution. Add strict no-skip FreeBSD 15.1 QEMU coverage, a 25-object semantic BOF corpus per architecture, platform documentation, and the verified Sliver compile exception.
38 lines
994 B
Go
38 lines
994 B
Go
//go:build linux && !android && (386 || amd64 || (arm && arm.7) || arm64 || ppc64le || riscv64)
|
|
|
|
package memmod
|
|
|
|
import "fmt"
|
|
|
|
func initLinuxDynAPI() error {
|
|
modules, err := runtimeModules()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
dlopenAddr, err := resolveRuntimeAPISymbol(modules, "dlopen")
|
|
if err != nil {
|
|
return fmt.Errorf("resolve runtime symbol dlopen: %w", err)
|
|
}
|
|
dlsymAddr, err := resolveRuntimeAPISymbol(modules, "dlsym")
|
|
if err != nil {
|
|
return fmt.Errorf("resolve runtime symbol dlsym: %w", err)
|
|
}
|
|
dlerrorAddr, err := resolveRuntimeAPISymbol(modules, "dlerror")
|
|
if err != nil {
|
|
return fmt.Errorf("resolve runtime symbol dlerror: %w", err)
|
|
}
|
|
dlvsymAddr, _ := resolveRuntimeAPISymbol(modules, "dlvsym")
|
|
dlcloseAddr, _ := resolveRuntimeAPISymbol(modules, "dlclose")
|
|
|
|
linuxAPI = linuxDynAPI{
|
|
dlopen: dlopenAddr,
|
|
dlsym: dlsymAddr,
|
|
dlvsym: dlvsymAddr,
|
|
dlclose: dlcloseAddr,
|
|
dlerror: dlerrorAddr,
|
|
defaultHandle: 0,
|
|
}
|
|
return nil
|
|
}
|