[PATCH] D43909: [3/3] OpenBSD UBsan support / common

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 05:04:09 PST 2018


krytarowski added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:476
 tid_t GetTid() {
-#if SANITIZER_FREEBSD || SANITIZER_OPENBSD
-  return (uptr)pthread_self();
+#if SANITIZER_FREEBSD || SANITIZER_SOLARIS
+  return (uptr)thr_self();
----------------
devnexen wrote:
> devnexen wrote:
> > krytarowski wrote:
> > > devnexen wrote:
> > > > krytarowski wrote:
> > > > > This is still wrong. thr_self returns 0 on success, -1 on error.
> > > > > 
> > > > > Cast to (uptr) in both cases is wrong.
> > > > > 
> > > > > Also tid_t shall be corrected and marked u64 for everybody.
> > > > On Solaris ? Because on FreeBSD it s thread_t type.
> > > FreeBSD 11.1 notes:
> > > 
> > > ```
> > > SYNOPSIS
> > >      #include <sys/thr.h>
> > > 
> > >      int
> > >      thr_self(long *id);
> > > ```
> > You got a point I looked at the wrong man page :-) 
> > https://www.freebsd.org/cgi/man.cgi?query=thr_self&manpath=SunOS+5.10
> I m less keen for the last bit though since not all oses are into 64 bits types I d say keep upturn for everybody until the fact change.
uptr is wrong for everybody
pthread_t is a pointer on FreeBSD and it was used wrongly as pid_t


https://reviews.llvm.org/D43909





More information about the llvm-commits mailing list