From ea8f228af36b2c9ae9918f7760c3af4f1e21cfa2 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Fri, 17 Jan 2025 23:43:32 +0900 Subject: proc/priv/shim: merge shim into main program Signed-off-by: Ophestra --- cmd/fsu/main.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'cmd/fsu') diff --git a/cmd/fsu/main.go b/cmd/fsu/main.go index 2412a0e6..1f90a390 100644 --- a/cmd/fsu/main.go +++ b/cmd/fsu/main.go @@ -24,7 +24,6 @@ const ( var ( Fmain = compPoison - Fshim = compPoison ) func main() { @@ -41,17 +40,12 @@ func main() { log.Fatal("this program must not be started by root") } - var fmain, fshim string + var fmain string if p, ok := checkPath(Fmain); !ok { log.Fatal("invalid fortify path, this copy of fsu is not compiled correctly") } else { fmain = p } - if p, ok := checkPath(Fshim); !ok { - log.Fatal("invalid fshim path, this copy of fsu is not compiled correctly") - } else { - fshim = p - } pexe := path.Join("/proc", strconv.Itoa(os.Getppid()), "exe") if p, err := os.Readlink(pexe); err != nil { @@ -142,7 +136,7 @@ func main() { if _, _, errno := syscall.AllThreadsSyscall(syscall.SYS_PRCTL, PR_SET_NO_NEW_PRIVS, 1, 0); errno != 0 { log.Fatalf("cannot set no_new_privs flag: %s", errno.Error()) } - if err := syscall.Exec(fshim, []string{"fshim"}, []string{envShim + "=" + shimSetupFd}); err != nil { + if err := syscall.Exec(fmain, []string{"fortify", "shim"}, []string{envShim + "=" + shimSetupFd}); err != nil { log.Fatalf("cannot start shim: %v", err) } -- cgit v1.3.1