From owner-freebsd-current@FreeBSD.ORG Mon Dec 10 18:25:32 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3A7DC391 for ; Mon, 10 Dec 2012 18:25:32 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 9779D8FC0C for ; Mon, 10 Dec 2012 18:25:31 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.5/8.14.5) with ESMTP id qBAIPQVI074316; Mon, 10 Dec 2012 20:25:26 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.1 kib.kiev.ua qBAIPQVI074316 Received: (from kostik@localhost) by tom.home (8.14.5/8.14.5/Submit) id qBAIPQBW074314; Mon, 10 Dec 2012 20:25:26 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 10 Dec 2012 20:25:26 +0200 From: Konstantin Belousov To: Mark Atkinson Subject: Re: problems with threads/destructors in -current with llvm/clang Message-ID: <20121210182525.GR3013@kib.kiev.ua> References: <50C1E81A.1040107@FreeBSD.org> <50C1F862.2010501@FreeBSD.org> <50C22789.3030303@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="QyTKe3xr7+CGa/hc" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: freebsd-current@freebsd.org, kde-freebsd@spider.kde.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Dec 2012 18:25:32 -0000 --QyTKe3xr7+CGa/hc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 10, 2012 at 09:35:29AM -0800, Mark Atkinson wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 >=20 > On 12/07/2012 09:29, Dimitry Andric wrote: > > On 2012-12-07 17:43, Mark Atkinson wrote: > >> On 12/7/2012 6:08 AM, Dimitry Andric wrote: > > ... > >>> With this patch (placed in /usr/ports/devel/dbus-qt4/files), > >>> qdbus starts up and exits normally for me. I did not do any > >>> other rigorous testing, though. :) > >>=20 > >> Thanks for the awesome analysis. I will endeavor to figure out > >> the bug in automoc4 that keeps it segfaulting randomly during > >> compilation. > >>=20 > >> Weirdly it segfaults reliably under portmaster, but may work just > >> fine under just make. > >=20 > > Try running it under valgrind. If it does undefined things, it may > > work or not work randomly, and valgrind usually catches this. >=20 > OK, so this one's a bit of a headscratcher, but maybe someone has some > ideas. automoc4 always dies in libthr. Build rtld, libc and libthr with the debug symbols to get useful backtrace. >=20 > #0 0x2864b1da in swapcontext () from /lib/libthr.so.3 > [New Thread 29003800 (LWP 100960/automoc4.bin)] > [New Thread 29003080 (LWP 101795/automoc4.bin)] > (gdb) bt > #0 0x2864b1da in swapcontext () from /lib/libthr.so.3 > #1 0x2864a046 in pthread_getspecific () from /lib/libthr.so.3 > #2 0x28649e9a in pthread_getspecific () from /lib/libthr.so.3 > #3 0x2864dbfb in pthread_kill () from /lib/libthr.so.3 > #4 0x28064e71 in _rtld_get_stack_prot () from /libexec/ld-elf.so.1 > #5 0x2865d500 in _thread_state_running () from /lib/libthr.so.3 > #6 0x2865d500 in _thread_state_running () from /lib/libthr.so.3 > #7 0x28075e00 in ?? () > #8 0x286b4d30 in pipe () from /lib/libc.so.7 > #9 0x280712ac in ?? () from /libexec/ld-elf.so.1 > #10 0xbf9fce2c in ?? () > #11 0x2805e505 in r_debug_state () from /libexec/ld-elf.so.1 > #12 0x28071f68 in ?? () from /libexec/ld-elf.so.1 > #13 0xbf9fcde0 in ?? () > #14 0xbf9fce18 in ?? () > #15 0x00000001 in ?? () > #16 0x00000000 in ?? () > (gdb) thread 2 > [Switching to thread 2 (Thread 29003080 (LWP 101795/automoc4.bin))]#0 > 0x2876c3a7 in select () from /lib/libc.so.7 > (gdb) bt > #0 0x2876c3a7 in select () from /lib/libc.so.7 > #1 0x286481ab in select () from /lib/libthr.so.3 > #2 0x28365c49 in qt_safe_select (nfds=3D17, fdread=3D0xbfbfa090, > fdwrite=3D0xbfbfa010, fdexcept=3D0x0, orig_timeout=3D0x0) at > kernel/qcore_unix.cpp:83 > #3 0x282c23b2 in select_msecs (nfds=3D17, fdread=3D0xbfbfa090, > fdwrite=3D0xbfbfa010, timeout=3D-1) at io/qprocess_unix.cpp:998 > #4 0x282c33f3 in QProcessPrivate::waitForFinished (this=3D0x29089300, > msecs=3D-1) at io/qprocess_unix.cpp:1219 > #5 0x28240b50 in QProcess::waitForFinished (this=3D0xbfbfa1e8, > msecs=3D-1) at io/qprocess.cpp:1759 > #6 0x0805487b in AutoMoc::echoColor (this=3D0xbfbfab00, > msg=3D@0xbfbfa2e0) at > /usr/ports/devel/automoc4/work/automoc4-0.9.88/kde4automoc.cpp:74 > #7 0x08052650 in AutoMoc::generateMoc (this=3D0xbfbfab00, > sourceFile=3D@0x29011658, mocFileName=3D@0x2901165c) at > /usr/ports/devel/automoc4/work/automoc4-0.9.88/kde4automoc.cpp:569 > #8 0x0804f13b in AutoMoc::run (this=3D0xbfbfab00) at > /usr/ports/devel/automoc4/work/automoc4-0.9.88/kde4automoc.cpp:470 > #9 0x0804aaef in main (argc=3D6, argv=3D0xbfbfab98) at > /usr/ports/devel/automoc4/work/automoc4-0.9.88/kde4automoc.cpp:114 >=20 > I noticed that qt_safe_select() used a register bound variable for the > return value, but removing that didn't alleviate the error. >=20 > The pthread_getspecific() manpage mentions that if the key is deleted > then the behavior is undefined -- so maybe this? It's definitely > seems like a race condition of some kind. >=20 > Valgrind will kill any run of automoc4 and doesn't like some > instruction after the qt_safe_select() call: >=20 > vex x86->IR: unhandled instruction bytes: 0xF 0xB 0x90 0x90 This is ud2, an instruction which generates a fault on purpose. So rebuild the system libraries with the debug symbols and show the backtrace. > =3D=3D33074=3D=3D valgrind: Unrecognised instruction at address 0x380434e= 9. > =3D=3D33074=3D=3D at 0x380434E9: ??? (in > /usr/local/lib/valgrind/memcheck-x86-freebsd) > =3D=3D33074=3D=3D by 0x323C48: qt_safe_select(int, fd_set*, fd_set*, > fd_set*, timeval const*) (qcore_unix.cpp:83) > =3D=3D33074=3D=3D by 0x2803B1: select_msecs(int, fd_set*, fd_set*, int) > (qprocess_unix.cpp:998) > =3D=3D33074=3D=3D by 0x28021D: QProcessPrivate::waitForStarted(int) > (qprocess_unix.cpp:1031) > =3D=3D33074=3D=3D by 0x1FFA02: QProcess::waitForStarted(int) > (qprocess.cpp:1687) > =3D=3D33074=3D=3D by 0x1FEAEA: QProcess::waitForFinished(int) > (qprocess.cpp:1752) > =3D=3D33074=3D=3D by 0x805487A: AutoMoc::echoColor(QString const&) > (kde4automoc.cpp:74) > =3D=3D33074=3D=3D by 0x805264F: AutoMoc::generateMoc(QString const&, > QString const&) (kde4automoc.cpp:569) > =3D=3D33074=3D=3D by 0x804F13A: AutoMoc::run() (kde4automoc.cpp:470) > =3D=3D33074=3D=3D by 0x804AAEE: main (kde4automoc.cpp:114) >=20 > Full valgrind output is at http://pastebin.com/KQTKYGX5 >=20 > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.19 (FreeBSD) > Comment: Using GnuPG with undefined - http://www.enigmail.net/ >=20 > iEYEARECAAYFAlDGHWEACgkQrDN5kXnx8yZEUwCfXhKBqCJKJcfomG6mHo6ataaw > x60An36saeyL2b09CR2Z/zL84KzjPjsQ > =3DEzG3 > -----END PGP SIGNATURE----- >=20 > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" --QyTKe3xr7+CGa/hc Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJQxikVAAoJEJDCuSvBvK1BZOoP+gNRJh613Ei0VSDQX+nTsUsq ffhhxd+tza/f4E6BS/DndbKPi+rTovu+wNShQ0dwlBNX/Ukp+R6pICnO6/UTnd4w 8rD8DH3ZFHW955Kgoz3icor9Y4/0xb5q1P9aLkbnbpOx4KijRbspfkS7c+ygrEyh FIpKX0rZQwGbtFmVq9Qo4R58dB6JXieaRXEhp971TYy0yYYM91kYf7WSr8iaQKdg w07Ep4YKp4C67w3XdQaeaFDxQLySdD2OhMHEG5KiBsybGzztbneQwJ3MsjzYY7K+ 6OAFY7detx6wi4NFG4BHIvvvd5p2+Y1ydNfM4YNZz5YSv7JD8efqFTEBCprUFsks J/Jd7ZOG5tmxgr2qZJxNm4aYj51ljTJrUPT4KpI4+1MEIqEBMu4faxVMuJm7pQ5k M0mYDw7Kap7ss/3uHpQx/dAWw56nwDgV5y4dKBr/oo8SXmvIlkgqz5IbCBi2GdGL 7sKgoimfR4rEeu0p84Ifr4lY4jy/6SxuoG5UUVoJc58jwJhie4Q3RqIWujrG6g1Y 674I7VKlzqSzIxYYTNS72eMEGc2PldeieN6/Futl83VCtKhMEyIaXu13e2bmp/72 BYiGkUCv14T5MZjMMcSDYL5Aaxyk69VAaSEbIQsiB/B1GiHcOfr++T33GXLhRVTS 7znLnSahNhK5bJH96R1I =5Dp2 -----END PGP SIGNATURE----- --QyTKe3xr7+CGa/hc--