summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/host/inode.go
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2020-12-23 11:08:42 -0800
committergVisor bot <gvisor-bot@google.com>2020-12-23 11:11:07 -0800
commitd07915987631f4c3c6345275019a5b5b0cf28dbb (patch)
treee4fe185b9f066fbdc59581ae4f3c8b907807b2f2 /pkg/sentry/fs/host/inode.go
parent6d96a2394d3a4b983b1fa046cf605e22404c4948 (diff)
vfs1: don't allow to open socket files
open() has to return ENXIO in this case. O_PATH isn't supported by vfs1. PiperOrigin-RevId: 348820478
Diffstat (limited to 'pkg/sentry/fs/host/inode.go')
-rw-r--r--pkg/sentry/fs/host/inode.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/sentry/fs/host/inode.go b/pkg/sentry/fs/host/inode.go
index fbfba1b58..2c14aa6d9 100644
--- a/pkg/sentry/fs/host/inode.go
+++ b/pkg/sentry/fs/host/inode.go
@@ -276,6 +276,10 @@ func (i *inodeOperations) BoundEndpoint(inode *fs.Inode, path string) transport.
// GetFile implements fs.InodeOperations.GetFile.
func (i *inodeOperations) GetFile(ctx context.Context, d *fs.Dirent, flags fs.FileFlags) (*fs.File, error) {
+ if fs.IsSocket(d.Inode.StableAttr) {
+ return nil, syserror.ENXIO
+ }
+
return newFile(ctx, d, flags, i), nil
}