bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dynamic Linking Corruption Bug (pthread/glibc??) in RH9 (VERY small test


From: Russell Leighton
Subject: Dynamic Linking Corruption Bug (pthread/glibc??) in RH9 (VERY small test program attached)
Date: Thu, 13 Nov 2003 15:19:01 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4a) Gecko/20030401


This is a followup to my previous bug report, this time with a VERY short program that is self contained (not dependent on outside code).

Simply put, this program dynamically links a libray with 1 function that opens and closes a file. It runs that function 10 times.

This program runs w/out errors on rh8, and rh7.3 BUT on rh9 corrupts memory IF using dynamic linking.
Details:
   rh9
   gcc 3.2.2 (Red Hat Linux 3.2.2-5)
   glibc-common-2.3.2-27.9
   glibc-2.3.2-27.9

To run, copy the 3 attached files to a dir, and type 'make'.

Here's what I see on rh9 (all the latest patches applied):

cc    -c -o rrd_create.o rrd_create.c
ld -shared -soname=librrd.so  -o ./librrd.so *.o
gcc -O2 -g debugtest.c -o debugtest -L./ -lrrd
debugtest.c: In function `main':
debugtest.c:6: warning: return type of `main' is not `int'
Running using MALLOC_CHECK_=1
( export MALLOC_CHECK_=1; ./debugtest ; )
malloc: using debugging hooks
free(): invalid pointer 0x80495c0!
free(): invalid pointer 0x8049628!
free(): invalid pointer 0x8049690!
free(): invalid pointer 0x80496f8!
free(): invalid pointer 0x8049760!
free(): invalid pointer 0x80497c8!
free(): invalid pointer 0x8049830!
free(): invalid pointer 0x8049898!
free(): invalid pointer 0x8049900!
free(): invalid pointer 0x8049968!

Can anyone suggest a work around?

Thx

Russ


#include <stdio.h>
#include <stdlib.h>

int rrd_create(void) 
{
    FILE             *rrd_file;

    if ((rrd_file = fopen("foo","wb")) == NULL ) {
      perror("foo");
      return -1;
    }

    fclose(rrd_file);    
    return (0);
}
all: debugtest malloc_check 

malloc_check:
        @echo 'Running using MALLOC_CHECK_=1'
        ( export MALLOC_CHECK_=1; ./debugtest ; )

debugtest: debugtest.c librrd.so
        gcc -O2 -g debugtest.c -o debugtest -L./ -lrrd 

librrd.so: rrd_create.o
        ld -shared -soname=librrd.so  -o ./librrd.so *.o

clean:
        rm -f debugtest *.o *.so *~ foo
#include <stdio.h>

int rrd_create(void);

void main()
{
  int
    counter=10;

  while (counter--)
    rrd_create();
}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]