Re: problems with threads/destructors in -current with llvm/clang

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Mon, 10 Dec 2012 23:23:35 +0200
On Mon, Dec 10, 2012 at 01:13:23PM -0800, Mark Atkinson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 12/10/2012 12:45, Mark Atkinson wrote:
> > On 12/10/2012 12:33, Konstantin Belousov wrote:
> > 
> >> Hmm.  Since I took out -O2 and added -g in rebuilding 
> >> libthr/libc/rtld, I figured I needed to reproduce a new
> >> segfault, but the rtld side of things seems broken:
> >>> Use e.g. cd src/libexec/rtld-elf && make DEBUG_FLAGS=-g clean
> >>> all install This is really FAQ.
> > 
> > 
> > It _is_ strange, because I did almost exactly that (dumped a
> > temporary DEBUG_FLAGS/CFLAGS in /etc/make.conf)
> > 
> > The one I had problems with was libc since It needs a make depend
> > in there.
> > 
> > $ readelf -w /libexec/ld-elf.so.1 |head The section .debug_aranges
> > contains:
> > 
> > Length:                   28 Version:                  2 Offset
> > into .debug_info:  0 Pointer Size:             4 Segment Size:
> > 0
> > 
> > Address    Length 0x00000e80 0x49 $
> 
> So ignoring this weirdness, running under valgrind always segfaults
> and the core seems useful.
> 
> #0  0x0061bd59 in handle_signal (actp=0xbf9fd490, sig=20,
> info=0xbf9fd7b0, ucp=0x0) at /usr/src/lib/libthr/thread/thr_sig.c:198
> #1  0x0061b71c in thr_sighandler (sig=20, info=0xbf9fd7b0, _ucp=0x0)
> at /usr/src/lib/libthr/thread/thr_sig.c:182
> #2  0x380434dc in ?? ()
> #3  0x00000014 in ?? ()
> #4  0xbf9fd7b0 in ?? ()
> #5  0x00000000 in ?? ()
> (gdb) frame 0
> #0  0x0061bd59 in handle_signal (actp=0xbf9fd490, sig=20,
> info=0xbf9fd7b0, ucp=0x0) at /usr/src/lib/libthr/thread/thr_sig.c:198
> 198             SIGSETOR(actp->sa_mask, ucp->uc_sigmask);
> (gdb) list
> 193             int cancel_enable;
> 194             int in_sigsuspend;
> 195             int err;
> 196
> 197             /* add previous level mask */
> 198             SIGSETOR(actp->sa_mask, ucp->uc_sigmask);
> 199
> 200             /* add this signal's mask */
> 201             if (!(actp->sa_flags & SA_NODEFER))
> 202                     SIGADDSET(actp->sa_mask, sig);
> 
> (gdb) p actp
> $1 = (struct sigaction *) 0xbf9fd490
> (gdb) p *actp
> $2 = {__sigaction_u = {__sa_handler = 0x288310
> <qt_sa_sigchld_handler(int)>, __sa_sigaction = 0x288310
> <qt_sa_sigchld_handler(int)>}, sa_flags = 8, sa_mask = {__bits = {0,
> 0, 0, 0}}}
> (gdb) p *ucp
> Cannot access memory at address 0x0
This looks like a valgrind problem, because kernel correctly passes
fourth argument to the signal handler frame. Or rather, the signal
trampoline and kernel properly pass ucontext to signal handler.

If this appear to be broken, the signal trampoline would cause
the fault on the signal return, even for the single-threaded processes.

> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.19 (FreeBSD)
> Comment: Using GnuPG with undefined - http://www.enigmail.net/
> 
> iEYEARECAAYFAlDGUHMACgkQrDN5kXnx8yYBDACfaBBZyDZnQhbxxjw46csLbg7z
> X7UAn1ea4LbW8PHXL07BwraiVXakh1bU
> =GktK
> -----END PGP SIGNATURE-----
> 
> _______________________________________________
> freebsd-current_at_freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"

Received on Mon Dec 10 2012 - 20:23:44 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:33 UTC