mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
Move store after __asan_unpoison in __zipos_alloc (#1135)
Previously, the atomic store looked like it was happening while the struct's memory was still poisoned. I was unable to observe any issues with this, but this change seems to make the code more obviously correct (at the cost of a redundant atomic store to zeroed space in case the map needed to be extended.)
This commit is contained in:
parent
cf9a1f7f33
commit
3e16e59f72
1 changed files with 1 additions and 1 deletions
|
@ -114,7 +114,6 @@ StartOver:
|
||||||
while ((h = *ph)) {
|
while ((h = *ph)) {
|
||||||
if (h->mapsize >= mapsize) {
|
if (h->mapsize >= mapsize) {
|
||||||
if (!_cmpxchg(ph, h, h->next)) goto StartOver;
|
if (!_cmpxchg(ph, h, h->next)) goto StartOver;
|
||||||
atomic_store_explicit(&h->refs, 0, memory_order_relaxed);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ph = &h->next;
|
ph = &h->next;
|
||||||
|
@ -130,6 +129,7 @@ StartOver:
|
||||||
kAsanHeapOverrun);
|
kAsanHeapOverrun);
|
||||||
}
|
}
|
||||||
if (h) {
|
if (h) {
|
||||||
|
atomic_store_explicit(&h->refs, 0, memory_order_relaxed);
|
||||||
h->size = size;
|
h->size = size;
|
||||||
h->zipos = zipos;
|
h->zipos = zipos;
|
||||||
h->mapsize = mapsize;
|
h->mapsize = mapsize;
|
||||||
|
|
Loading…
Reference in a new issue