You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The METRICS.write() method operates on the false assumption
that it is only being called from one thread (VMM).
This is not true since it is called from the signal handlers
as well (which may be executed on any thread).
The race condition appears due to the fact that metrics state is
mutated during serialization for SharedIncMetrics (old value gets
assigned the new value after the difference is serialized).
The METRICS.write() method only holds the lock when writing to the
file, but there is no lock held while serialising the metrics to JSON.
VMM THREAD (1/MINUTE) VCPU THREAD (SIGNAL HANDLER)
new_val=1
dif=new_val-old_val(=1)
old_val=new_val (=1)
dif=new_val-old_val (=0)
write(dif) (=0)
exit()
Because of the exit(), the VMM thread no longer gets a chance to
write the metric.
We now use SharedStoreMetric for deadly signal metrics,
which does not have this type of race condition because it is not
mutated on serialization.
It also does not make sense to have a SharedIncMetric for deadly
signal metrics, which can only ever be 0 or 1.
This was the root-cause of the intermittent failure in
test_custom_seccomp.py::test_failing_fiter
Signed-off-by: alindima <[email protected]>
0 commit comments