[ntp:hackers] I think we have a memory smashing bug

Hal Murray hmurray at megapathdsl.net
Mon Aug 17 07:39:14 UTC 2015


Any suggestions on how to track this down?


On FreeBSD, I sometimes get a segfault during startup.
  http://bugs.ntp.org/show_bug.cgi?id=2831
That started back in May.  I've got many core dumps.  My attempts to figure 
out what went wrong didn't get anywhere.  They are all crashing in malloc as 
part of DNS lookup.

I have a script that starts ntpd, waits a while, checks for a core dump...
It always works after a few tries.


A few days ago, I tried to add a pool line to a server and got a strange 
error message.

14 Aug 13:58:07 ntpd[12618]: error resolving pool 0.fedora.pool.ntp.org: 
System error (-11)

It tries again in a few minutes and gets the same error. ...

EAI_SYSTEM (System Error) says look in errno.  I added some debugging 
printout.  errno is always EAGAIN.  More printout says it's taking ~15 ms 
which is reasonable for a packet exchange over my DSL line.  I added a loop 
to try  a few times.  It always gets the same error.

I changed the server lines of local systems from names to IP Addresses.  Now 
I get:
  16 Aug 02:37:41 ntpd[21377]: fatal out of memory (32 bytes)
That's from the DNS thread creation code getting ready to look up the pool 
info.

That's on a 64 bit Fedora 22 system.  I got the same sort of thing on another 
Fedora box and a Debian box so I'm pretty sure it isn't a simple flaky 
hardware box.  (But all the problems have been on the same type of hardware, 
so it might be a design bug.  Dell Optiplex FX 160, Intel Atom 330.)

I haven't wrapped my head around the DNS code.  The details all look OK, but 
it's a tangle of Windows/other, fork/thread/pipe, and I just don't really get 
the whole thing yet.

This seems like something that valgrind should catch, but I've never used it 
before.  My beginner attempts haven't produced anything interesting.

Of course, maybe it isn't smashing malloced memory.  Are there debugging 
tools/tricks for threads/semaphores?  Stacks?


-- 
These are my opinions.  I hate spam.





More information about the hackers mailing list