summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/proc/task.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-04-24 18:49:57 +0000
committergVisor bot <gvisor-bot@google.com>2020-04-24 18:49:57 +0000
commitada068d683c1f6be72ecbeda436659ba6ecd1e9a (patch)
treea23dd4061907427c2d1e289a45651dc6b102e44f /pkg/sentry/fsimpl/proc/task.go
parent57f05062f655eb7b1d9a43b407b82b97449195ee (diff)
parent2cc0fd42f462f3942230c4b33ca2825e2a28765d (diff)
Merge release-20200323.0-235-g2cc0fd4 (automated)
Diffstat (limited to 'pkg/sentry/fsimpl/proc/task.go')
-rwxr-xr-xpkg/sentry/fsimpl/proc/task.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/sentry/fsimpl/proc/task.go b/pkg/sentry/fsimpl/proc/task.go
index 888afc0fd..e2790d35b 100755
--- a/pkg/sentry/fsimpl/proc/task.go
+++ b/pkg/sentry/fsimpl/proc/task.go
@@ -44,6 +44,7 @@ type taskInode struct {
var _ kernfs.Inode = (*taskInode)(nil)
func newTaskInode(inoGen InoGenerator, task *kernel.Task, pidns *kernel.PIDNamespace, isThreadGroup bool, cgroupControllers map[string]string) *kernfs.Dentry {
+ // TODO(gvisor.dev/issue/164): Fail with ESRCH if task exited.
contents := map[string]*kernfs.Dentry{
"auxv": newTaskOwnedFile(task, inoGen.NextIno(), 0444, &auxvData{task: task}),
"cmdline": newTaskOwnedFile(task, inoGen.NextIno(), 0444, &cmdlineData{task: task, arg: cmdlineDataArg}),
@@ -102,8 +103,10 @@ func (i *taskInode) Valid(ctx context.Context) bool {
// Open implements kernfs.Inode.
func (i *taskInode) Open(rp *vfs.ResolvingPath, vfsd *vfs.Dentry, opts vfs.OpenOptions) (*vfs.FileDescription, error) {
- fd := &kernfs.GenericDirectoryFD{}
- fd.Init(rp.Mount(), vfsd, &i.OrderedChildren, &opts)
+ fd, err := kernfs.NewGenericDirectoryFD(rp.Mount(), vfsd, &i.OrderedChildren, &opts)
+ if err != nil {
+ return nil, err
+ }
return fd.VFSFileDescription(), nil
}