Comment 15 for bug 13460

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-Id: <email address hidden>
Date: Tue, 8 Mar 2005 00:26:43 +0100
From: wim delvaux <email address hidden>
To: Justin Pryzby <email address hidden>,
 <email address hidden>
Subject: Re: Bug#297798: valgrind test case

On Monday 07 March 2005 18:15, Justin Pryzby wrote:
> Have you tried to construct a minimal test case?
>
> I tried to reproduce the problem with a trivial program, included.
> Let me know if I'm missing something already known.
>
> Thanks,
> Justin
>
> References
>
> [0] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=297798

It seems the problem only occurs when the library has a missing symbol and not
when it is not found.

I have changed the vg.c as such ...

#include <dlfcn.h>
#include <stdio.h>

print(char *s)
{
 fprintf(stderr, "%s\n", s);
}

int main()
{
 void*v=dlopen("xyz.so", RTLD_NOW);
 printf("%s\n", dlerror());

 //void *dlsym(void *handle, const char *symbol);
 //int dlclose(void *handle);

 return 0;
}

where xyz.so is an existing library with a missing symbol

I tried with one of my own libs (which I molested a bit) and got the following
valgrind error

u19809@buro:.../tmp$ val ./vg
==19655== Memcheck, a memory error detector for x86-linux.
==19655== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward et al.
==19655== Using valgrind-2.2.0, a program supervision framework for x86-linux.
==19655== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward et al.
==19655== For more details, rerun with: -v
==19655==
==19655== Invalid read of size 1
==19655== at 0x1B90C2E7: dlerror (dlerror.c:78)
==19655== by 0x80484E3: main (in /tmp/vg)
==19655== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==19655==
==19655== ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ---- qc
==19655==
==19655== Process terminating with default action of signal 11 (SIGSEGV)
==19655== Access not within mapped region at address 0x0
==19655== at 0x1B90C2E7: dlerror (dlerror.c:78)
==19655== by 0x80484E3: main (in /tmp/vg)
==19655==
==19655== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 23 from 1)
==19655== malloc/free: in use at exit: 964 bytes in 5 blocks.
==19655== malloc/free: 17 allocs, 12 frees, 3374 bytes allocated.
==19655== For a detailed leak analysis, rerun with: --leak-check=yes
==19655== For counts of detected errors, rerun with: -v

running without val yields ... (long path is what I used for xxx.so ... don't
let the pex extension fool you)

u19809@buro:.../tmp$ ./vg
/mnt/buro/fs.permanent/home/u19809/projects/AP/MSP/Server/parcels/MSPApplication.par/i686_Linux__Gnu.arch/debugthreaded_gcc3/MSPApplication_TS.pex:
undefined symbol: AC_d_sprintf