From: Mathieu Desnoyers Date: Mon, 15 Jan 2024 18:36:29 +0000 (-0500) Subject: Fix: libc wrapper: use initial-exec for malloc_nesting TLS X-Git-Url: http://git.liburcu.org/?a=commitdiff_plain;h=49400d96e137c653092cf42177decbd7573fcfcf;hp=49400d96e137c653092cf42177decbd7573fcfcf;p=lttng-ust.git Fix: libc wrapper: use initial-exec for malloc_nesting TLS Use the initial-exec TLS model for the malloc_nesting nesting guard variable to ensure that the glibc implementation of the TLS access don't trigger infinite recursion by calling the memory allocator wrapper functions, which can happen with global-dynamic. Considering that the libc wrapper is meant to be loaded with LD_PRELOAD anyway (never with dlopen(3)), we always expect the libc to have enough space to hold the malloc_nesting variable. In addition to change the malloc_nesting from global-dynamic to initial-exec, this removes the URCU TLS compatibility layer from the libc wrapper, which is a good thing: this compatibility layer relies on pthread key and calloc internally, which makes it a bad fit for TLS accesses guarding access to malloc wrappers, due to possible infinite recursion. Link: https://lists.lttng.org/pipermail/lttng-dev/2024-January/030697.html Reported-by: Florian Weimer Signed-off-by: Mathieu Desnoyers Change-Id: I72c42bc09c1a06e2922b184b85abeb9c94200ee2 ---