This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug] Between and glibc causes ld to segfault.


Dear Sirs,

As I have said before, if you call ld with excessive -l() arguments you
get the following segfault:
( see http://bugs.gentoo.org/show_bug.cgi?id=16577 for examples, also
works  on redhat beta 8.1 )
#0  new_statement (type=lang_group_statement_enum, size=13, list=0xd)
    at ldlang.c:516
#1  0x080543e6 in lang_enter_group () at ldlang.c:4758
#2  0x08049f34 in yyparse () at ldgram.y:338
#3  0x0805055c in load_symbols (entry=0x0, place=0x0) at ldlang.c:1576
#4  0x08050d2f in open_input_bfds (s=0x0, force=0) at ldlang.c:2043
#5  0x08053b00 in lang_process () at ldlang.c:4277
#6  0x080567e5 in main (argc=0, argv=0x0) at ldmain.c:438
#7  0x4003c747 in __libc_start_main () from /lib/libc.so.6

The cause is in the following function:

static lang_statement_union_type *
new_statement (type, size, list)
     enum statement_enum type;
     size_t size;
     lang_statement_list_type *list;
{
  lang_statement_union_type *new = (lang_statement_union_type *)
  stat_alloc (size);

  new->header.type = type;
  new->header.next = (lang_statement_union_type *) NULL;
  lang_statement_append (list, new, &new->header.next);
  return new;
}
 in ld/lang.c


The function "stat_alloc" returns 0x07 which is wrong and causes the
segfault.
stat_alloc allocates memory off the stack, as far as I can understand. See
obstack.h, in both binutils and glibc. I have tried updating the the one
in binutils with the one from glibc. It does not fix it *for me*.
The problem appeared between glibc-2.3.1 and glibc-2.3.2. I did a binary
search though the glibc CVS. I have so far narrowed down the interval;
[Tue Dec 31 06:49:17 2002,Tue Dec 31 08:29:10 2002]

I have only searched linuxthreads, nptl is also affected, but is not on CVS.

The only valid error causing patch I can see in that lot is the new stack
stuff in glibc linuxthreads.
Can someone please reply, I am happy to supply any additional info needed,

Stefan



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]