summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/host/host.go
diff options
context:
space:
mode:
authorDean Deng <deandeng@google.com>2021-04-15 16:29:15 -0700
committergVisor bot <gvisor-bot@google.com>2021-04-15 16:30:58 -0700
commitb5919d3065a28c1fd6f27612bafd28f06bf3f0d0 (patch)
treee707b434bfe19bc0b3e79f9f1eaffa4e192fb3d5 /pkg/sentry/fsimpl/host/host.go
parent10de8978f93a6593785038dd87a2937a8299a3a9 (diff)
Generate notification when closing host fd.
Thanks ianlewis@ for discovering the bug/fix! PiperOrigin-RevId: 368740744
Diffstat (limited to 'pkg/sentry/fsimpl/host/host.go')
-rw-r--r--pkg/sentry/fsimpl/host/host.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/sentry/fsimpl/host/host.go b/pkg/sentry/fsimpl/host/host.go
index 3b90375b6..a81f550b1 100644
--- a/pkg/sentry/fsimpl/host/host.go
+++ b/pkg/sentry/fsimpl/host/host.go
@@ -460,6 +460,9 @@ func (i *inode) DecRef(ctx context.Context) {
if err := unix.Close(i.hostFD); err != nil {
log.Warningf("failed to close host fd %d: %v", i.hostFD, err)
}
+ // We can't rely on fdnotifier when closing the fd, because the event may race
+ // with fdnotifier.RemoveFD. Instead, notify the queue explicitly.
+ i.queue.Notify(waiter.EventHUp | waiter.ReadableEvents | waiter.WritableEvents)
})
}