From a1e87f8d76456a46b487f13e2e805d64723a0a1d Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Fri, 24 May 2024 16:56:40 -0700 Subject: [PATCH] libct: rm eaccess It is not needed since Go 1.20 (which was released in February 2023 and is no longer supported since February 2024). Signed-off-by: Kir Kolyshkin --- libcontainer/eaccess_go119.go | 17 ----------------- libcontainer/eaccess_stub.go | 10 ---------- libcontainer/setns_init_linux.go | 7 ------- libcontainer/standard_init_linux.go | 7 ------- 4 files changed, 41 deletions(-) delete mode 100644 libcontainer/eaccess_go119.go delete mode 100644 libcontainer/eaccess_stub.go diff --git a/libcontainer/eaccess_go119.go b/libcontainer/eaccess_go119.go deleted file mode 100644 index cc1e2079a..000000000 --- a/libcontainer/eaccess_go119.go +++ /dev/null @@ -1,17 +0,0 @@ -//go:build !go1.20 -// +build !go1.20 - -package libcontainer - -import "golang.org/x/sys/unix" - -func eaccess(path string) error { - // This check is similar to access(2) with X_OK except for - // setuid/setgid binaries where it checks against the effective - // (rather than real) uid and gid. It is not needed in go 1.20 - // and beyond and will be removed later. - - // Relies on code added in https://go-review.googlesource.com/c/sys/+/468877 - // and older CLs linked from there. - return unix.Faccessat(unix.AT_FDCWD, path, unix.X_OK, unix.AT_EACCESS) -} diff --git a/libcontainer/eaccess_stub.go b/libcontainer/eaccess_stub.go deleted file mode 100644 index 7c049fd7a..000000000 --- a/libcontainer/eaccess_stub.go +++ /dev/null @@ -1,10 +0,0 @@ -//go:build go1.20 - -package libcontainer - -func eaccess(path string) error { - // Not needed in Go 1.20+ as the functionality is already in there - // (added by https://go.dev/cl/416115, https://go.dev/cl/414824, - // and fixed in Go 1.20.2 by https://go.dev/cl/469956). - return nil -} diff --git a/libcontainer/setns_init_linux.go b/libcontainer/setns_init_linux.go index de3a15f6e..d14198772 100644 --- a/libcontainer/setns_init_linux.go +++ b/libcontainer/setns_init_linux.go @@ -117,13 +117,6 @@ func (l *linuxSetnsInit) Init() error { if err != nil { return err } - // exec.LookPath in Go < 1.20 might return no error for an executable - // residing on a file system mounted with noexec flag, so perform this - // extra check now while we can still return a proper error. - // TODO: remove this once go < 1.20 is not supported. - if err := eaccess(name); err != nil { - return &os.PathError{Op: "eaccess", Path: name, Err: err} - } // Set seccomp as close to execve as possible, so as few syscalls take // place afterward (reducing the amount of syscalls that users need to // enable in their seccomp profiles). diff --git a/libcontainer/standard_init_linux.go b/libcontainer/standard_init_linux.go index 4b7aa6775..ec2e81437 100644 --- a/libcontainer/standard_init_linux.go +++ b/libcontainer/standard_init_linux.go @@ -211,13 +211,6 @@ func (l *linuxStandardInit) Init() error { if err != nil { return err } - // exec.LookPath in Go < 1.20 might return no error for an executable - // residing on a file system mounted with noexec flag, so perform this - // extra check now while we can still return a proper error. - // TODO: remove this once go < 1.20 is not supported. - if err := eaccess(name); err != nil { - return &os.PathError{Op: "eaccess", Path: name, Err: err} - } // Set seccomp as close to execve as possible, so as few syscalls take // place afterward (reducing the amount of syscalls that users need to