Skip to content

Commit 41ae790

Browse files
gbaraldivchuravy
authored andcommitted
Try keno's tentative TLS fix
1 parent ee189cc commit 41ae790

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_tls_get_addr.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include "sanitizer_flags.h"
1717
#include "sanitizer_platform_interceptors.h"
1818

19+
#include <malloc.h>
20+
1921
namespace __sanitizer {
2022
#if SANITIZER_INTERCEPT_TLS_GET_ADDR
2123

@@ -139,6 +141,8 @@ DTLS::DTV *DTLS_on_tls_get_addr(void *arg_void, void *res,
139141
tls_beg = header->start;
140142
VReport(2, "__tls_get_addr: glibc >=2.19 suspected; tls={0x%zx 0x%zx}\n",
141143
tls_beg, tls_size);
144+
} else if (uptr size = malloc_usable_size((void *)tls_beg)) {
145+
tls_size = size;
142146
} else {
143147
VReport(2, "__tls_get_addr: Can't guess glibc version\n");
144148
// This may happen inside the DTOR of main thread, so just ignore it.

0 commit comments

Comments
 (0)