Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Aug 2010 21:46:35 +0200
From:      Fabian Keil <freebsd-listen@fabiankeil.de>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: emacs aborting on exit with recent lib/libc/stdlib/atexit.c changes
Message-ID:  <20100827214635.40471d37@r500.local>
In-Reply-To: <20100827193720.GB2396@deviant.kiev.zoral.com.ua>
References:  <20100827182108.12764ff4@r500.local> <20100827190407.GA2396@deviant.kiev.zoral.com.ua> <20100827212534.5960efdf@r500.local> <20100827193720.GB2396@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
--Sig_/sZIOLvqIw__qVj8hA1SWr9S
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Kostik Belousov <kostikbel@gmail.com> wrote:

> On Fri, Aug 27, 2010 at 09:25:34PM +0200, Fabian Keil wrote:
> > Kostik Belousov <kostikbel@gmail.com> wrote:
> >=20
> > > 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.
> > > >=20
> > > > I'm using amd64 and so far I only noticed the problem with emacs.
> > > >=20
> > > > 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=3D-g
> > > cd ../../lib/libc
> > > make obj && make depend && make all install DEBUG_FLAGS=3D-g
> > > cd ../../lib/libthr
> > > make obj && make depend && make all install DEBUG_FLAGS=3D-g
> > >=20
> > > Then, reproduce the crash and get "bt full" output from the
> > > core. I may need some further information after that.
> >=20
> > #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=3D10) at emacs.c:402
> > No locals.
> > #2  <signal handler called>
> > No symbol table info available.
> > #3  __elf_phdr_match_addr (phdr_info=3D0x7fffffffcf90, addr=3D0x69ba20)=
 at /usr/src/lib/libc/gen/elf_utils.c:39
> >         i =3D 109
> > #4  0x0000000803038fdb in __pthread_cxa_finalize (phdr_info=3D0x7ffffff=
fcf90) at /usr/src/lib/libthr/thread/thr_fork.c:109
> >         af =3D (struct pthread_atfork *) 0xe1e7c0
> >         af1 =3D (struct pthread_atfork *) 0x0
> > #5  0x00000008045be0a7 in __cxa_finalize (dso=3D0x0) at /usr/src/lib/li=
bc/stdlib/atexit.c:204
> >         phdr_info =3D {dlpi_addr =3D 0, dlpi_name =3D 0x7fffffffd080 "`=
????\177", dlpi_phdr =3D 0x7fffffffe848, dlpi_phnum =3D 59448, dlpi_adds =
=3D 0, dlpi_subs =3D 34367899629,=20
> >   dlpi_tls_modid =3D 15046784, dlpi_tls_data =3D 0x12c2538}
> >         p =3D (struct atexit *) 0x0
> >         fn =3D {fn_type =3D 1, fn_ptr =3D {std_func =3D 0x8007ccff0 <rt=
ld_exit>, cxa_func =3D 0x8007ccff0 <rtld_exit>}, fn_arg =3D 0x0, fn_dso =3D=
 0x0}
> >         n =3D -1
> >         has_phdr =3D 0
> > #6  0x00000008045683c7 in exit (status=3D0) at /usr/src/lib/libc/stdlib=
/exit.c:67
> > No locals.
> > #7  0x0000000000556817 in Fkill_emacs (arg=3DCould not find the frame b=
ase for "Fkill_emacs".
> > ) at emacs.c:2146
> >         gcpro1 =3D Could not find the frame base for "Fkill_emacs".
> > Current language:  auto; currently asm
=20
> Ewww. Please try this.
>=20
> 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
> @@ -200,6 +200,6 @@ __cxa_finalize(void *dso)
>  	if (dso =3D=3D NULL)
>  		_MUTEX_DESTROY(&atexit_mutex);
> =20
> -	if (&__pthread_cxa_finalize !=3D NULL)
> +	if (has_phdr && &__pthread_cxa_finalize !=3D NULL)
>  		__pthread_cxa_finalize(&phdr_info);
>  }

That fixed it. Thanks a lot.

Fabian

--Sig_/sZIOLvqIw__qVj8hA1SWr9S
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)

iEYEARECAAYFAkx4Fh8ACgkQBYqIVf93VJ0hZQCgwr9nDDhmhXx/rW/i+wf93hbL
PWUAoMmeu0Q9n4HEO7GNkBrNbRZUpcUe
=YJGB
-----END PGP SIGNATURE-----

--Sig_/sZIOLvqIw__qVj8hA1SWr9S--



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