projects
/
lttng-ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: pre-fault TLS in ust-malloc instrumentation
[lttng-ust.git]
/
liblttng-ust-libc-wrapper
/
lttng-ust-malloc.c
diff --git
a/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c
index 4b21c971516d54ce3a5eaac80e63e660f0f14f84..f3e1e19e28e52d8d5fe07d399f6c4741d0d87282 100644
(file)
--- a/
liblttng-ust-libc-wrapper/lttng-ust-malloc.c
+++ b/
liblttng-ust-libc-wrapper/lttng-ust-malloc.c
@@
-18,7
+18,11
@@
*/
#define _GNU_SOURCE
*/
#define _GNU_SOURCE
-#define _LGPL_SOURCE
+/*
+ * Do _not_ define _LGPL_SOURCE because we don't want to create a
+ * circular dependency loop between this malloc wrapper, liburcu and
+ * libc.
+ */
#include <lttng/ust-dlfcn.h>
#include <sys/types.h>
#include <stdio.h>
#include <lttng/ust-dlfcn.h>
#include <sys/types.h>
#include <stdio.h>
@@
-417,6
+421,12
@@
int posix_memalign(void **memptr, size_t alignment, size_t size)
return retval;
}
return retval;
}
+static
+void lttng_ust_fixup_malloc_nesting_tls(void)
+{
+ asm volatile ("" : : "m" (URCU_TLS(malloc_nesting)));
+}
+
__attribute__((constructor))
void lttng_ust_malloc_wrapper_init(void)
{
__attribute__((constructor))
void lttng_ust_malloc_wrapper_init(void)
{
@@
-424,6
+434,7
@@
void lttng_ust_malloc_wrapper_init(void)
if (cur_alloc.calloc) {
return;
}
if (cur_alloc.calloc) {
return;
}
+ lttng_ust_fixup_malloc_nesting_tls();
/*
* Ensure the allocator is in place before the process becomes
* multithreaded.
/*
* Ensure the allocator is in place before the process becomes
* multithreaded.
This page took
0.02427 seconds
and
4
git commands to generate.