Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 07 Jun 2019 23:09:32 +0000
From:      bugzilla-noreply@freebsd.org
To:        toolchain@FreeBSD.org
Subject:   [Bug 238404] AddressSanitizer should intercept pthread_get_name_np (FreeBSD), not pthread_getname_np (Glibc) symbol
Message-ID:  <bug-238404-29464@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D238404

            Bug ID: 238404
           Summary: AddressSanitizer should intercept pthread_get_name_np
                    (FreeBSD), not pthread_getname_np (Glibc) symbol
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: toolchain@FreeBSD.org
          Reporter: jbeich@FreeBSD.org

AC_CHECK_FUNCS() doesn't check declaration, only library symbol. For one,
FreeBSD never had pthread_getname_np() but added a similar function in base
r337983.
See contrib/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.=
inc

$ cat >a.c
char pthread_getname_np();

int main()
{
        pthread_getname_np();
        return 0;
}

$ cc a.c -fsanitize=3Daddress
$ cc a.c
ld: error: undefined symbol: pthread_getname_np
>>> referenced by a.c
>>>               /tmp/a-101e7b.o:(main)
cc: error: linker command failed with exit code 1 (use -v to see invocation)


$ pkg install python27
$ hash git 2>/dev/null || pkg install mercurial
$ hg clone https://hg.mozilla.org/mozilla-unified firefox ||
  git clone https://github.com/mozilla/gecko-dev firefox
$ cd firefox
$ hg update central || git checkout origin/master
$ echo "ac_add_options --with-libclang-path=3D${LOCALBASE-/usr/local}/llvm8=
0/lib"
>>.mozconfig
$ echo "ac_add_options --enable-address-sanitizer" >>.mozconfig
$ ./mach bootstrap # select Firefox for Desktop
$ ./mach build
[...]
In file included from objdir/js/src/Unified_cpp_js_src9.cpp:29:
js/src/threading/posix/Thread.cpp:174:8: error: use of undeclared identifier
'pthread_getname_np'; did you mean 'pthread_get_name_np'?
  rv =3D pthread_getname_np(pthread_self(), nameBuffer, len);
       ^~~~~~~~~~~~~~~~~~
       pthread_get_name_np
/usr/include/pthread_np.h:52:6: note: 'pthread_get_name_np' declared here
void pthread_get_name_np(pthread_t, char *, size_t);
     ^
In file included from objdir/js/src/Unified_cpp_js_src9.cpp:29:
js/src/threading/posix/Thread.cpp:174:8: error: assigning to 'int' from
incompatible type 'void'
  rv =3D pthread_getname_np(pthread_self(), nameBuffer, len);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-238404-29464>