summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-07-31 12:23:01 -0700
committergVisor bot <gvisor-bot@google.com>2020-07-31 12:25:38 -0700
commit8908baaf79fdd137241596fd2444828d1a33fe27 (patch)
treed9efcc85730d8e01c9a95d969cd53044800367f3 /pkg/sentry
parent5d2b09b71d5c073f97f59dd17f6f7ad3ceb4a536 (diff)
Internal change.
PiperOrigin-RevId: 324259991
Diffstat (limited to 'pkg/sentry')
-rw-r--r--pkg/sentry/fdimport/fdimport.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/sentry/fdimport/fdimport.go b/pkg/sentry/fdimport/fdimport.go
index a4199f9e9..b8686adb4 100644
--- a/pkg/sentry/fdimport/fdimport.go
+++ b/pkg/sentry/fdimport/fdimport.go
@@ -15,6 +15,8 @@
package fdimport
import (
+ "fmt"
+
"gvisor.dev/gvisor/pkg/context"
"gvisor.dev/gvisor/pkg/sentry/fs"
"gvisor.dev/gvisor/pkg/sentry/fs/host"
@@ -84,6 +86,9 @@ func importFS(ctx context.Context, fdTable *kernel.FDTable, console bool, fds []
func importVFS2(ctx context.Context, fdTable *kernel.FDTable, console bool, stdioFDs []int) (*hostvfs2.TTYFileDescription, error) {
k := kernel.KernelFromContext(ctx)
+ if k == nil {
+ return nil, fmt.Errorf("cannot find kernel from context")
+ }
var ttyFile *vfs.FileDescription
for appFD, hostFD := range stdioFDs {