|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v4 01/10] evtchn: use per-channel lock where possible
Hi Jan, On 11/01/2021 10:14, Jan Beulich wrote: On 08.01.2021 21:32, Julien Grall wrote:Hi Jan, On 05/01/2021 13:09, Jan Beulich wrote: No. I am pointing out that this is widening the bad behavior (again). Yes, the decrementing of ->valid_evtchns has a similar effect, but I'm not convinced it gets us into XSA territory again. The problem wasn't the reducing of ->max_evtchns as such, but the derived assumptions elsewhere in the code. If there were any such again, I suppose we'd have reason to issue another XSA. I don't think it get us to the XSA territory yet. However, the locking/interaction in the event channel code is quite complex. To give a concrete example, below the current implementation of free_xen_event_channel():
if ( !port_is_valid(d, port) )
{
/*
* Make sure ->is_dying is read /after/ ->valid_evtchns, pairing
* with the spin_barrier() and BUG_ON() in evtchn_destroy().
*/
smp_rmb();
BUG_ON(!d->is_dying);
return;
}
evtchn_close(d, port, 0);
It would be fair for a developer to assume that after the check above,
port_is_valid() would return true. However, this is not the case...
I am not aware of any issue so far... But I am not ready to be this is not going to be missed out. How about you? > If there were any such again, I > suppose we'd have reason to issue another XSA.The point of my e-mail is to prevent this XSA to happen. I am pretty sure you want the same. Furthermore there are other paths already using port_is_valid() without holding the domain's event lock; I've not been able to spot a problem with this though, so far. Right. Most of the fine are fine because d == current. Therefore, the domain must be running and evtchn_destroy() couldn't happen concurrently.
It remains usable *today*, the question is how long this will last?All the recent XSAs in the event channel taught me that the locking/interaction is extremely complex. This series is another proof. We would save us quite a bit of trouble by making port_is_valid() stable no matter the state of the domain. I think an extra field (option 2) is quite a good compromise with space use, maintenance, speed. I am would be interested to hear from others. Cheers, -- Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |