Skip to content

Commit 8d75595

Browse files
authored
Merge pull request #568 from RalfJung/deque-ub
deliberate UB: add crossbeam-deque
2 parents f572fa7 + 0aef121 commit 8d75595

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

resources/deliberate-ub.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ We should evaluate whether there truly is some use-case here that is not current
1818
It is not clear how to best specify a useful `compare_exchange` that can work on padding bytes,
1919
see the [discussion here](https://github.com/rust-lang/unsafe-code-guidelines/issues/449).<br>
2020
The alternative is to not use the "fast path" for problematic types (and fall back to the SeqLock), but that requires some way to query at `const`-time whether the type contains padding (or provenance).
21-
(Or of course one can use inline assembly, but it would be better if that was not required.)
21+
(Or of course one can use inline assembly, but it would be better if that was not required. This is in fact what crossbeam now does, via [atomic-maybe-uninit](https://github.com/taiki-e/atomic-maybe-uninit).)
22+
* crossbeam's deque uses [volatile accesses that really should be atomic instead](https://github.com/crossbeam-rs/crossbeam/blob/5a154def002304814d50f3c7658bd30eb46b2fad/crossbeam-deque/src/deque.rs#L70-L88).
23+
They cannot use atomic accesses as those are not possible for arbitrary `T`.
24+
This would be resolved by bytewise atomic memcpy.
2225

2326
### Cases related to aliasing
2427

0 commit comments

Comments
 (0)