pcp
[Top] [All Lists]

Re: pmhostname failing - urgent

To: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Subject: Re: pmhostname failing - urgent
From: "Frank Ch. Eigler" <fche@xxxxxxxxxx>
Date: Sun, 17 Nov 2013 07:31:29 -0500
Cc: pcp@xxxxxxxxxxx
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <52887E9F.9010403@xxxxxxxxxxxxxxxx>
References: <000201cee1ed$6a1171f0$3e3455d0$@internode.on.net> <y0m7gc91x0f.fsf@xxxxxxxx> <5286702D.1000101@xxxxxxxxxxxxxxxx> <20131115193341.GD8993@xxxxxxxxxx> <5286804D.5010107@xxxxxxxxxxxxxxxx> <20131115203919.GE8993@xxxxxxxxxx> <52868ED9.90209@xxxxxxxxxxxxxxxx> <20131115230044.GF8993@xxxxxxxxxx> <52887E9F.9010403@xxxxxxxxxxxxxxxx>
User-agent: Mutt/1.4.2.2i
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

<Prev in Thread] Current Thread [Next in Thread>