diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-05-06 23:03:29 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-05-06 23:03:29 +0300 |
commit | 247e7354f3361e5cfe9ea9dd420fbdeac801efaa (patch) | |
tree | da4ff0cd6ec3740ec711b563d6a7a18b4282b37d /typd_mlc.c | |
parent | f8e6e7d8fb2fdadb58fc33b6035053abb0e8957c (diff) | |
download | bdwgc-247e7354f3361e5cfe9ea9dd420fbdeac801efaa.tar.gz |
Workaround TSan FP about race between generic_malloc and array_mark_proc
* typd_mlc.c (get_complex_descr): New static function (defined with
GC_ATTR_NO_SANITIZE_THREAD attribute).
* typd_mlc.c (GC_array_mark_proc): Use get_complex_descr() instead of
direct access of addr[nwords-1].
Diffstat (limited to 'typd_mlc.c')
-rw-r--r-- | typd_mlc.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -450,6 +450,12 @@ STATIC mse * GC_push_complex_descriptor(word *addr, complex_descriptor *d, } } +GC_ATTR_NO_SANITIZE_THREAD +static complex_descriptor *get_complex_descr(word *addr, word nwords) +{ + return (complex_descriptor *)addr[nwords - 1]; +} + STATIC mse * GC_array_mark_proc(word * addr, mse * mark_stack_ptr, mse * mark_stack_limit, word env GC_ATTR_UNUSED) @@ -457,7 +463,7 @@ STATIC mse * GC_array_mark_proc(word * addr, mse * mark_stack_ptr, hdr * hhdr = HDR(addr); word sz = hhdr -> hb_sz; word nwords = BYTES_TO_WORDS(sz); - complex_descriptor * descr = (complex_descriptor *)(addr[nwords-1]); + complex_descriptor *descr = get_complex_descr(addr, nwords); mse * orig_mark_stack_ptr = mark_stack_ptr; mse * new_mark_stack_ptr; |