ldd: lib paths resolve function
All checks were successful
Test / Create distribution (push) Successful in 24s
Test / Fortify (push) Successful in 2m37s
Test / Fpkg (push) Successful in 3m37s
Test / Data race detector (push) Successful in 3m50s
Test / Flake checks (push) Successful in 56s

This is what always happens right after a ldd call, so implement it here.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-03-16 01:20:09 +09:00
parent 891316d924
commit 273d97af85
4 changed files with 59 additions and 80 deletions

View File

@@ -6,7 +6,6 @@ import (
"io"
"os"
"path"
"slices"
"strconv"
"strings"
"syscall"
@@ -147,17 +146,10 @@ func bwrapStub() {
sc.Chdir = "/"
sc.Syscall = &bwrap.SyscallPolicy{DenyDevel: true, Multiarch: true}
sc.AsInit = false
bindTarget := []string{"/tmp/fortify.1971/12622d846cc3fe7b4c10359d01f0eb47"}
slices.Sort(bindTarget)
for _, name := range bindTarget {
sc.Bind(name, name, false, true)
}
roBindTarget := []string{"/run/user/1971", path.Dir(os.Args[0])}
slices.Sort(roBindTarget)
for _, name := range roBindTarget {
sc.Bind(name, name)
}
sc.
Bind("/run/user/1971", "/run/user/1971").
Bind("/tmp/fortify.1971/12622d846cc3fe7b4c10359d01f0eb47", "/tmp/fortify.1971/12622d846cc3fe7b4c10359d01f0eb47", false, true).
Bind(path.Dir(os.Args[0]), path.Dir(os.Args[0]))
// manipulate extra files list so fd ends up as 5
efp.Append()