]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r354659
authorVincenzo Maffione <vmaffione@FreeBSD.org>
Tue, 26 Nov 2019 18:12:13 +0000 (18:12 +0000)
committerVincenzo Maffione <vmaffione@FreeBSD.org>
Tue, 26 Nov 2019 18:12:13 +0000 (18:12 +0000)
commitc903a05f20f87d50f1cc68de3b8ac6b7d3ef4a71
tree62f23e1ddacadb695334e094c4d386529b959051
parenta85950d8e80911afe18e1cfc402b8d9a79a8ea54
MFC r354659

bhyve: rework mevent processing to fix a race condition

At the end of both mevent_add() and mevent_update(), mevent_notify()
is called to wakeup the I/O thread, that will call kevent(changelist)
to update the kernel.
A race condition is possible where the client calls mevent_add() and
mevent_update(EV_ENABLE) before the I/O thread has the chance to wake
up and call mevent_build()+kevent(changelist) in response to mevent_add().
The mevent_add() is therefore ignored by the I/O thread, and
kevent(fd, EV_ENABLE) is called before kevent(fd, EV_ADD), resuliting
in a failure of the kevent(fd, EV_ENABLE) call.

PR:     241808
Reviewed by:    jhb, markj
Differential Revision:  https://reviews.freebsd.org/D22286
usr.sbin/bhyve/mevent.c