Source-Changes-D archive

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

Re: CVS commit: src/external/gpl3/gcc



Hi again,

On 2020/09/10 21:53, Kamil Rytarowski wrote:
Module Name:	src
Committed By:	kamil
Date:		Thu Sep 10 12:53:06 UTC 2020

Modified Files:
	src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
	    sanitizer_linux_libcdep.cc
	src/external/gpl3/gcc/lib: Makefile.sanitizer

Log Message:
Avoid using internal RTLD/libpthread/libc symbol in sanitizers

...
Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:1.15 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:1.16
--- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc:1.15	Mon Sep  7 07:10:43 2020
+++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc	Thu Sep 10 12:53:05 2020
@@ -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 @@ uptr ThreadSelf() {
#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() {


This change breaks at least mips and powerpc, in which the return value of
__lwp_getprivate(2), i.e., curlwp->l_private is not tcb address itself, but
biased one. On the other hand, the return value of __lwp_gettcb_fast() is
unbiased address; see sys/arch/{mips,powerpc}/include/mcontext.h.

For powerpc, I recently attempted to change l_private to store tcb address
itself:

http://www.nerv.org/netbsd/?q=id:20200621T004000Z.95c1a18070b53713ce2c763df7f40743bf74172c

But I reverted it soon as requested by joerg:

http://www.nerv.org/netbsd/?q=id:20200622T053457Z.05db3be87b5ad499f5d1adba755bc573fd241c87

His reasoning was that kernel must not know the ABI details in userland.
I fully agree with this. See above links for more details.

Thanks,
rin


Home | Main Index | Thread Index | Old Index