Hi -
> OK, it gets worse ... using the top of tree source, I remade PCP
> 3.8.9 rpms and pmlogger dies with a SEGV thusly ...
Yes, that's not good.
> Program received signal SIGSEGV, Segmentation fault.
> 0x00007ffff762874c in free () from /lib64/libc.so.6
> (gdb) where
> #0 0x00007ffff762874c in free () from /lib64/libc.so.6
> #1 0x00007ffff7bac455 in __pmHostEntFree (hostent=0x7ffff82752a0)
> at secureconnect.c:35
> [...]
> (gdb) p *hostent
> $1 = {name = 0x7ffff7bb4279 "Unknown Host", addresses = 0x7ffff8277b70}
> (gdb)
That 0x...7ffff address indicates that the "Unknown Host" string is
not coming from the heap, but from the executable's text/data section.
That makes no sense, looking at even 3.8.0..HEAD code, as
src/libpcp/src/auxconnect.c says:
char *
__pmHostEntGetName(__pmHostEnt *he)
{
if ... {
if (he->name == NULL)
he->name = "Unknown Host";
}
return strdup(he->name);
}
That is, it should only ever return heap pointers. Could you by any
chance break at __pmHostEntGetName and step through what it's doing
for you?
Actually that "Unknown Host" is not an appropriate response anyway,
when that function can already return NULL due to -ENOMEM, so it
should just return NULL for all errors instead of hard-coding English
error sentinels. For that, and for embodying the bad DNS assumptions,
it should be deprecated.
> I've commented out both free's in __pmHostEntFree() and pmlogger is
> now at least running, but with a possible memory leak for others.
Please cherry-pick 84db849a07f962c7a0e02058a3068cefff33cc8d from
pcpfans.git fche/dev and try again.
- FChE
|