Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gcc/lib Avoid using internal RTLD/libpthread/l...



details:   https://anonhg.NetBSD.org/src/rev/29e85511b140
branches:  trunk
changeset: 938527:29e85511b140
user:      kamil <kamil%NetBSD.org@localhost>
date:      Thu Sep 10 12:53:05 2020 +0000

description:
Avoid using internal RTLD/libpthread/libc symbol in sanitizers

Cherry-pick and adapt:

commit 0da15ff318480f30bbc90b9e8ecb9bb9431c7fd3
Author: Kamil Rytarowski <n54%gmx.com@localhost>
Date:   Fri Jan 3 02:35:33 2020 +0100

    [compiler-rt] [netbsd] Switch to syscall for ThreadSelfTlsTcb()

    This change avoids using internal, namespaced per-CPU calls that
    are not a stable interface to read the TSL base value.

diffstat:

 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc |  9 ++-------
 external/gpl3/gcc/lib/Makefile.sanitizer                                        |  4 +---
 2 files changed, 3 insertions(+), 10 deletions(-)

diffs (44 lines):

diff -r 0575d58daca4 -r 29e85511b140 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
--- a/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc   Thu Sep 10 11:31:03 2020 +0000
+++ b/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc   Thu Sep 10 12:53:05 2020 +0000
@@ -47,6 +47,7 @@
 #if SANITIZER_NETBSD
 #include <sys/sysctl.h>
 #include <sys/tls.h>
+#include <lwp.h>
 #endif
 
 #if SANITIZER_SOLARIS
@@ -417,13 +418,7 @@
 
 #if SANITIZER_NETBSD
 static struct tls_tcb * ThreadSelfTlsTcb() {
-  struct tls_tcb * tcb = NULL;
-# ifdef __HAVE___LWP_GETTCB_FAST
-  tcb = (struct tls_tcb *)__lwp_gettcb_fast();
-# elif defined(__HAVE___LWP_GETPRIVATE_FAST)
-  tcb = (struct tls_tcb *)__lwp_getprivate_fast();
-# endif
-  return tcb;
+  return (struct tls_tcb *)_lwp_getprivate();
 }
 
 uptr ThreadSelf() {
diff -r 0575d58daca4 -r 29e85511b140 external/gpl3/gcc/lib/Makefile.sanitizer
--- a/external/gpl3/gcc/lib/Makefile.sanitizer  Thu Sep 10 11:31:03 2020 +0000
+++ b/external/gpl3/gcc/lib/Makefile.sanitizer  Thu Sep 10 12:53:05 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.sanitizer,v 1.12 2020/09/05 13:36:49 mrg Exp $
+#      $NetBSD: Makefile.sanitizer,v 1.13 2020/09/10 12:53:05 kamil Exp $
 
 SANITIZER=${GCCDIST}/libsanitizer
 .PATH: ${SANITIZER}/interception ${SANITIZER}/sanitizer_common
@@ -75,8 +75,6 @@
 SRCS+= ${INTERCEPTION_SRCS} ${SANITIZER_SRCS}
 CPPFLAGS+=-I${SANITIZER}/include -I${SANITIZER}
 CPPFLAGS.sanitizer_netbsd.cc+=-I${GCCDIST}/gcc/ginclude
-# XXX __lwp_getprivate_fast() is hidden normally.
-CPPFLAGS.sanitizer_linux_libcdep.cc+= -D__LIBPTHREAD_SOURCE__
 # XXX wants old lwp info and power ioctl, npf wants nv.h
 CPPFLAGS.sanitizer_platform_limits_netbsd.cc+= -D__LEGACY_PT_LWPINFO -D_KMEMUSER \
        -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist



Home | Main Index | Thread Index | Old Index