diff --git a/libcontainer/setns_init_linux.go b/libcontainer/setns_init_linux.go index 48cc0ae02..7ceed2bcc 100644 --- a/libcontainer/setns_init_linux.go +++ b/libcontainer/setns_init_linux.go @@ -11,6 +11,8 @@ import ( "github.com/opencontainers/runc/libcontainer/seccomp" "github.com/opencontainers/runc/libcontainer/system" "github.com/opencontainers/selinux/go-selinux/label" + + "golang.org/x/sys/unix" ) // linuxSetnsInit performs the container's initialization for running a new process @@ -41,7 +43,7 @@ func (l *linuxSetnsInit) Init() error { } } if l.config.NoNewPrivileges { - if err := system.Prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0); err != nil { + if err := unix.Prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0); err != nil { return err } } diff --git a/libcontainer/standard_init_linux.go b/libcontainer/standard_init_linux.go index 98c7ae6dc..a03760353 100644 --- a/libcontainer/standard_init_linux.go +++ b/libcontainer/standard_init_linux.go @@ -128,7 +128,7 @@ func (l *linuxStandardInit) Init() error { return err } if l.config.NoNewPrivileges { - if err := system.Prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0); err != nil { + if err := unix.Prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0); err != nil { return err } } diff --git a/libcontainer/system/linux.go b/libcontainer/system/linux.go index 2ef7915a7..42e406652 100644 --- a/libcontainer/system/linux.go +++ b/libcontainer/system/linux.go @@ -133,13 +133,5 @@ func RunningInUserNS() bool { // SetSubreaper sets the value i as the subreaper setting for the calling process func SetSubreaper(i int) error { - return Prctl(PR_SET_CHILD_SUBREAPER, uintptr(i), 0, 0, 0) -} - -func Prctl(option int, arg2, arg3, arg4, arg5 uintptr) (err error) { - _, _, e1 := unix.Syscall6(unix.SYS_PRCTL, uintptr(option), arg2, arg3, arg4, arg5, 0) - if e1 != 0 { - err = e1 - } - return + return unix.Prctl(PR_SET_CHILD_SUBREAPER, uintptr(i), 0, 0, 0) }