openanolis / dragonball-sandbox

Dragonball-sandbox is a collection of Rust crates to help build custom Virtual Machine Monitors and hypervisors.
Apache License 2.0
88 stars 41 forks source link

dbs-virtio-devices: correct evset in vsock muxer #291

Closed lisongqian closed 1 year ago

lisongqian commented 1 year ago

When forwarding an epoll event from the unix muxer to the targeted connection event handler, the eventset the connection registered is forwarded instead of the actual epoll operation (IN/OUT).

For example, if the connection was registered for EPOLLIN, and receives an EPOLLOUT, the connection will actually handle an EPOLLOUT.

This is the root cause of previous bug, which caused the introduction of some workarounds (i.e: handling ewouldblock when reading after receiving EPOLLIN, which should never happen).

When matching the connection, we retrieve and use the evset of the connection instead of the one passed as a parameter. The compiler does not complain for an unused variable because it was first logged in a debug! statement.