diff options
author | Fabricio Voznika <fvoznika@google.com> | 2020-04-10 15:46:16 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-04-10 15:47:23 -0700 |
commit | 96f914295920404e7c5c97553771e09b31f6900a (patch) | |
tree | 02738d88b3be86d6ab8acbdaa0811dbd182eef08 /pkg/sentry/fs/gofer/inode.go | |
parent | ca868e3e384fb1dabec4fd27ff3627f61a3bd54d (diff) |
Use O_CLOEXEC when dup'ing FDs
The sentry doesn't allow execve, but it's a good defense
in-depth measure.
PiperOrigin-RevId: 305958737
Diffstat (limited to 'pkg/sentry/fs/gofer/inode.go')
-rw-r--r-- | pkg/sentry/fs/gofer/inode.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/sentry/fs/gofer/inode.go b/pkg/sentry/fs/gofer/inode.go index 811e8ea30..a016c896e 100644 --- a/pkg/sentry/fs/gofer/inode.go +++ b/pkg/sentry/fs/gofer/inode.go @@ -273,7 +273,7 @@ func (i *inodeFileState) recreateReadHandles(ctx context.Context, writer *handle // operations on the old will see the new data. Then, make the new handle take // ownereship of the old FD and mark the old readHandle to not close the FD // when done. - if err := syscall.Dup3(h.Host.FD(), i.readHandles.Host.FD(), 0); err != nil { + if err := syscall.Dup3(h.Host.FD(), i.readHandles.Host.FD(), syscall.O_CLOEXEC); err != nil { return err } |