Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Mar 2012 22:07:49 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Lars Engels <lars.engels@0x20.net>
Cc:        Alex Keda <admin@lissyara.su>, freebsd-current@freebsd.org, alc@freebsd.org
Subject:   Re: -CURRENT is broken?
Message-ID:  <20120305200749.GW75778@deviant.kiev.zoral.com.ua>
In-Reply-To: <20120305195310.GO23354@e-new.0x20.net>
References:  <4F54DE25.7050200@lissyara.su> <4F54DEAC.3040200@lissyara.su> <20120305181025.GJ23354@e-new.0x20.net> <CAETOPp1Xnby0UsJSxfYHmQ5z7nV8-18AeGT3D76dooX8PkY_Tg@mail.gmail.com> <20120305191211.GT75778@deviant.kiev.zoral.com.ua> <20120305191622.GM23354@e-new.0x20.net> <20120305192749.GU75778@deviant.kiev.zoral.com.ua> <20120305194315.GN23354@e-new.0x20.net> <20120305195119.GV75778@deviant.kiev.zoral.com.ua> <20120305195310.GO23354@e-new.0x20.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--jdAw5H+0hw/nhz1g
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Mar 05, 2012 at 08:53:10PM +0100, Lars Engels wrote:
> On Mon, Mar 05, 2012 at 09:51:19PM +0200, Konstantin Belousov wrote:
> > On Mon, Mar 05, 2012 at 08:43:15PM +0100, Lars Engels wrote:
> > > On Mon, Mar 05, 2012 at 09:27:49PM +0200, Konstantin Belousov wrote:
> > > > On Mon, Mar 05, 2012 at 08:16:22PM +0100, Lars Engels wrote:
> > > > > On Mon, Mar 05, 2012 at 09:12:11PM +0200, Konstantin Belousov wro=
te:
> > > > > > On Mon, Mar 05, 2012 at 10:41:01AM -0800, Jos Backus wrote:
> > > > > > > On Mon, Mar 5, 2012 at 10:10 AM, Lars Engels <lars.engels@0x2=
0.net> wrote:
> > > > > > > > On Mon, Mar 05, 2012 at 07:41:32PM +0400, Alex Keda wrote:
> > > > > > > >> On 05.03.2012 19:39, Alex Keda wrote:
> > > > > > > >> > I have 2 machine, i386 and amd64
> > > > > > > >> > world rebuild tonight all work. all applications crash w=
ith core dump...
> > > > > > > >> read as "world rebuild tonight not work" =3D))
> > > > > > >=20
> > > > > > > I noticed the same thing. My `make world' dies right after in=
stalling
> > > > > > > the new runtime linker. I was able to recover by copying
> > > > > > > ld-elf.so.1.old using /rescue/{chflags,cp}. Oddly enough, whe=
n I
> > > > > > > manually build and install the runtime linker, it works. Mayb=
e that's
> > > > > > > a clue as to what's wrong.
> > > > > >=20
> > > > > > I just did full buildworld on pristine sources at r232541 and a=
md64 machine
> > > > > > booted fine.
> > > > > >=20
> > > > > > Can somebody put the faulting ld-elf.so.1 somewhere so I can do=
wnload it ?
> > > > >=20
> > > > > http://bsd-geek.de/FreeBSD/ld-elf.so.1
> > > >=20
> > > > It works for me :(.
> > > >=20
> > > > Since your rtld is not stripped, try to link any binary using this =
interpreter,
> > > > i.e. supply -Wl,-I,<path to your bad ld-elf.so.1> to cc link comman=
d.
> > > > Then run the program, get core dump, load it into gdb and do "bt al=
l".
> > >=20
> > > "bt all" gives "No symbol table is loaded.  Use the "file" command."
> > >=20
> > > But just "bt" gives:
> > >=20
> > > http://bsdpaste.bsdgroup.de/130927
> > Hm, so do you have libmap.conf ?
> >=20
> > Yeah, it faults immediately.
> > I suspect I know what is going on.
> >=20
> Yes, I have this in libmap.conf:
> libpcre.so.0 libpcre.so.1
>=20

The following change fixes ld-elf.so.1 with the present libmap.conf for me.

diff --git a/libexec/rtld-elf/libmap.c b/libexec/rtld-elf/libmap.c
index 773456b..cc4fd2b 100644
--- a/libexec/rtld-elf/libmap.c
+++ b/libexec/rtld-elf/libmap.c
@@ -3,7 +3,6 @@
  */
=20
 #include <stdio.h>
-#include <ctype.h>
 #include <string.h>
 #include <stdlib.h>
 #include <sys/queue.h>
@@ -53,6 +52,12 @@ static int	closestrfn	(void * cookie);
 #define	iseol(c)	(((c) =3D=3D '#') || ((c) =3D=3D '\0') || \
 			 ((c) =3D=3D '\n') || ((c) =3D=3D '\r'))
=20
+/*
+ * Do not use ctype.h macros, which rely on the working tls.  It is
+ * too early to have thread-local variables operatable.
+ */
+#define	isspace1(c)	((c) =3D=3D ' ' || (c) =3D=3D '\t')
+
 int
 lm_init (char *libmap_override)
 {
@@ -107,7 +112,7 @@ lmc_parse (FILE *fp)
 		t =3D f =3D c =3D NULL;
=20
 		/* Skip over leading space */
-		while (isspace(*cp)) cp++;
+		while (isspace1(*cp)) cp++;
=20
 		/* Found a comment or EOL */
 		if (iseol(*cp)) continue;
@@ -117,7 +122,7 @@ lmc_parse (FILE *fp)
 			cp++;
=20
 			/* Skip leading space */
-			while (isspace(*cp)) cp++;
+			while (isspace1(*cp)) cp++;
=20
 			/* Found comment, EOL or end of selector */
 			if  (iseol(*cp) || *cp =3D=3D ']')
@@ -125,11 +130,11 @@ lmc_parse (FILE *fp)
=20
 			c =3D cp++;
 			/* Skip to end of word */
-			while (!isspace(*cp) && !iseol(*cp) && *cp !=3D ']')
+			while (!isspace1(*cp) && !iseol(*cp) && *cp !=3D ']')
 				cp++;
=20
 			/* Skip and zero out trailing space */
-			while (isspace(*cp)) *cp++ =3D '\0';
+			while (isspace1(*cp)) *cp++ =3D '\0';
=20
 			/* Check if there is a closing brace */
 			if (*cp !=3D ']') continue;
@@ -141,7 +146,7 @@ lmc_parse (FILE *fp)
 			 * There should be nothing except whitespace or comment
 			  from this point to the end of the line.
 			 */
-			while(isspace(*cp)) cp++;
+			while(isspace1(*cp)) cp++;
 			if (!iseol(*cp)) continue;
=20
 			strcpy(prog, c);
@@ -151,20 +156,20 @@ lmc_parse (FILE *fp)
=20
 		/* Parse the 'from' candidate. */
 		f =3D cp++;
-		while (!isspace(*cp) && !iseol(*cp)) cp++;
+		while (!isspace1(*cp) && !iseol(*cp)) cp++;
=20
 		/* Skip and zero out the trailing whitespace */
-		while (isspace(*cp)) *cp++ =3D '\0';
+		while (isspace1(*cp)) *cp++ =3D '\0';
=20
 		/* Found a comment or EOL */
 		if (iseol(*cp)) continue;
=20
 		/* Parse 'to' mapping */
 		t =3D cp++;
-		while (!isspace(*cp) && !iseol(*cp)) cp++;
+		while (!isspace1(*cp) && !iseol(*cp)) cp++;
=20
 		/* Skip and zero out the trailing whitespace */
-		while (isspace(*cp)) *cp++ =3D '\0';
+		while (isspace1(*cp)) *cp++ =3D '\0';
=20
 		/* Should be no extra tokens at this point */
 		if (!iseol(*cp)) continue;

--jdAw5H+0hw/nhz1g
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (FreeBSD)

iEYEARECAAYFAk9VHRUACgkQC3+MBN1Mb4gjcACePbI3FQ9Ig4SE5BJBMFi7RbQV
YSEAnAwpj3GzLYQHE/SinMl0SshhSRt4
=U3iP
-----END PGP SIGNATURE-----

--jdAw5H+0hw/nhz1g--



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