Skip to content

Commit 83350c2

Browse files
committed
libct/system: rm Fexecve
This helper was added for runc-dmz in commit dac4171, but runc-dmz was later removed in commit 871057d, which forgot to remove the helper. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 06a4a78 commit 83350c2

File tree

1 file changed

+0
-45
lines changed

1 file changed

+0
-45
lines changed

libcontainer/system/linux.go

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import (
66
"fmt"
77
"io"
88
"os"
9-
"strconv"
10-
"syscall"
119
"unsafe"
1210

1311
"github.com/sirupsen/logrus"
@@ -43,49 +41,6 @@ func Exec(cmd string, args []string, env []string) error {
4341
}
4442
}
4543

46-
func execveat(fd uintptr, pathname string, args []string, env []string, flags int) error {
47-
pathnamep, err := syscall.BytePtrFromString(pathname)
48-
if err != nil {
49-
return err
50-
}
51-
52-
argvp, err := syscall.SlicePtrFromStrings(args)
53-
if err != nil {
54-
return err
55-
}
56-
57-
envp, err := syscall.SlicePtrFromStrings(env)
58-
if err != nil {
59-
return err
60-
}
61-
62-
_, _, errno := syscall.Syscall6(
63-
unix.SYS_EXECVEAT,
64-
fd,
65-
uintptr(unsafe.Pointer(pathnamep)),
66-
uintptr(unsafe.Pointer(&argvp[0])),
67-
uintptr(unsafe.Pointer(&envp[0])),
68-
uintptr(flags),
69-
0,
70-
)
71-
return errno
72-
}
73-
74-
func Fexecve(fd uintptr, args []string, env []string) error {
75-
var err error
76-
for {
77-
err = execveat(fd, "", args, env, unix.AT_EMPTY_PATH)
78-
if err != unix.EINTR { // nolint:errorlint // unix errors are bare
79-
break
80-
}
81-
}
82-
if err == unix.ENOSYS { // nolint:errorlint // unix errors are bare
83-
// Fallback to classic /proc/self/fd/... exec.
84-
return Exec("/proc/self/fd/"+strconv.Itoa(int(fd)), args, env)
85-
}
86-
return os.NewSyscallError("execveat", err)
87-
}
88-
8944
func SetParentDeathSignal(sig uintptr) error {
9045
if err := unix.Prctl(unix.PR_SET_PDEATHSIG, sig, 0, 0, 0); err != nil {
9146
return err

0 commit comments

Comments
 (0)