Description
UPDATE(taiki-e): The error originally reported here no longer exists. See #545 (comment) for the remaining SB violations currently reported. The fix for SB violations in epoch exists in #871, and using that branch or using TB (-Zmiri-tree-borrows) instead of SB should fix problems.
Hello.
Another MIRI unbounded behavior for destructors, this time in Collector.
let x1_0: crossbeam::epoch::Collector = crossbeam::epoch::Collector::new();//LAYER:0
let x2_0: & crossbeam::epoch::Collector = & x1_0;//LAYER:1
let x3_0: crossbeam::epoch::LocalHandle = x2_0.register();//LAYER:2
Running this gives the MIRI error at deallocation:
error: Undefined Behavior: deallocating while item is protected: [SharedReadWrite for <235744> (call 76130)]
<trace>
I am not super familiar with your internal memory structure, but this may be related to a similar issue seen in another garbage collection implementation. Maybe it will help with the patch.
A code file with a full trace attached. It looks a little weird because the test case was automatically generated.
As for the impact of this issue, it doesn't seem to be too big of an issue as it is mostly contained. Use-after-free should not be possible unless something else happens during dealloc. I can't be 100% sure because Miri stops at that point, but looking at the code in list.rs, it looks okay. It may become more problematic if people start adding more unsafe functions that expose internal memory in some way.
Thanks
~Yoshi