public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix GL(dl_nns) updating in statically linked programs
@ 2009-04-16 10:36 Jakub Jelinek
  2009-04-16 15:20 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2009-04-16 10:36 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

Hi!

LC_ALL=ja_JP.UTF-8 ldconfig --help
just hangs,
LC_ALL=ja_JP ldconfig --help
prints:
ldconfig: dl-load.c:1962: _dl_map_object: Assertion `nsid < _dl_nns' �����Ԥ��ޤ���.
Aborted

The problem is the same, since the introduction of GL(dl_nns), if _dl_open
is called with __LM_ID_CALLER, but there are no shared libraries loaded at
all yet (GL(dl_nns) == 0, GL(dl_ns)[LM_ID_BASE]._ns_loaded == NULL), then
dl_open_worker sets args->nsid to LM_ID_BASE:
#ifndef SHARED
          /* In statically linked apps there might be no loaded object.  */
          if (call_map == NULL)
            args->nsid = LM_ID_BASE;
          else
#endif
but unlike calling _dl_open with LM_ID_BASE right away, GL(dl_nns) isn't set
to 1 and so dl-load.c assertion fails.

Fixed thusly, ok to commit?

2009-04-16  Jakub Jelinek  <jakub@redhat.com>

	* elf/dl-open.c (_dl_open): Bump GL(dl_nns) to 1 if no libraries
	are dlopened in statically linked program even for __LM_ID_CALLER.

--- libc/elf/dl-open.c.jj	2009-04-07 07:56:51.000000000 +0200
+++ libc/elf/dl-open.c	2009-04-16 12:25:16.000000000 +0200
@@ -580,7 +580,8 @@ no more namespaces available for dlmopen
     _dl_signal_error (EINVAL, file, NULL,
 		      N_("invalid target namespace in dlmopen()"));
 #ifndef SHARED
-  else if (nsid == LM_ID_BASE && GL(dl_ns)[LM_ID_BASE]._ns_loaded == NULL
+  else if ((nsid == LM_ID_BASE || nsid == __LM_ID_CALLER)
+	   && GL(dl_ns)[LM_ID_BASE]._ns_loaded == NULL
 	   && GL(dl_nns) == 0)
     GL(dl_nns) = 1;
 #endif


	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix GL(dl_nns) updating in statically linked programs
  2009-04-16 10:36 [PATCH] Fix GL(dl_nns) updating in statically linked programs Jakub Jelinek
@ 2009-04-16 15:20 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2009-04-16 15:20 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Glibc hackers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jakub Jelinek wrote:
> Fixed thusly, ok to commit?

Yes.

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAknnTI8ACgkQ2ijCOnn/RHT+0ACgrr8bLoAXLshNlh3N4vpag4Y+
fJIAniYYKbPJZpBExlV+q8OlNpAq/s3k
=yVYA
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-04-16 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-16 10:36 [PATCH] Fix GL(dl_nns) updating in statically linked programs Jakub Jelinek
2009-04-16 15:20 ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).