ldd: pass absolute path to bwrap
Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
478b27922c
commit
83c8f0488b
@ -3,6 +3,7 @@ package ldd
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -15,20 +16,20 @@ const lddTimeout = 2 * time.Second
|
|||||||
func Exec(ctx context.Context, p string) ([]*Entry, error) {
|
func Exec(ctx context.Context, p string) ([]*Entry, error) {
|
||||||
var h helper.Helper
|
var h helper.Helper
|
||||||
|
|
||||||
if b, err := helper.NewBwrap(
|
if toolPath, err := exec.LookPath("ldd"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else if h, err = helper.NewBwrap(
|
||||||
(&bwrap.Config{
|
(&bwrap.Config{
|
||||||
Hostname: "fortify-ldd",
|
Hostname: "fortify-ldd",
|
||||||
Chdir: "/",
|
Chdir: "/",
|
||||||
Syscall: &bwrap.SyscallPolicy{DenyDevel: true, Multiarch: true},
|
Syscall: &bwrap.SyscallPolicy{DenyDevel: true, Multiarch: true},
|
||||||
NewSession: true,
|
NewSession: true,
|
||||||
DieWithParent: true,
|
DieWithParent: true,
|
||||||
}).Bind("/", "/").DevTmpfs("/dev"), "ldd",
|
}).Bind("/", "/").DevTmpfs("/dev"), toolPath,
|
||||||
nil, func(_, _ int) []string { return []string{p} },
|
nil, func(_, _ int) []string { return []string{p} },
|
||||||
nil, nil,
|
nil, nil,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
|
||||||
h = b
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stdout := new(strings.Builder)
|
stdout := new(strings.Builder)
|
||||||
|
Loading…
Reference in New Issue
Block a user