summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Gustafsson2024-01-31 21:54:45 +0000
committerDaniel Gustafsson2024-01-31 21:54:45 +0000
commit936f56988741f17cce8731cfa6150fad96e571e9 (patch)
treec1648d8293734f8686d3fa4762326f757f53ea19 /src
parent9d1a5354f58cf61d9be6733d5ad0b36936af5af3 (diff)
Exclude Threadsanitizer instrumentation in exit check
When building libpq there is a check to ensure that we're not linking against code that calls exit(). This check is using a heuristic grep with exclusions for known false positives. The Threadsanitizer library instrumentation for function exits is named such that it triggers the check, so add an exclusion. This fix is only applied to the Makefile since the meson build files don't yet have this check. Adding the check to meson is outside the scope of this patch though. Reported-by: Roman Lozko <[email protected]> Reviewed-by: Tom Lane <[email protected]> Discussion: https://postgr.es/m/CAEhC_BmNGKgj2wKArH2EAU11BsaHYgLnrRFJGRm5Vs8WJzyiQA@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/libpq/Makefile6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile
index bfcc7cdde99..083ca6f4cce 100644
--- a/src/interfaces/libpq/Makefile
+++ b/src/interfaces/libpq/Makefile
@@ -105,7 +105,9 @@ backend_src = $(top_srcdir)/src/backend
# build toolchains insert abort() calls, e.g. to implement assert().)
# If nm doesn't exist or doesn't work on shlibs, this test will do nothing,
# which is fine. The exclusion of __cxa_atexit is necessary on OpenBSD,
-# which seems to insert references to that even in pure C code.
+# which seems to insert references to that even in pure C code. Excluding
+# __tsan_func_exit is necessary when using ThreadSanitizer data race detector
+# which use this function for instrumentation of function exit.
# Skip the test when profiling, as gcc may insert exit() calls for that.
# Also skip the test on platforms where libpq infrastructure may be provided
# by statically-linked libraries, as we can't expect them to honor this
@@ -113,7 +115,7 @@ backend_src = $(top_srcdir)/src/backend
libpq-refs-stamp: $(shlib)
ifneq ($(enable_coverage), yes)
ifeq (,$(filter aix solaris,$(PORTNAME)))
- @if nm -A -u $< 2>/dev/null | grep -v __cxa_atexit | grep exit; then \
+ @if nm -A -u $< 2>/dev/null | grep -v -e __cxa_atexit -e __tsan_func_exit | grep exit; then \
echo 'libpq must not be calling any function which invokes exit'; exit 1; \
fi
endif