Skip to content

Commit

Permalink
libcontainer: drop system.Setxid
Browse files Browse the repository at this point in the history
Since Go 1.16, [Go issue 1435][1] is solved, and the stdlib syscall
implementations work on Linux. While they are a bit more
flexible/heavier-weight than the implementations that were copied to
libcontainer/system (working across all threads), we compile with Cgo,
and using the libc wrappers should be just as suitable.

  [1]: golang/go#1435

Signed-off-by: Bjorn Neergaard <[email protected]>
  • Loading branch information
neersighted committed Oct 11, 2023
1 parent 520a3d5 commit 22de49f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 56 deletions.
5 changes: 3 additions & 2 deletions libcontainer/init_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"runtime/debug"
"strconv"
"strings"
"syscall"

"github.com/containerd/console"
"github.com/moby/sys/user"
Expand Down Expand Up @@ -525,10 +526,10 @@ func setupUser(config *initConfig) error {
}
}

if err := system.Setgid(execUser.Gid); err != nil {
if err := syscall.Setgid(execUser.Gid); err != nil {
return err
}
if err := system.Setuid(execUser.Uid); err != nil {
if err := syscall.Setuid(execUser.Uid); err != nil {
return err
}

Expand Down
27 changes: 0 additions & 27 deletions libcontainer/system/syscall_linux_32.go

This file was deleted.

27 changes: 0 additions & 27 deletions libcontainer/system/syscall_linux_64.go

This file was deleted.

0 comments on commit 22de49f

Please sign in to comment.