diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2018-02-09 18:40:20 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2018-02-09 18:40:20 +0300 |
commit | 95c4f56183ec9be404857c575971ccfd972f2194 (patch) | |
tree | b62ea4af760e81fba44cee7fc33ee124894b2c36 /mallocx.c | |
parent | 8a70c2d825c444de85171c767df75f05ba555691 (diff) | |
download | bdwgc-95c4f56183ec9be404857c575971ccfd972f2194.tar.gz |
Revert 'Workaround TSan false positive about clear_hdr_marks/realloc race'
This reverts commit 20468dd131d82be7422aea3c7383ec9201452fce.
Because it is not a false positive. And we are lying to the compiler
about the value not changing asynchronously, which is never good.
The proper solution could be use of atomic accesses (even unordered)
on the size field.
Diffstat (limited to 'mallocx.c')
-rw-r--r-- | mallocx.c | 14 |
1 files changed, 1 insertions, 13 deletions
@@ -78,18 +78,6 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_generic_or_special_malloc(size_t lb, } } -/* There could be a data race between this function (called from */ -/* GC_realloc without any synchronization) and e.g. GC_clear_hdr_marks */ -/* (invoked indirectly from GC_try_to_collect_inner) but it should be */ -/* safe as long as the new size is not smaller than the old one. */ -GC_ATTR_NO_SANITIZE_THREAD -static void hb_sz_async_grow_within_hblk(hdr * hhdr, size_t sz) -{ - GC_ASSERT(hhdr->hb_sz <= sz - && sz <= ((hhdr->hb_sz + HBLKSIZE - 1) & ~HBLKMASK)); - hhdr->hb_sz = sz; -} - /* Change the size of the block pointed to by p to contain at least */ /* lb bytes. The object may be (and quite likely will be) moved. */ /* The kind (e.g. atomic) is the same as that of the old. */ @@ -121,7 +109,7 @@ GC_API void * GC_CALL GC_realloc(void * p, size_t lb) word descr; sz = (sz+HBLKSIZE-1) & (~HBLKMASK); - hb_sz_async_grow_within_hblk(hhdr, sz); + hhdr -> hb_sz = sz; descr = GC_obj_kinds[obj_kind].ok_descriptor; if (GC_obj_kinds[obj_kind].ok_relocate_descr) descr += sz; hhdr -> hb_descr = descr; |