public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* Check for ET_DYN in ldconfig
@ 2003-07-22 11:12 Andreas Jaeger
  2003-07-22 19:44 ` Roland McGrath
  2003-07-22 19:53 ` Ulrich Drepper
  0 siblings, 2 replies; 4+ messages in thread
From: Andreas Jaeger @ 2003-07-22 11:12 UTC (permalink / raw)
  To: GNU libc hackers


Here's another sanity check: We check that a shared library is indeed
a shared object.

Ok to commit?

Andreas

2003-07-22  Andreas Jaeger  <aj@suse.de>

	* elf/readlib.c (process_file): Check that file is a shared
	object.

============================================================
Index: elf/readlib.c
--- elf/readlib.c	5 Sep 2002 18:51:48 -0000	1.13
+++ elf/readlib.c	22 Jul 2003 11:11:42 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 1999 and
 		  Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -157,6 +157,13 @@ process_file (const char *real_file_name
 	  && memmem (file_contents, len, "GNU ld script", 13) == NULL)
 	error (0, 0, _("%s is not an ELF file - it has the wrong magic bytes at the start.\n"),
 	       file_name);
+      ret = 1;
+      goto done;
+    }
+
+  /* Libraries have to be shared object files.  */
+  if (!elf_header->e_type & ET_DYN)
+    {
       ret = 1;
       goto done;
     }

-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

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

* Re: Check for ET_DYN in ldconfig
  2003-07-22 11:12 Check for ET_DYN in ldconfig Andreas Jaeger
@ 2003-07-22 19:44 ` Roland McGrath
  2003-07-22 19:45   ` Andreas Jaeger
  2003-07-22 19:53 ` Ulrich Drepper
  1 sibling, 1 reply; 4+ messages in thread
From: Roland McGrath @ 2003-07-22 19:44 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: GNU libc hackers

> +  /* Libraries have to be shared object files.  */
> +  if (!elf_header->e_type & ET_DYN)

This is plainly nutso.  elf_header->e_type != ET_DYN is the only that makes
sense.

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

* Re: Check for ET_DYN in ldconfig
  2003-07-22 19:44 ` Roland McGrath
@ 2003-07-22 19:45   ` Andreas Jaeger
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Jaeger @ 2003-07-22 19:45 UTC (permalink / raw)
  To: Roland McGrath; +Cc: GNU libc hackers

Roland McGrath <roland@redhat.com> writes:

>> +  /* Libraries have to be shared object files.  */
>> +  if (!elf_header->e_type & ET_DYN)
>
> This is plainly nutso.  elf_header->e_type != ET_DYN is the only that makes
> sense.

Ok with that change, then?

Andreas
-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

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

* Re: Check for ET_DYN in ldconfig
  2003-07-22 11:12 Check for ET_DYN in ldconfig Andreas Jaeger
  2003-07-22 19:44 ` Roland McGrath
@ 2003-07-22 19:53 ` Ulrich Drepper
  1 sibling, 0 replies; 4+ messages in thread
From: Ulrich Drepper @ 2003-07-22 19:53 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: GNU libc hackers

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

Andreas Jaeger wrote:
> Here's another sanity check: We check that a shared library is indeed
> a shared object.
> 
> Ok to commit?

Yes.  But also change the last gotos in an "else if" cascade.

- -- 
- --------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/HZYJ2ijCOnn/RHQRAvkoAKCx270uAS+xftFXDcKI1e/wy5r+mgCfYgo1
HjekqviZ0y5/kIFvZEU79Qs=
=AqgM
-----END PGP SIGNATURE-----

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

end of thread, other threads:[~2003-07-22 19:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-22 11:12 Check for ET_DYN in ldconfig Andreas Jaeger
2003-07-22 19:44 ` Roland McGrath
2003-07-22 19:45   ` Andreas Jaeger
2003-07-22 19:53 ` 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).