Skip to content

Commit 08dfcf6

Browse files
gbaraldimaleadt
authored andcommitted
Try keno's tentative TLS fix
1 parent 9ef17e7 commit 08dfcf6

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

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include "sanitizer_flags.h"
1818
#include "sanitizer_platform_interceptors.h"
1919

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

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

0 commit comments

Comments
 (0)