From d64ba89da3a5e8aaf28a9da1b40cb2231a4c6b42 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Tue, 4 Aug 2020 09:29:11 -0700 Subject: Internal change. PiperOrigin-RevId: 324826968 --- pkg/sentry/fsimpl/testutil/kernel.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/sentry/fsimpl/testutil/kernel.go b/pkg/sentry/fsimpl/testutil/kernel.go index 1e57744e8..1813269e0 100644 --- a/pkg/sentry/fsimpl/testutil/kernel.go +++ b/pkg/sentry/fsimpl/testutil/kernel.go @@ -122,6 +122,10 @@ func Boot() (*kernel.Kernel, error) { // CreateTask creates a new bare bones task for tests. func CreateTask(ctx context.Context, name string, tc *kernel.ThreadGroup, mntns *vfs.MountNamespace, root, cwd vfs.VirtualDentry) (*kernel.Task, error) { k := kernel.KernelFromContext(ctx) + if k == nil { + return nil, fmt.Errorf("cannot find kernel from context") + } + exe, err := newFakeExecutable(ctx, k.VFS(), auth.CredentialsFromContext(ctx), root) if err != nil { return nil, err -- cgit v1.2.3