[roll] Roll fuchsia [mold] Fixed UB issues.
There were two undefined behavior issues identified by miri:
1. a slice::from_raw_parts call that was using a bigger length
than allowed for the allocation
2. lack of compliance with Rust's still unstable Stacked Borrows
in the SplitsCache type because the creation of a secondary
mutable reference for an allocation whose pointer was still
going to be used.
Examples:
1. let mut array = [1i32, 2, 3];
let slice = unsafe { slice::from_raw_parts(array.as_ptr(), 4) };
2. let mut o = ();
let p = &mut o as *mut _;
&mut o; // mutably ref'd even though p is a deref'd later
unsafe { *p = (); }
The fix for the first issue was trivial.
The fix for the second involved refactoring Layout and SplitsCache.
SplitsCache, now renamed into SliceCache, uses a global pointer to store
the latest use in SliceCache::access, while blocking if there is any
other instance trying to use the same pointer.
This is a conservative solution since concurrent access with even
disjoint caches is not supported.
Layout was also simplified by removing the TileWriter type and simply
moving the logic to the Layout trait.
Testing: fx test surpass-tests && fx test mold-tests
Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/643829
Original-Revision: cc2ad85e51fa05659d316c1b61a1d71f215d42f6
GitOrigin-RevId: 1adcbe3d7166f628d28738ac7be2d7aa0a7381e3
Change-Id: I4ec94f47d82053b69eac6834781db1b5370e80b6
This repository contains Fuchsia's Global Integration manifest files.
All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.
Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance via the IRC channel #fuchsia on Freenode.
First install Jiri.
Next run:
$ jiri init $ jiri import minimal https://fuchsia.googlesource.com/integration $ jiri update
Third party projects should have their own subdirectory in ./third_party.