Repository: firecracker-microvm/firecracker-containerd
Pull request #369 (2019-12-13 15:02:19)

Change log level for copying io err
Signed-off-by: bpopovschi <zyqsempai@mail.ru>

Issue #367

*Description of changes:*
Changed error log level, to clean up logs.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.


Zyqsempai: @sipsma PTAL

Patch:
diff --git a/agent/service.go b/agent/service.go
index af02c13..5c6747b 100644
--- a/agent/service.go
+++ b/agent/service.go
@@ -15,16 +15,13 @@ package main
 
 import (
 	"context"
-	"encoding/base64"
 	"fmt"
 	"os"
 	"runtime/debug"
 	"sync"
 
 	"github.com/containerd/containerd/cio"
-	"github.com/containerd/containerd/identifiers"
 	"github.com/containerd/containerd/log"
-	"github.com/containerd/containerd/mount"
 	runc "github.com/containerd/containerd/runtime/v2/runc/v2"
 	"github.com/containerd/containerd/runtime/v2/shim"
 	taskAPI "github.com/containerd/containerd/runtime/v2/task"
@@ -34,6 +31,7 @@ import (
 	"github.com/sirupsen/logrus"
 	"golang.org/x/sys/unix"
 
+	"github.com/containerd/containerd/mount"
 	"github.com/firecracker-microvm/firecracker-containerd/internal/bundle"
 	"github.com/firecracker-microvm/firecracker-containerd/internal/vm"
 	"github.com/firecracker-microvm/firecracker-containerd/proto"
@@ -71,19 +69,9 @@ type TaskService struct {
 	shimCancel context.CancelFunc
 }
 
-// TaskExecID provides a unique string for a given (taskID, execID) pair
-func TaskExecID(taskID, execID string) (string, error) {
-	err := identifiers.Validate(taskID)
-	if execID != "" {
-		err = multierror.Append(err, identifiers.Validate(execID)).ErrorOrNil()
-	}
-	if err != nil {
-		return "", err
-	}
-
-	// use "/" as a separator, which should be an illegal character for the IDs themselves
-	// after doing the above validation
-	return base64.URLEncoding.EncodeToString([]byte(fmt.Sprintf("%s/%s", taskID, execID))), nil
+// provides a unique string for a given (taskID, execID) pair
+func taskExecID(taskID, execID string) string {
+	return fmt.Sprintf("exec-%s-task-%s", execID, taskID)
 }
 
 // NewTaskService creates new runc shim wrapper
@@ -129,23 +117,27 @@ func unmarshalExtraData(marshalled *types.Any) (*proto.ExtraData, error) {
 	return extraData, nil
 }
 
-func (ts *TaskService) addCleanup(taskExecID string, cleanup func() error) {
+func (ts *TaskService) addCleanup(taskID, execID string, cleanup func() error) {
+	id := taskExecID(taskID, execID)
+
 	ts.execCleanupsMu.Lock()
 	defer ts.execCleanupsMu.Unlock()
-	ts.execCleanups[taskExecID] = append(ts.execCleanups[taskExecID], cleanup)
+	ts.execCleanups[id] = append(ts.execCleanups[id], cleanup)
 }
 
-func (ts *TaskService) doCleanup(taskExecID string) error {
+func (ts *TaskService) doCleanup(taskID, execID string) error {
+	id := taskExecID(taskID, execID)
+
 	ts.execCleanupsMu.Lock()
 	defer ts.execCleanupsMu.Unlock()
 
 	var err *multierror.Error
 	// iterate in reverse order so changes are "unwound" (similar to a defer)
-	for i := len(ts.execCleanups[taskExecID]) - 1; i >= 0; i-- {
-		err = multierror.Append(err, ts.execCleanups[taskExecID][i]())
+	for i := len(ts.execCleanups[id]) - 1; i >= 0; i-- {
+		err = multierror.Append(err, ts.execCleanups[id][i]())
 	}
 
-	delete(ts.execCleanups, taskExecID)
+	delete(ts.execCleanups, id)
 	return err.ErrorOrNil()
 }
 
@@ -154,18 +146,13 @@ func (ts *TaskService) Create(requestCtx context.Context, req *taskAPI.CreateTas
 	defer logPanicAndDie(log.G(requestCtx))
 	taskID := req.ID
 	execID := "" // the exec ID of the initial process in a task is an empty string by containerd convention
-	// this is technically validated earlier by containerd, but is added here too for extra safety
-	taskExecID, err := TaskExecID(taskID, execID)
-	if err != nil {
-		return nil, errors.Wrap(err, "invalid task and/or exec ID")
-	}
 
 	logger := log.G(requestCtx).WithField("TaskID", taskID).WithField("ExecID", execID)
 	logger.Info("create")
 
 	defer func() {
 		if err != nil {
-			cleanupErr := ts.doCleanup(taskExecID)
+			cleanupErr := ts.doCleanup(taskID, execID)
 			if cleanupErr != nil {
 				logger.WithError(cleanupErr).Error("failed to cleanup task")
 			}
@@ -181,7 +168,7 @@ func (ts *TaskService) Create(requestCtx context.Context, req *taskAPI.CreateTas
 	req.Options = extraData.RuncOptions
 
 	bundleDir := bundle.Dir(req.Bundle)
-	ts.addCleanup(taskExecID, func() error {
+	ts.addCleanup(taskID, execID, func() error {
 		err := os.RemoveAll(bundleDir.RootPath())
 		if err != nil {
 			return errors.Wrapf(err, "failed to remove bundle path %q", bundleDir.RootPath())
@@ -197,7 +184,7 @@ func (ts *TaskService) Create(requestCtx context.Context, req *taskAPI.CreateTas
 	if !rootfsStat.IsDir() {
 		return nil, errors.Errorf("bundle's rootfs path %q is not a dir", bundleDir.RootfsPath())
 	}
-	ts.addCleanup(taskExecID, func() error {
+	ts.addCleanup(taskID, execID, func() error {
 		err := mount.UnmountAll(bundleDir.RootfsPath(), unix.MNT_DETACH)
 		if err != nil {
 			return errors.Wrapf(err, "failed to unmount bundle rootfs %q", bundleDir.RootfsPath())
@@ -216,7 +203,8 @@ func (ts *TaskService) Create(requestCtx context.Context, req *taskAPI.CreateTas
 		ioConnectorSet = vm.NewNullIOProxy()
 	} else {
 		// Override the incoming stdio FIFOs, which have paths from the host that we can't use
-		fifoSet, err := cio.NewFIFOSetInDir(bundleDir.RootPath(), taskExecID, req.Terminal)
+		fifoName := taskExecID(taskID, execID)
+		fifoSet, err := cio.NewFIFOSetInDir(bundleDir.RootPath(), fifoName, req.Terminal)
 		if err != nil {
 			err = errors.Wrap(err, "failed to open stdio FIFOs")
 			logger.WithError(err).Error()
@@ -302,12 +290,6 @@ func (ts *TaskService) Delete(requestCtx context.Context, req *taskAPI.DeleteReq
 	defer logPanicAndDie(log.G(requestCtx))
 	taskID := req.ID
 	execID := req.ExecID
-	// this is technically validated earlier by containerd, but is added here too for extra safety
-	taskExecID, err := TaskExecID(taskID, execID)
-	if err != nil {
-		return nil, errors.Wrap(err, "invalid task and/or exec ID")
-	}
-
 	log.G(requestCtx).WithFields(logrus.Fields{"id": taskID, "exec_id": execID}).Debug("delete")
 
 	resp, err := ts.taskManager.DeleteProcess(requestCtx, req, ts.runcService)
@@ -315,7 +297,7 @@ func (ts *TaskService) Delete(requestCtx context.Context, req *taskAPI.DeleteReq
 		return nil, err
 	}
 
-	err = ts.doCleanup(taskExecID)
+	err = ts.doCleanup(taskID, execID)
 	if err != nil {
 		return nil, errors.Wrapf(err, "failed to cleanup task %q exec %q", taskID, execID)
 	}
@@ -408,18 +390,13 @@ func (ts *TaskService) Exec(requestCtx context.Context, req *taskAPI.ExecProcess
 
 	taskID := req.ID
 	execID := req.ExecID
-	// this is technically validated earlier by containerd, but is added here too for extra safety
-	taskExecID, err := TaskExecID(taskID, execID)
-	if err != nil {
-		return nil, errors.Wrap(err, "invalid task and/or exec ID")
-	}
 
 	logger := log.G(requestCtx).WithField("TaskID", taskID).WithField("ExecID", execID)
 	logger.Debug("exec")
 
 	defer func() {
 		if err != nil {
-			cleanupErr := ts.doCleanup(taskExecID)
+			cleanupErr := ts.doCleanup(taskID, execID)
 			if cleanupErr != nil {
 				logger.WithError(cleanupErr).Error("failed to cleanup task")
 			}
@@ -442,7 +419,8 @@ func (ts *TaskService) Exec(requestCtx context.Context, req *taskAPI.ExecProcess
 		ioConnectorSet = vm.NewNullIOProxy()
 	} else {
 		// Override the incoming stdio FIFOs, which have paths from the host that we can't use
-		fifoSet, err := cio.NewFIFOSetInDir(bundleDir.RootPath(), taskExecID, req.Terminal)
+		fifoName := taskExecID(taskID, execID)
+		fifoSet, err := cio.NewFIFOSetInDir(bundleDir.RootPath(), fifoName, req.Terminal)
 		if err != nil {
 			err = errors.Wrap(err, "failed to open stdio FIFOs")
 			logger.WithError(err).Error()
@@ -456,7 +434,7 @@ func (ts *TaskService) Exec(requestCtx context.Context, req *taskAPI.ExecProcess
 				ReadConnector:  vm.VSockAcceptConnector(extraData.StdinPort),
 				WriteConnector: vm.FIFOConnector(fifoSet.Stdin),
 			}
-			ts.addCleanup(taskExecID, func() error {
+			ts.addCleanup(taskID, execID, func() error {
 				return os.RemoveAll(req.Stdin)
 			})
 		}
@@ -468,7 +446,7 @@ func (ts *TaskService) Exec(requestCtx context.Context, req *taskAPI.ExecProcess
 				ReadConnector:  vm.FIFOConnector(fifoSet.Stdout),
 				WriteConnector: vm.VSockAcceptConnector(extraData.StdoutPort),
 			}
-			ts.addCleanup(taskExecID, func() error {
+			ts.addCleanup(taskID, execID, func() error {
 				return os.RemoveAll(req.Stdout)
 			})
 		}
@@ -480,7 +458,7 @@ func (ts *TaskService) Exec(requestCtx context.Context, req *taskAPI.ExecProcess
 				ReadConnector:  vm.FIFOConnector(fifoSet.Stderr),
 				WriteConnector: vm.VSockAcceptConnector(extraData.StderrPort),
 			}
-			ts.addCleanup(taskExecID, func() error {
+			ts.addCleanup(taskID, execID, func() error {
 				return os.RemoveAll(req.Stderr)
 			})
 		}
diff --git a/internal/vm/ioproxy.go b/internal/vm/ioproxy.go
index 9c44d98..4d048d8 100644
--- a/internal/vm/ioproxy.go
+++ b/internal/vm/ioproxy.go
@@ -16,6 +16,7 @@ package vm
 import (
 	"context"
 	"io"
+	"strings"
 	"time"
 
 	"github.com/firecracker-microvm/firecracker-containerd/internal"
@@ -129,7 +130,12 @@ func (connectorPair *IOConnectorPair) proxy(
 
 		_, err := io.CopyBuffer(writer, reader, make([]byte, internal.DefaultBufferSize))
 		if err != nil {
-			logger.WithError(err).Error("error copying io")
+			if strings.Contains(err.Error(), "use of closed network connection") ||
+				strings.Contains(err.Error(), "file already closed") {
+				logger.Infof("connection was closed: %v", err)
+			} else {
+				logger.WithError(err).Error("error copying io")
+			}
 			copyDone <- err
 		}
 	}()
diff --git a/proto/firecracker.pb.go b/proto/firecracker.pb.go
index 41f796f..203046a 100644
--- a/proto/firecracker.pb.go
+++ b/proto/firecracker.pb.go
@@ -553,8 +553,6 @@ type JailerConfig struct {
 	// This is formatted as specified in the cpuset man page under "List Format"
 	// http://man7.org/linux/man-pages/man7/cpuset.7.html
 	Mems                 string   `protobuf:"bytes,3,opt,name=Mems,json=mems,proto3" json:"Mems,omitempty"`
-	UID                  uint32   `protobuf:"varint,4,opt,name=UID,json=uID,proto3" json:"UID,omitempty"`
-	GID                  uint32   `protobuf:"varint,5,opt,name=GID,json=gID,proto3" json:"GID,omitempty"`
 	XXX_NoUnkeyedLiteral struct{} `json:"-"`
 	XXX_unrecognized     []byte   `json:"-"`
 	XXX_sizecache        int32    `json:"-"`
@@ -605,20 +603,6 @@ func (m *JailerConfig) GetMems() string {
 	return ""
 }
 
-func (m *JailerConfig) GetUID() uint32 {
-	if m != nil {
-		return m.UID
-	}
-	return 0
-}
-
-func (m *JailerConfig) GetGID() uint32 {
-	if m != nil {
-		return m.GID
-	}
-	return 0
-}
-
 func init() {
 	proto.RegisterType((*CreateVMRequest)(nil), "CreateVMRequest")
 	proto.RegisterType((*CreateVMResponse)(nil), "CreateVMResponse")
@@ -635,43 +619,41 @@ func init() {
 func init() { proto.RegisterFile("firecracker.proto", fileDescriptor_a73317e9fb8da571) }
 
 var fileDescriptor_a73317e9fb8da571 = []byte{
-	// 596 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0x41, 0x6f, 0xd3, 0x4c,
-	0x10, 0x95, 0x9b, 0xa4, 0x4d, 0xc6, 0x4d, 0xd2, 0xac, 0xda, 0xef, 0xb3, 0x2a, 0x54, 0x59, 0x3e,
-	0x54, 0x11, 0x87, 0x4a, 0xb4, 0x17, 0xc4, 0x89, 0x12, 0xd3, 0xca, 0x2d, 0xae, 0xaa, 0x4d, 0xd3,
-	0x03, 0xb7, 0xc5, 0x19, 0xbb, 0x26, 0xf1, 0xae, 0xd9, 0xdd, 0x14, 0x38, 0xf3, 0x8f, 0xe0, 0x0f,
-	0x22, 0x6f, 0x52, 0xc7, 0x89, 0x20, 0x42, 0xe2, 0xc4, 0x29, 0x3b, 0x6f, 0xde, 0xcc, 0x3c, 0xcd,
-	0x9b, 0x18, 0x7a, 0x71, 0x2a, 0x31, 0x92, 0x2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xcf, 0xfb, 0x61, 0x41, 0xaf, 0x42, 0xfc, 0x47, 0x56, 0x75, 0x01, 0xfb, 0xc3, 0x42,
-	0x74, 0x88, 0x9a, 0x8d, 0x99, 0x66, 0x9b, 0x36, 0x76, 0x08, 0xcd, 0x27, 0xda, 0x42, 0x75, 0x33,
-	0x5b, 0xc4, 0x5e, 0x00, 0xff, 0x8f, 0xf2, 0xb1, 0x39, 0x93, 0xbf, 0x6d, 0xf5, 0x1c, 0xf6, 0x2f,
-	0xff, 0x50, 0x92, 0x77, 0x06, 0x07, 0x6b, 0xdc, 0xc5, 0xde, 0xab, 0x03, 0xac, 0xb5, 0x01, 0xf9,
-	0xea, 0xdf, 0x80, 0xec, 0x43, 0xe3, 0x06, 0xf5, 0xcd, 0x70, 0x41, 0x6c, 0xf0, 0x22, 0x28, 0xc6,
-	0x0d, 0x6e, 0x47, 0x6a, 0x21, 0xaf, 0x1e, 0xdd, 0x8e, 0x54, 0x81, 0x85, 0x98, 0xa9, 0x85, 0x25,
-	0xf5, 0x0c, 0x33, 0x45, 0xf6, 0xa0, 0x36, 0x0a, 0x7c, 0xb3, 0xff, 0x36, 0xad, 0xcd, 0x02, 0xbf,
-	0x40, 0x2e, 0x03, 0xdf, 0x2c, 0xbb, 0x4d, 0x6b, 0x49, 0xe0, 0xbf, 0xd9, 0x79, 0xdf, 0x30, 0x1f,
-	0xd5, 0x0f, 0xdb, 0xe6, 0xe7, 0xec, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0x01, 0x7a, 0xf5, 0xcb,
-	0x7d, 0x05, 0x00, 0x00,
+	// 571 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xc1, 0x4e, 0xdb, 0x40,
+	0x10, 0x95, 0x21, 0x81, 0x64, 0x0c, 0x09, 0x59, 0x41, 0xbb, 0x42, 0x15, 0xb2, 0x7c, 0x40, 0x51,
+	0x0f,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a/proto/firecracker.proto b/proto/firecracker.proto
index fb0b579..2fc5f9d 100644
--- a/proto/firecracker.proto
+++ b/proto/firecracker.proto
@@ -72,35 +72,34 @@ message UpdateVMMetadataRequest {
 }
 
 message GetVMMetadataRequest {
-    string VMID = 1;
+	string VMID = 1;
 }
 
 message GetVMMetadataResponse {
-    string Metadata = 1;
+	string Metadata = 1;
 }
 
 message JailerConfig {
     string NetNS = 1;
-    // List of the physical numbers of the CPUs on which processes in that
-    // cpuset are allowed to execute.  See List Format below for a description
-    // of the format of cpus.
-    //
-    // The CPUs allowed to a cpuset may be changed by writing a new list to its
-    // cpus file.
-    // Taken from http://man7.org/linux/man-pages/man7/cpuset.7.html
-    //
-    // This is formatted as specified in the cpuset man page under "List Format"
-    // http://man7.org/linux/man-pages/man7/cpuset.7.html
+
+	// List of the physical numbers of the CPUs on which processes in that
+	// cpuset are allowed to execute.  See List Format below for a description
+	// of the format of cpus.
+	//
+	// The CPUs allowed to a cpuset may be changed by writing a new list to its
+	// cpus file.
+	// Taken from http://man7.org/linux/man-pages/man7/cpuset.7.html
+	//
+	// This is formatted as specified in the cpuset man page under "List Format"
+	// http://man7.org/linux/man-pages/man7/cpuset.7.html
     string CPUs = 2;
-    // List of memory nodes on which processes in this cpuset are allowed to
-    // allocate memory.  See List Format below for a description of the format
-    // of mems.
-    // Taken from http://man7.org/linux/man-pages/man7/cpuset.7.html
-    //
-    // This is formatted as specified in the cpuset man page under "List Format"
-    // http://man7.org/linux/man-pages/man7/cpuset.7.html
+	// List of memory nodes on which processes in this cpuset are allowed to
+	// allocate memory.  See List Format below for a description of the format
+	// of mems.
+	// Taken from http://man7.org/linux/man-pages/man7/cpuset.7.html
+	//
+	// This is formatted as specified in the cpuset man page under "List Format"
+	// http://man7.org/linux/man-pages/man7/cpuset.7.html
     string Mems = 3;
-    uint32 UID = 4;
-    uint32 GID = 5;
 }
 
diff --git a/runtime/jailer.go b/runtime/jailer.go
index 0ef1e0d..05f55c5 100644
--- a/runtime/jailer.go
+++ b/runtime/jailer.go
@@ -15,7 +15,6 @@ package main
 
 import (
 	"context"
-	"fmt"
 	"os"
 
 	"github.com/firecracker-microvm/firecracker-go-sdk"
@@ -32,6 +31,11 @@ const (
 	jailerHandlerName     = "firecracker-containerd-jail-handler"
 	jailerFifoHandlerName = "firecracker-containerd-jail-fifo-handler"
 	rootfsFolder          = "rootfs"
+
+	// TODO evenetually we can get rid of this when we add usernamespaces to
+	// jailing.
+	jailerUID = 300000
+	jailerGID = 300000
 )
 
 var (
@@ -79,14 +83,6 @@ func newJailer(
 		return newNoopJailer(ctx, l, service.shimDir), nil
 	}
 
-	if request.JailerConfig.UID == 0 || request.JailerConfig.GID == 0 {
-		return nil, fmt.Errorf(
-			"attempting to run as %d:%d. 0 cannot be used for the UID or GID",
-			request.JailerConfig.UID,
-			request.JailerConfig.GID,
-		)
-	}
-
 	if err := os.MkdirAll(ociBundlePath, 0700); err != nil {
 		return nil, errors.Wrapf(err, "failed to create oci bundle path: %s", ociBundlePath)
 	}
@@ -95,8 +91,8 @@ func newJailer(
 	config := runcJailerConfig{
 		OCIBundlePath: ociBundlePath,
 		RuncBinPath:   service.config.JailerConfig.RuncBinaryPath,
-		UID:           request.JailerConfig.UID,
-		GID:           request.JailerConfig.GID,
+		UID:           jailerUID,
+		GID:           jailerGID,
 		CPUs:          request.JailerConfig.CPUs,
 		Mems:          request.JailerConfig.Mems,
 	}


Test patch:
diff --git a/agent/agent_test.go b/agent/agent_test.go
deleted file mode 100644
index 6958a91..0000000
--- a/agent/agent_test.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"). You may
-// not use this file except in compliance with the License. A copy of the
-// License is located at
-//
-//	http://aws.amazon.com/apache2.0/
-//
-// or in the "license" file accompanying this file. This file is distributed
-// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
-// express or implied. See the License for the specific language governing
-// permissions and limitations under the License.
-
-package main
-
-import (
-	"testing"
-
-	"github.com/stretchr/testify/assert"
-)
-
-func TestTaskExecID(t *testing.T) {
-	results := make(map[string]bool)
-
-	testcases := []struct {
-		taskID string
-		execID string
-	}{
-		{
-			taskID: "task-task",
-			execID: "task",
-		},
-		{
-			taskID: "task",
-			execID: "task-task",
-		},
-		{
-			taskID: "task",
-			execID: "task",
-		},
-		{
-			taskID: "task",
-			execID: "",
-		},
-	}
-	for _, testcase := range testcases {
-		id, err := TaskExecID(testcase.taskID, testcase.execID)
-		assert.NoError(t, err, "unexpected error", "valid task/exec ID %+v", testcase)
-		if results[id] {
-			assert.Fail(t, "unexpected duplicated result", "testcase %+v has duplicated result %q", testcase, id)
-		}
-		results[id] = true
-	}
-}
-
-func TestTaskExecIDFails(t *testing.T) {
-	testcases := []struct {
-		taskID string
-		execID string
-	}{
-		{
-			taskID: "ta/sk",
-			execID: "",
-		},
-		{
-			taskID: "ta/sk",
-			execID: "exec",
-		},
-		{
-			taskID: "task",
-			execID: "ex/ec",
-		},
-		{
-			taskID: "ta/sk",
-			execID: "ex/ec",
-		},
-		{
-			taskID: "task/",
-			execID: "exec/",
-		},
-		{
-			taskID: "/task",
-			execID: "/exec",
-		},
-	}
-	for _, testcase := range testcases {
-		_, err := TaskExecID(testcase.taskID, testcase.execID)
-		assert.Error(t, err, "unexpected nil error", "invalid task/exec ID %+v", testcase)
-	}
-}
diff --git a/runtime/cni_integ_test.go b/runtime/cni_integ_test.go
index c79298d..095b6eb 100644
--- a/runtime/cni_integ_test.go
+++ b/runtime/cni_integ_test.go
@@ -82,8 +82,6 @@ func TestCNISupport_Isolated(t *testing.T) {
 	}()
 
 	var vmGroup sync.WaitGroup
-	const jailerUID = 300000
-	const jailerGID = 300000
 	for _, vmID := range vmIDs {
 		vmGroup.Add(1)
 		go func(vmID string) {
@@ -115,10 +113,7 @@ func TestCNISupport_Isolated(t *testing.T) {
 						},
 					},
 				}},
-				JailerConfig: &proto.JailerConfig{
-					UID: jailerUID,
-					GID: jailerGID,
-				},
+				JailerConfig: &proto.JailerConfig{},
 			})
 			require.NoError(t, err, "failed to create vm")
 
diff --git a/runtime/jailer_integ_test.go b/runtime/jailer_integ_test.go
index 3509577..4f7d8f3 100644
--- a/runtime/jailer_integ_test.go
+++ b/runtime/jailer_integ_test.go
@@ -36,10 +36,7 @@ func TestJailer_Isolated(t *testing.T) {
 		testJailer(t, nil)
 	})
 	t.Run("With Jailer", func(t *testing.T) {
-		testJailer(t, &proto.JailerConfig{
-			UID: 300001,
-			GID: 300001,
-		})
+		testJailer(t, &proto.JailerConfig{})
 	})
 }
 
@@ -93,8 +90,6 @@ func TestJailerCPUSet_Isolated(t *testing.T) {
 		config := &proto.JailerConfig{
 			CPUs: cset.CPUs(),
 			Mems: cset.Mems(),
-			UID:  300000,
-			GID:  300000,
 		}
 		testJailer(t, config)
 	})
diff --git a/runtime/jailer_test.go b/runtime/jailer_test.go
index d13fba3..c8683e2 100644
--- a/runtime/jailer_test.go
+++ b/runtime/jailer_test.go
@@ -14,14 +14,10 @@
 package main
 
 import (
-	"context"
 	"os"
 	"testing"
 
-	"github.com/sirupsen/logrus"
 	"github.com/stretchr/testify/assert"
-
-	"github.com/firecracker-microvm/firecracker-containerd/proto"
 )
 
 func TestCopyFile_simple(t *testing.T) {
@@ -45,11 +41,3 @@ func TestCopyFile_invalidPaths(t *testing.T) {
 	err := copyFile(srcPath, dstPath, 0600)
 	assert.Error(t, err, "copyFile should have returned an error")
 }
-
-func TestJailer_invalidUIDGID(t *testing.T) {
-	req := proto.CreateVMRequest{
-		JailerConfig: &proto.JailerConfig{},
-	}
-	_, err := newJailer(context.Background(), logrus.NewEntry(logrus.New()), "/foo", &service{}, &req)
-	assert.Error(t, err, "expected invalid uid and gid error, but received none")
-}
diff --git a/runtime/service_integ_test.go b/runtime/service_integ_test.go
index c4a4b79..8c5f976 100644
--- a/runtime/service_integ_test.go
+++ b/runtime/service_integ_test.go
@@ -248,8 +248,6 @@ func TestMultipleVMs_Isolated(t *testing.T) {
 		{
 			MaxContainers: 3,
 			JailerConfig: &proto.JailerConfig{
-				UID:   300000,
-				GID:   300000,
 				NetNS: netns.Path(),
 			},
 		},
@@ -969,12 +967,9 @@ func TestDriveMount_Isolated(t *testing.T) {
 	}
 
 	_, err = fcClient.CreateVM(ctx, &proto.CreateVMRequest{
-		VMID:        vmID,
-		DriveMounts: vmDriveMounts,
-		JailerConfig: &proto.JailerConfig{
-			UID: 300000,
-			GID: 300000,
-		},
+		VMID:         vmID,
+		DriveMounts:  vmDriveMounts,
+		JailerConfig: &proto.JailerConfig{},
 	})
 	require.NoError(t, err, "failed to create vm")