summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry')
-rw-r--r--pkg/sentry/fs/inotify_watch.go12
-rw-r--r--pkg/sentry/strace/linux64.go2
2 files changed, 8 insertions, 6 deletions
diff --git a/pkg/sentry/fs/inotify_watch.go b/pkg/sentry/fs/inotify_watch.go
index b83544c9f..d33e7e498 100644
--- a/pkg/sentry/fs/inotify_watch.go
+++ b/pkg/sentry/fs/inotify_watch.go
@@ -76,15 +76,17 @@ func isRenameEvent(eventMask uint32) bool {
// Notify queues a new event on this watch.
func (w *Watch) Notify(name string, events uint32, cookie uint32) {
- unmaskableBits := ^uint32(0) &^ linux.IN_ALL_EVENTS
- effectiveMask := unmaskableBits | atomic.LoadUint32(&w.mask)
- matchedEvents := effectiveMask & events
-
- if matchedEvents == 0 {
+ mask := atomic.LoadUint32(&w.mask)
+ if mask&events == 0 {
// We weren't watching for this event.
return
}
+ // Event mask should include bits matched from the watch plus all control
+ // event bits.
+ unmaskableBits := ^uint32(0) &^ linux.IN_ALL_EVENTS
+ effectiveMask := unmaskableBits | mask
+ matchedEvents := effectiveMask & events
w.owner.queueEvent(newEvent(w.wd, name, matchedEvents, cookie))
}
diff --git a/pkg/sentry/strace/linux64.go b/pkg/sentry/strace/linux64.go
index e8fb711a5..de2da9369 100644
--- a/pkg/sentry/strace/linux64.go
+++ b/pkg/sentry/strace/linux64.go
@@ -271,7 +271,7 @@ var linuxAMD64 = SyscallMap{
251: makeSyscallInfo("ioprio_set", Hex, Hex, Hex),
252: makeSyscallInfo("ioprio_get", Hex, Hex),
253: makeSyscallInfo("inotify_init"),
- 254: makeSyscallInfo("inotify_add_watch", Hex, Hex, Hex),
+ 254: makeSyscallInfo("inotify_add_watch", Hex, Path, Hex),
255: makeSyscallInfo("inotify_rm_watch", Hex, Hex),
256: makeSyscallInfo("migrate_pages", Hex, Hex, Hex, Hex),
257: makeSyscallInfo("openat", Hex, Path, OpenFlags, Mode),