Re: emacs aborting on exit with recent lib/libc/stdlib/atexit.c changes

From: Fabian Keil <freebsd-listen_at_fabiankeil.de>
Date: Fri, 27 Aug 2010 21:46:35 +0200
Kostik Belousov <kostikbel_at_gmail.com> wrote:

> On Fri, Aug 27, 2010 at 09:25:34PM +0200, Fabian Keil wrote:
> > Kostik Belousov <kostikbel_at_gmail.com> wrote:
> > 
> > > On Fri, Aug 27, 2010 at 06:21:08PM +0200, Fabian Keil wrote:
> > > > The recent lib/libc/stdlib/atexit.c changes broke emacs (23.2_2,2) for
> > > > me. It aborts on exit (C-x C-c) after receiving SIGBUS:

> > > > Reverting to lib/libc/stdlib/atexit.c 1.9 gets it working again,
> > > > using 1.11 brings back the crashes. I didn't csup between those
> > > > versions and thus don't have 1.10 in git, but given that it's a
> > > > style change it shouldn't matter.
> > > > 
> > > > I'm using amd64 and so far I only noticed the problem with emacs.
> > > > 
> > > > Is anyone else seeing this?
> > > Reverting the atexit change might cover the issue in some other place.
> > > Please build and install rtld, libc and libthr with symbolic
> > > debug information. On of the way to do this is to:
> > > cd /usr/src/libexec/rtld-elf
> > > make obj && make depend && make all install DEBUG_FLAGS=-g
> > > cd ../../lib/libc
> > > make obj && make depend && make all install DEBUG_FLAGS=-g
> > > cd ../../lib/libthr
> > > make obj && make depend && make all install DEBUG_FLAGS=-g
> > > 
> > > Then, reproduce the crash and get "bt full" output from the
> > > core. I may need some further information after that.
> > 
> > #0  0x00000008045dd44c in kill () at kill.S:3
> > 3       RSYSCALL(kill)
> > [New Thread 1260600 (LWP 100244)]
> > (gdb) bt full
> > #0  0x00000008045dd44c in kill () at kill.S:3
> > No locals.
> > #1  0x00000000005545c0 in fatal_error_signal (sig=10) at emacs.c:402
> > No locals.
> > #2  <signal handler called>
> > No symbol table info available.
> > #3  __elf_phdr_match_addr (phdr_info=0x7fffffffcf90, addr=0x69ba20) at /usr/src/lib/libc/gen/elf_utils.c:39
> >         i = 109
> > #4  0x0000000803038fdb in __pthread_cxa_finalize (phdr_info=0x7fffffffcf90) at /usr/src/lib/libthr/thread/thr_fork.c:109
> >         af = (struct pthread_atfork *) 0xe1e7c0
> >         af1 = (struct pthread_atfork *) 0x0
> > #5  0x00000008045be0a7 in __cxa_finalize (dso=0x0) at /usr/src/lib/libc/stdlib/atexit.c:204
> >         phdr_info = {dlpi_addr = 0, dlpi_name = 0x7fffffffd080 "`????\177", dlpi_phdr = 0x7fffffffe848, dlpi_phnum = 59448, dlpi_adds = 0, dlpi_subs = 34367899629, 
> >   dlpi_tls_modid = 15046784, dlpi_tls_data = 0x12c2538}
> >         p = (struct atexit *) 0x0
> >         fn = {fn_type = 1, fn_ptr = {std_func = 0x8007ccff0 <rtld_exit>, cxa_func = 0x8007ccff0 <rtld_exit>}, fn_arg = 0x0, fn_dso = 0x0}
> >         n = -1
> >         has_phdr = 0
> > #6  0x00000008045683c7 in exit (status=0) at /usr/src/lib/libc/stdlib/exit.c:67
> > No locals.
> > #7  0x0000000000556817 in Fkill_emacs (arg=Could not find the frame base for "Fkill_emacs".
> > ) at emacs.c:2146
> >         gcpro1 = Could not find the frame base for "Fkill_emacs".
> > Current language:  auto; currently asm
 
> Ewww. Please try this.
> 
> diff --git a/lib/libc/stdlib/atexit.c b/lib/libc/stdlib/atexit.c
> index 97cf234..511172a 100644
> --- a/lib/libc/stdlib/atexit.c
> +++ b/lib/libc/stdlib/atexit.c
> _at__at_ -200,6 +200,6 _at__at_ __cxa_finalize(void *dso)
>  	if (dso == NULL)
>  		_MUTEX_DESTROY(&atexit_mutex);
>  
> -	if (&__pthread_cxa_finalize != NULL)
> +	if (has_phdr && &__pthread_cxa_finalize != NULL)
>  		__pthread_cxa_finalize(&phdr_info);
>  }

That fixed it. Thanks a lot.

Fabian

Received on Fri Aug 27 2010 - 17:47:32 UTC

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