Refresh provenance of global allocator #2686
Labels
A-allocator
Area: related to memory allocation
C-enhancement
Category: a PR with an enhancement or an issue tracking an accepted enhancement
I-misses-UB
Impact: makes Miri miss UB, i.e., a false negative (with default settings)
It would seem nice if Miri could detect an error in the following code:
That would basically reflect that the global allocator entry points are special magic and cannot be interchanged with directly calling the underlying allocator. (This doesn't catch all possible issue called by the magic of these symbols, e.g. it does not reflect that LLVM can replace heap allocations by stack allocations or even remove them entirely under some circumstances.)
To implement this we'll probably want the __rust_alloc shim to generate new provenance for the allocation (to distinguish it from the underlying allocation generated by
System
) and __rust_dealloc should undo that transformation. The details are pretty unclear though -- do we have two AllocId with the same address or do we use something more like Stacked Borrows to realize this "stacking" of allocations?Related discussion: rust-lang/wg-allocators#108.
The text was updated successfully, but these errors were encountered: