diff options
author | Rabin Vincent <rabinv@axis.com> | 2017-04-17 12:03:44 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2017-04-17 12:03:44 -0300 |
commit | 2604882cefd3281679b8177245fdebc7061b8695 (patch) | |
tree | 9c9f7ba9da605b92df7849ca7deba57e60dff3ac /sysdeps/generic | |
parent | a12ae89f860229cbe5ba91f1f9cf17cc5a9ede31 (diff) | |
download | glibc-2604882cefd3281679b8177245fdebc7061b8695.tar.gz glibc-2604882cefd3281679b8177245fdebc7061b8695.tar.xz glibc-2604882cefd3281679b8177245fdebc7061b8695.zip |
[BZ 21357] unwind-dw2-fde: Call free() outside of unwind mutex
__deregister_frame_info_bases() calls free() while holding a mutex which is also used from _Unwind_Find_FDE(). This leads to a deadlock if AddressSanitizer uses _Unwind_Backtrace() from its free() implementation. Checked on mips-linux-gnu and x86_64-linux-gnu. [BZ #21357] * sysdeps/generic/unwind-dw2-fde.c (__deregister_frame_info_bases): Call free() outside of mutex.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r-- | sysdeps/generic/unwind-dw2-fde.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sysdeps/generic/unwind-dw2-fde.c b/sysdeps/generic/unwind-dw2-fde.c index 2f0bcd2ee9..104a2552b4 100644 --- a/sysdeps/generic/unwind-dw2-fde.c +++ b/sysdeps/generic/unwind-dw2-fde.c @@ -202,6 +202,7 @@ __deregister_frame_info_bases (void *begin) { struct object **p; struct object *ob = 0; + struct fde_vector *tofree = NULL; /* If .eh_frame is empty, we haven't registered. */ if (*(uword *) begin == 0) @@ -225,7 +226,7 @@ __deregister_frame_info_bases (void *begin) { ob = *p; *p = ob->next; - free (ob->u.sort); + tofree = ob->u.sort; goto out; } } @@ -244,6 +245,7 @@ __deregister_frame_info_bases (void *begin) out: __gthread_mutex_unlock (&object_mutex); + free (tofree); return (void *) ob; } hidden_def (__deregister_frame_info_bases) |