From 5f13338d30fb59241cf7f1aa6374c54c69677314 Mon Sep 17 00:00:00 2001 From: Kevin Krakauer Date: Fri, 26 Apr 2019 11:08:37 -0700 Subject: Fix reference counting bug in /proc/PID/fdinfo/. PiperOrigin-RevId: 245452217 Change-Id: I7164d8f57fe34c17e601079eb9410a6d95af1869 --- pkg/sentry/fs/proc/fds.go | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'pkg/sentry/fs') diff --git a/pkg/sentry/fs/proc/fds.go b/pkg/sentry/fs/proc/fds.go index 939ebaba1..25da06f5d 100644 --- a/pkg/sentry/fs/proc/fds.go +++ b/pkg/sentry/fs/proc/fds.go @@ -236,24 +236,6 @@ func (f *fdDirFile) Readdir(ctx context.Context, file *fs.File, ser fs.DentrySer }) } -// fdInfoInode is a single file in /proc/TID/fdinfo/. -// -// +stateify savable -type fdInfoInode struct { - staticFileInodeOps - - file *fs.File - flags fs.FileFlags - fdFlags kernel.FDFlags -} - -var _ fs.InodeOperations = (*fdInfoInode)(nil) - -// Release implements fs.InodeOperations.Release. -func (f *fdInfoInode) Release(ctx context.Context) { - f.file.DecRef() -} - // fdInfoDir implements /proc/TID/fdinfo. It embeds an fdDir, but overrides // Lookup and Readdir. // @@ -283,6 +265,7 @@ func (fdid *fdInfoDir) Lookup(ctx context.Context, dir *fs.Inode, p string) (*fs // locks, and other data. For now we only have flags. // See https://www.kernel.org/doc/Documentation/filesystems/proc.txt flags := file.Flags().ToLinux() | fdFlags.ToLinuxFileFlags() + file.DecRef() contents := []byte(fmt.Sprintf("flags:\t0%o\n", flags)) return newStaticProcInode(ctx, dir.MountSource, contents) }) -- cgit v1.2.3