Bug 125875

Summary: libSDL.so: Memory exhausted
Product: [Fedora] Fedora Reporter: Ivan Gyurdiev <ivg231>
Component: binutilsAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: athlon   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-06-19 03:26:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ivan Gyurdiev 2004-06-13 02:36:02 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6)
Gecko/20040518 Firefox/0.8

Description of problem:
Hi, I am trying to figure out why I get this error.
It occurs when I link to libSDL.so, or do nm libSDl.so

I am rather low on memory (128MB), but I should have enough, I think.
I don't think I should be getting this error.

I tried to track it down, but I can't follow the binutils codepath -
it gets too complicated.

It runs out of memory when it does: 

bfd_check_format_matches ->
...
temp = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
...
      else if (err != bfd_error_wrong_format)
        {
          abfd->xvec = save_targ;
          abfd->format = bfd_unknown;
                                                                     
                                                       
          if (matching)
            free (matching_vector);
                                                                     
                                                       
          return FALSE;
        }

I also wrote prints at every place where bfd_error_no_memory is set,
and got this:

[root@cobra binutils]# ./nm-new /usr/lib/libSDL-1.2.so.0.7.0
DISPLAY FILE
OMEM6, size requested was: 706742538l
OMEM6, size requested was: 706742538l
NO MEMORY
./nm-new: /usr/lib/libSDL-1.2.so.0.7.0: Memory exhausted
EXIT DISPLAY_FILE
[root@cobra binutils]#

OMEM6 is at bfd/opncls.c:

void *
bfd_alloc (bfd *abfd, bfd_size_type size)
{
  void *ret;
                                                                     
                                                       
  if (size != (unsigned long) size)
    {
      fprintf(stderr, "OMEM5\n");
      bfd_set_error (bfd_error_no_memory);
      return NULL;
    }
                                                                     
                                                       
  ret = objalloc_alloc (abfd->memory, (unsigned long) size);
  if (ret == NULL) {
     fprintf(stderr, "OMEM6, size requested was: %ul\n", size);
    bfd_set_error (bfd_error_no_memory);
     }
  return ret;
}



Version-Release number of selected component (if applicable):
binutils-2.15.90.0.3-7

How reproducible:
Always

Steps to Reproduce:
1. Link/nm against libSDL.so
2.
3.
    

Additional info:

Comment 1 Jakub Jelinek 2004-06-14 15:08:12 UTC
Is that libSDL.so from some rpm or a custom compiled one?

Comment 2 Ivan Gyurdiev 2004-06-14 16:13:28 UTC
It comes with:
SDL-1.2.7-4

I actually re-downloaded and replaced it today, and the problem
persists, so this is not a corrupted filesystem or anything like that.

Comment 3 Ivan Gyurdiev 2004-06-19 02:14:49 UTC
More interesting stuff. 
gcc will not compile even the most trivial code for me anymore:

[root@cobra quota-tools]# gcc prog.c
gcc: Internal error: Segmentation fault (program as)
Please submit a full bug report.
See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.

As segfaults with no args:
[root@cobra quota-tools]# as
Segmentation fault[root@cobra quota-tools]# as --version
GNU assembler 2.15.90.0.3 20040415
Copyright 2002 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
This assembler was configured for a target of `i386-redhat-linux'.

Why?
(gdb) run
Starting program: /usr/bin/as
(no debugging symbols found)...(no debugging symbols found)...(no
debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
0x0043dcd0 in _bfd_new_bfd () from /usr/lib/libbfd-2.15.90.0.3.so
(gdb) info stack
#0  0x0043dcd0 in _bfd_new_bfd () from /usr/lib/libbfd-2.15.90.0.3.so
#1  0x0043e0fc in bfd_openw () from /usr/lib/libbfd-2.15.90.0.3.so
#2  0x08058b62 in ?? ()
#3  0x08072808 in _IO_stdin_used ()
#4  0x080785af in _IO_stdin_used ()
#5  0xfef38da8 in ?? ()
#6  0x0805662b in ?? ()
(gdb) q
The program is running.  Exit anyway? (y or n) y
[root@cobra quota-tools]# rpm -qf /usr/lib/libbfd-2.15.90.0.3.so
 
binutils-2.15.90.0.3-7

Thought this might be related in some way.









Comment 4 Ivan Gyurdiev 2004-06-19 02:54:15 UTC
And nm now crashes on everything:

(gdb) info stack
#0  0x0043de92 in bfd_openr () from /usr/lib/libbfd-2.15.90.0.3.so
#1  0x0804a1c2 in ?? ()
#2  0xfef66be2 in ?? ()







Comment 5 Ivan Gyurdiev 2004-06-19 03:26:12 UTC
Blah Filesystem corruption.
I hate XFS.

Restored binutils rpm, everything works just fine.
I'll reopen if I see anything strange again.

Sorry for wasting your time.