xqemu/util
Daniel P. Berrangé b4682a63f8 filemon: fix watch IDs to avoid potential wraparound issues
Watch IDs are allocated from incrementing a int counter against
the QFileMonitor object. In very long life QEMU processes with
a huge amount of USB MTP activity creating & deleting directories
it is just about conceivable that the int counter can wrap
around. This would result in incorrect behaviour of the file
monitor watch APIs due to clashing watch IDs.

Instead of trying to detect this situation, this patch changes
the way watch IDs are allocated. It is turned into an int64_t
variable where the high 32 bits are set from the underlying
inotify "int" ID. This gives an ID that is guaranteed unique
for the directory as a whole, and we can rely on the kernel
to enforce this. QFileMonitor then sets the low 32 bits from
a per-directory counter.

The USB MTP device only sets watches on the directory as a
whole, not files within, so there is no risk of guest
triggered wrap around on the low 32 bits.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-04-02 13:52:02 +01:00
..
aio-posix.c aio-posix: Assert that aio_poll() is always called in home thread 2019-02-25 15:03:19 +01:00
aio-wait.c block: Use a single global AioWait 2018-09-25 15:50:15 +02:00
aio-win32.c aio-posix: Fix concurrent aio_poll/set_fd_handler. 2019-01-14 14:09:41 +00:00
aiocb.c
async.c util/async: use qemu_aio_coroutine_enter in co_schedule_bh_cb 2018-09-25 15:50:15 +02:00
atomic64.c util: add atomic64 2018-10-02 18:47:55 +02:00
base64.c
bitmap.c
bitops.c avoid TABs in files that only contain a few 2019-01-11 15:46:56 +01:00
buffer.c
bufferiszero.c
cacheinfo.c util: add atomic64 2018-10-02 18:47:55 +02:00
compatfd.c
coroutine-sigaltstack.c
coroutine-ucontext.c
coroutine-win32.c
crc32c.c
cutils.c cutils: Fix qemu_strtosz() & friends to reject non-finite sizes 2018-12-13 19:10:06 +01:00
drm.c util: promote qemu_egl_rendernode_open() to libqemuutil 2018-08-27 10:51:44 +02:00
envlist.c
error.c util/error: Remove an unnecessary NULL check 2019-03-26 08:10:11 +01:00
event_notifier-posix.c
event_notifier-win32.c
fifo8.c
filemonitor-inotify.c filemon: fix watch IDs to avoid potential wraparound issues 2019-04-02 13:52:02 +01:00
filemonitor-stub.c filemon: fix watch IDs to avoid potential wraparound issues 2019-04-02 13:52:02 +01:00
getauxval.c
hbitmap.c Revert "hbitmap: Add @advance param to hbitmap_iter_next()" 2019-01-15 18:26:50 -05:00
hexdump.c
host-utils.c
id.c
iohandler.c
iov.c
iova-tree.c util: remove redundant include of glib.h and add osdep.h 2018-06-29 12:22:28 +01:00
keyval.c
lockcnt.c
log.c tcg: Optionally log FPU state in TCG -d cpu logging 2018-05-15 14:58:44 +01:00
main-loop.c slirp: move sources to src/ subdirectory 2019-03-07 12:46:31 +01:00
Makefile.objs build-sys: link with slirp as an external project 2019-03-07 12:46:31 +01:00
memfd.c memfd: improve error messages 2019-03-11 17:17:01 -03:00
mmap-alloc.c mmap-alloc: fix hugetlbfs misaligned length in ppc64 2019-02-04 18:44:20 +11:00
module.c module: Use QEMU_MODULE_DIR as a search path 2018-08-23 18:46:25 +02:00
notify.c
osdep.c slirp: prefer c99 types over BSD kind 2019-02-07 15:49:08 +02:00
oslib-posix.c Machine queue, 2019-03-11 2019-03-12 15:25:46 +00:00
oslib-win32.c hostmem-file: reject invalid pmem file sizes 2019-03-11 10:44:19 -03:00
pagesize.c
path.c
qdist.c
qemu-config.c block: Add block-specific QDict header 2018-06-15 14:49:44 +02:00
qemu-coroutine-io.c
qemu-coroutine-lock.c
qemu-coroutine-sleep.c qemu-coroutine-sleep: drop CoSleepCB 2019-01-24 10:05:16 +00:00
qemu-coroutine.c block: Add missing locking in bdrv_co_drain_bh_cb() 2018-09-25 15:50:15 +02:00
qemu-error.c error: Drop bogus "use error_setg() instead" admonitions 2018-10-19 15:47:09 +02:00
qemu-openpty.c
qemu-option.c qemu/queue.h: simplify reverse access to QTAILQ 2019-01-11 15:46:55 +01:00
qemu-progress.c
qemu-sockets.c avoid TABs in files that only contain a few 2019-01-11 15:46:56 +01:00
qemu-thread-common.h Clean up includes 2018-12-20 10:29:08 +01:00
qemu-thread-posix.c qemu-thread: Don't block SEGV, ILL and FPE 2019-01-08 12:34:46 +00:00
qemu-thread-win32.c build-sys: build with Vista API by default 2019-01-11 13:57:25 +01:00
qemu-timer-common.c
qemu-timer.c qemu-timer: avoid checkpoints for virtual clock timers in external subsystems 2018-10-19 13:44:03 +02:00
qht.c qht: constify arguments to some internal functions 2018-09-26 08:55:54 -07:00
qsp.c include: move exec/tb-hash-xx.h to qemu/xxhash.h 2018-12-17 06:04:44 +03:00
range.c Don't talk about the LGPL if the file is licensed under the GPL 2019-01-30 10:51:20 +01:00
rcu.c
readline.c
stats64.c
sys_membarrier.c
systemd.c
thread-pool.c
throttle.c
timed-average.c
trace-events filemon: fix watch IDs to avoid potential wraparound issues 2019-04-02 13:52:02 +01:00
unicode.c json: Reject invalid UTF-8 sequences 2018-08-24 20:26:37 +02:00
uri.c cutils: Provide strchrnul 2018-06-29 12:32:10 +02:00
uuid.c uuid: Make qemu_uuid_bswap() take and return a QemuUUID 2019-02-01 13:46:45 +01:00
vfio-helpers.c exec: Change RAMBlockIterFunc definition 2019-03-06 10:49:17 +00:00