vendor: update containerd/cri to current master
- Remove dependency on libcontainer/system
- Get rid of socat for port forwarding
- Roll docker/distribution back to latest (v2.7.1) release
  Now that 901bcb2231 was merged in containerd,
  we no longer depend on the ParseDockerRef utility from docker/distribution,
  so we can safely roll back to the latest release for this dependency.
- vendor: kubernetes v1.18.2
  Fix client watch reestablishment handling of client-side timeouts
- Add config flag to default empty seccomp profile
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
			
			
This commit is contained in:
		
							
								
								
									
										155
									
								
								vendor/github.com/opencontainers/runc/libcontainer/system/linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										155
									
								
								vendor/github.com/opencontainers/runc/libcontainer/system/linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,155 +0,0 @@ | ||||
| // +build linux | ||||
|  | ||||
| package system | ||||
|  | ||||
| import ( | ||||
| 	"os" | ||||
| 	"os/exec" | ||||
| 	"syscall" // only for exec | ||||
| 	"unsafe" | ||||
|  | ||||
| 	"github.com/opencontainers/runc/libcontainer/user" | ||||
| 	"golang.org/x/sys/unix" | ||||
| ) | ||||
|  | ||||
| // If arg2 is nonzero, set the "child subreaper" attribute of the | ||||
| // calling process; if arg2 is zero, unset the attribute.  When a | ||||
| // process is marked as a child subreaper, all of the children | ||||
| // that it creates, and their descendants, will be marked as | ||||
| // having a subreaper.  In effect, a subreaper fulfills the role | ||||
| // of init(1) for its descendant processes.  Upon termination of | ||||
| // a process that is orphaned (i.e., its immediate parent has | ||||
| // already terminated) and marked as having a subreaper, the | ||||
| // nearest still living ancestor subreaper will receive a SIGCHLD | ||||
| // signal and be able to wait(2) on the process to discover its | ||||
| // termination status. | ||||
| const PR_SET_CHILD_SUBREAPER = 36 | ||||
|  | ||||
| type ParentDeathSignal int | ||||
|  | ||||
| func (p ParentDeathSignal) Restore() error { | ||||
| 	if p == 0 { | ||||
| 		return nil | ||||
| 	} | ||||
| 	current, err := GetParentDeathSignal() | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	if p == current { | ||||
| 		return nil | ||||
| 	} | ||||
| 	return p.Set() | ||||
| } | ||||
|  | ||||
| func (p ParentDeathSignal) Set() error { | ||||
| 	return SetParentDeathSignal(uintptr(p)) | ||||
| } | ||||
|  | ||||
| func Execv(cmd string, args []string, env []string) error { | ||||
| 	name, err := exec.LookPath(cmd) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|  | ||||
| 	return syscall.Exec(name, args, env) | ||||
| } | ||||
|  | ||||
| func Prlimit(pid, resource int, limit unix.Rlimit) error { | ||||
| 	_, _, err := unix.RawSyscall6(unix.SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(&limit)), uintptr(unsafe.Pointer(&limit)), 0, 0) | ||||
| 	if err != 0 { | ||||
| 		return err | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func SetParentDeathSignal(sig uintptr) error { | ||||
| 	if err := unix.Prctl(unix.PR_SET_PDEATHSIG, sig, 0, 0, 0); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func GetParentDeathSignal() (ParentDeathSignal, error) { | ||||
| 	var sig int | ||||
| 	if err := unix.Prctl(unix.PR_GET_PDEATHSIG, uintptr(unsafe.Pointer(&sig)), 0, 0, 0); err != nil { | ||||
| 		return -1, err | ||||
| 	} | ||||
| 	return ParentDeathSignal(sig), nil | ||||
| } | ||||
|  | ||||
| func SetKeepCaps() error { | ||||
| 	if err := unix.Prctl(unix.PR_SET_KEEPCAPS, 1, 0, 0, 0); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|  | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func ClearKeepCaps() error { | ||||
| 	if err := unix.Prctl(unix.PR_SET_KEEPCAPS, 0, 0, 0, 0); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|  | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func Setctty() error { | ||||
| 	if err := unix.IoctlSetInt(0, unix.TIOCSCTTY, 0); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // RunningInUserNS detects whether we are currently running in a user namespace. | ||||
| // Originally copied from github.com/lxc/lxd/shared/util.go | ||||
| func RunningInUserNS() bool { | ||||
| 	uidmap, err := user.CurrentProcessUIDMap() | ||||
| 	if err != nil { | ||||
| 		// This kernel-provided file only exists if user namespaces are supported | ||||
| 		return false | ||||
| 	} | ||||
| 	return UIDMapInUserNS(uidmap) | ||||
| } | ||||
|  | ||||
| func UIDMapInUserNS(uidmap []user.IDMap) bool { | ||||
| 	/* | ||||
| 	 * We assume we are in the initial user namespace if we have a full | ||||
| 	 * range - 4294967295 uids starting at uid 0. | ||||
| 	 */ | ||||
| 	if len(uidmap) == 1 && uidmap[0].ID == 0 && uidmap[0].ParentID == 0 && uidmap[0].Count == 4294967295 { | ||||
| 		return false | ||||
| 	} | ||||
| 	return true | ||||
| } | ||||
|  | ||||
| // GetParentNSeuid returns the euid within the parent user namespace | ||||
| func GetParentNSeuid() int64 { | ||||
| 	euid := int64(os.Geteuid()) | ||||
| 	uidmap, err := user.CurrentProcessUIDMap() | ||||
| 	if err != nil { | ||||
| 		// This kernel-provided file only exists if user namespaces are supported | ||||
| 		return euid | ||||
| 	} | ||||
| 	for _, um := range uidmap { | ||||
| 		if um.ID <= euid && euid <= um.ID+um.Count-1 { | ||||
| 			return um.ParentID + euid - um.ID | ||||
| 		} | ||||
| 	} | ||||
| 	return euid | ||||
| } | ||||
|  | ||||
| // SetSubreaper sets the value i as the subreaper setting for the calling process | ||||
| func SetSubreaper(i int) error { | ||||
| 	return unix.Prctl(PR_SET_CHILD_SUBREAPER, uintptr(i), 0, 0, 0) | ||||
| } | ||||
|  | ||||
| // GetSubreaper returns the subreaper setting for the calling process | ||||
| func GetSubreaper() (int, error) { | ||||
| 	var i uintptr | ||||
|  | ||||
| 	if err := unix.Prctl(unix.PR_GET_CHILD_SUBREAPER, uintptr(unsafe.Pointer(&i)), 0, 0, 0); err != nil { | ||||
| 		return -1, err | ||||
| 	} | ||||
|  | ||||
| 	return int(i), nil | ||||
| } | ||||
							
								
								
									
										113
									
								
								vendor/github.com/opencontainers/runc/libcontainer/system/proc.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										113
									
								
								vendor/github.com/opencontainers/runc/libcontainer/system/proc.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,113 +0,0 @@ | ||||
| package system | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"io/ioutil" | ||||
| 	"path/filepath" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
| ) | ||||
|  | ||||
| // State is the status of a process. | ||||
| type State rune | ||||
|  | ||||
| const ( // Only values for Linux 3.14 and later are listed here | ||||
| 	Dead        State = 'X' | ||||
| 	DiskSleep   State = 'D' | ||||
| 	Running     State = 'R' | ||||
| 	Sleeping    State = 'S' | ||||
| 	Stopped     State = 'T' | ||||
| 	TracingStop State = 't' | ||||
| 	Zombie      State = 'Z' | ||||
| ) | ||||
|  | ||||
| // String forms of the state from proc(5)'s documentation for | ||||
| // /proc/[pid]/status' "State" field. | ||||
| func (s State) String() string { | ||||
| 	switch s { | ||||
| 	case Dead: | ||||
| 		return "dead" | ||||
| 	case DiskSleep: | ||||
| 		return "disk sleep" | ||||
| 	case Running: | ||||
| 		return "running" | ||||
| 	case Sleeping: | ||||
| 		return "sleeping" | ||||
| 	case Stopped: | ||||
| 		return "stopped" | ||||
| 	case TracingStop: | ||||
| 		return "tracing stop" | ||||
| 	case Zombie: | ||||
| 		return "zombie" | ||||
| 	default: | ||||
| 		return fmt.Sprintf("unknown (%c)", s) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // Stat_t represents the information from /proc/[pid]/stat, as | ||||
| // described in proc(5) with names based on the /proc/[pid]/status | ||||
| // fields. | ||||
| type Stat_t struct { | ||||
| 	// PID is the process ID. | ||||
| 	PID uint | ||||
|  | ||||
| 	// Name is the command run by the process. | ||||
| 	Name string | ||||
|  | ||||
| 	// State is the state of the process. | ||||
| 	State State | ||||
|  | ||||
| 	// StartTime is the number of clock ticks after system boot (since | ||||
| 	// Linux 2.6). | ||||
| 	StartTime uint64 | ||||
| } | ||||
|  | ||||
| // Stat returns a Stat_t instance for the specified process. | ||||
| func Stat(pid int) (stat Stat_t, err error) { | ||||
| 	bytes, err := ioutil.ReadFile(filepath.Join("/proc", strconv.Itoa(pid), "stat")) | ||||
| 	if err != nil { | ||||
| 		return stat, err | ||||
| 	} | ||||
| 	return parseStat(string(bytes)) | ||||
| } | ||||
|  | ||||
| // GetProcessStartTime is deprecated.  Use Stat(pid) and | ||||
| // Stat_t.StartTime instead. | ||||
| func GetProcessStartTime(pid int) (string, error) { | ||||
| 	stat, err := Stat(pid) | ||||
| 	if err != nil { | ||||
| 		return "", err | ||||
| 	} | ||||
| 	return fmt.Sprintf("%d", stat.StartTime), nil | ||||
| } | ||||
|  | ||||
| func parseStat(data string) (stat Stat_t, err error) { | ||||
| 	// From proc(5), field 2 could contain space and is inside `(` and `)`. | ||||
| 	// The following is an example: | ||||
| 	// 89653 (gunicorn: maste) S 89630 89653 89653 0 -1 4194560 29689 28896 0 3 146 32 76 19 20 0 1 0 2971844 52965376 3920 18446744073709551615 1 1 0 0 0 0 0 16781312 137447943 0 0 0 17 1 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||||
| 	i := strings.LastIndex(data, ")") | ||||
| 	if i <= 2 || i >= len(data)-1 { | ||||
| 		return stat, fmt.Errorf("invalid stat data: %q", data) | ||||
| 	} | ||||
|  | ||||
| 	parts := strings.SplitN(data[:i], "(", 2) | ||||
| 	if len(parts) != 2 { | ||||
| 		return stat, fmt.Errorf("invalid stat data: %q", data) | ||||
| 	} | ||||
|  | ||||
| 	stat.Name = parts[1] | ||||
| 	_, err = fmt.Sscanf(parts[0], "%d", &stat.PID) | ||||
| 	if err != nil { | ||||
| 		return stat, err | ||||
| 	} | ||||
|  | ||||
| 	// parts indexes should be offset by 3 from the field number given | ||||
| 	// proc(5), because parts is zero-indexed and we've removed fields | ||||
| 	// one (PID) and two (Name) in the paren-split. | ||||
| 	parts = strings.Split(data[i+2:], " ") | ||||
| 	var state int | ||||
| 	fmt.Sscanf(parts[3-3], "%c", &state) | ||||
| 	stat.State = State(state) | ||||
| 	fmt.Sscanf(parts[22-3], "%d", &stat.StartTime) | ||||
| 	return stat, nil | ||||
| } | ||||
							
								
								
									
										26
									
								
								vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_32.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										26
									
								
								vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_32.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,26 +0,0 @@ | ||||
| // +build linux | ||||
| // +build 386 arm | ||||
|  | ||||
| package system | ||||
|  | ||||
| import ( | ||||
| 	"golang.org/x/sys/unix" | ||||
| ) | ||||
|  | ||||
| // Setuid sets the uid of the calling thread to the specified uid. | ||||
| func Setuid(uid int) (err error) { | ||||
| 	_, _, e1 := unix.RawSyscall(unix.SYS_SETUID32, uintptr(uid), 0, 0) | ||||
| 	if e1 != 0 { | ||||
| 		err = e1 | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| // Setgid sets the gid of the calling thread to the specified gid. | ||||
| func Setgid(gid int) (err error) { | ||||
| 	_, _, e1 := unix.RawSyscall(unix.SYS_SETGID32, uintptr(gid), 0, 0) | ||||
| 	if e1 != 0 { | ||||
| 		err = e1 | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
							
								
								
									
										26
									
								
								vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										26
									
								
								vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,26 +0,0 @@ | ||||
| // +build linux | ||||
| // +build arm64 amd64 mips mipsle mips64 mips64le ppc ppc64 ppc64le riscv64 s390x | ||||
|  | ||||
| package system | ||||
|  | ||||
| import ( | ||||
| 	"golang.org/x/sys/unix" | ||||
| ) | ||||
|  | ||||
| // Setuid sets the uid of the calling thread to the specified uid. | ||||
| func Setuid(uid int) (err error) { | ||||
| 	_, _, e1 := unix.RawSyscall(unix.SYS_SETUID, uintptr(uid), 0, 0) | ||||
| 	if e1 != 0 { | ||||
| 		err = e1 | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| // Setgid sets the gid of the calling thread to the specified gid. | ||||
| func Setgid(gid int) (err error) { | ||||
| 	_, _, e1 := unix.RawSyscall(unix.SYS_SETGID, uintptr(gid), 0, 0) | ||||
| 	if e1 != 0 { | ||||
| 		err = e1 | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
							
								
								
									
										12
									
								
								vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,12 +0,0 @@ | ||||
| // +build cgo,linux | ||||
|  | ||||
| package system | ||||
|  | ||||
| /* | ||||
| #include <unistd.h> | ||||
| */ | ||||
| import "C" | ||||
|  | ||||
| func GetClockTicks() int { | ||||
| 	return int(C.sysconf(C._SC_CLK_TCK)) | ||||
| } | ||||
							
								
								
									
										15
									
								
								vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig_notcgo.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig_notcgo.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,15 +0,0 @@ | ||||
| // +build !cgo windows | ||||
|  | ||||
| package system | ||||
|  | ||||
| func GetClockTicks() int { | ||||
| 	// TODO figure out a better alternative for platforms where we're missing cgo | ||||
| 	// | ||||
| 	// TODO Windows. This could be implemented using Win32 QueryPerformanceFrequency(). | ||||
| 	// https://msdn.microsoft.com/en-us/library/windows/desktop/ms644905(v=vs.85).aspx | ||||
| 	// | ||||
| 	// An example of its usage can be found here. | ||||
| 	// https://msdn.microsoft.com/en-us/library/windows/desktop/dn553408(v=vs.85).aspx | ||||
|  | ||||
| 	return 100 | ||||
| } | ||||
							
								
								
									
										27
									
								
								vendor/github.com/opencontainers/runc/libcontainer/system/unsupported.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										27
									
								
								vendor/github.com/opencontainers/runc/libcontainer/system/unsupported.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,27 +0,0 @@ | ||||
| // +build !linux | ||||
|  | ||||
| package system | ||||
|  | ||||
| import ( | ||||
| 	"os" | ||||
|  | ||||
| 	"github.com/opencontainers/runc/libcontainer/user" | ||||
| ) | ||||
|  | ||||
| // RunningInUserNS is a stub for non-Linux systems | ||||
| // Always returns false | ||||
| func RunningInUserNS() bool { | ||||
| 	return false | ||||
| } | ||||
|  | ||||
| // UIDMapInUserNS is a stub for non-Linux systems | ||||
| // Always returns false | ||||
| func UIDMapInUserNS(uidmap []user.IDMap) bool { | ||||
| 	return false | ||||
| } | ||||
|  | ||||
| // GetParentNSeuid returns the euid within the parent user namespace | ||||
| // Always returns os.Geteuid on non-linux | ||||
| func GetParentNSeuid() int { | ||||
| 	return os.Geteuid() | ||||
| } | ||||
							
								
								
									
										35
									
								
								vendor/github.com/opencontainers/runc/libcontainer/system/xattrs_linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										35
									
								
								vendor/github.com/opencontainers/runc/libcontainer/system/xattrs_linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,35 +0,0 @@ | ||||
| package system | ||||
|  | ||||
| import "golang.org/x/sys/unix" | ||||
|  | ||||
| // Returns a []byte slice if the xattr is set and nil otherwise | ||||
| // Requires path and its attribute as arguments | ||||
| func Lgetxattr(path string, attr string) ([]byte, error) { | ||||
| 	var sz int | ||||
| 	// Start with a 128 length byte array | ||||
| 	dest := make([]byte, 128) | ||||
| 	sz, errno := unix.Lgetxattr(path, attr, dest) | ||||
|  | ||||
| 	switch { | ||||
| 	case errno == unix.ENODATA: | ||||
| 		return nil, errno | ||||
| 	case errno == unix.ENOTSUP: | ||||
| 		return nil, errno | ||||
| 	case errno == unix.ERANGE: | ||||
| 		// 128 byte array might just not be good enough, | ||||
| 		// A dummy buffer is used to get the real size | ||||
| 		// of the xattrs on disk | ||||
| 		sz, errno = unix.Lgetxattr(path, attr, []byte{}) | ||||
| 		if errno != nil { | ||||
| 			return nil, errno | ||||
| 		} | ||||
| 		dest = make([]byte, sz) | ||||
| 		sz, errno = unix.Lgetxattr(path, attr, dest) | ||||
| 		if errno != nil { | ||||
| 			return nil, errno | ||||
| 		} | ||||
| 	case errno != nil: | ||||
| 		return nil, errno | ||||
| 	} | ||||
| 	return dest[:sz], nil | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Sebastiaan van Stijn
					Sebastiaan van Stijn