ntpd fails on mlockall()
I built a package of ntp, and it installed ok, but when ntpd goes to launch, I get the following in daemon.log:
Oct 9 20:51:27 j5k ntpd[19416]: ntpd 4.0.99g Mon Oct 9 20:44:40 MDT 2000 (1) Oct 9 20:51:27 j5k ntpd[19416]: mlockall(): Cannot allocate memory
And in dmesg output, I see:
do_page_fault() pid=19416 command='ntpd'
PSW : 0004000a GR 1 : 40053cf0 GR 2 : 40052777 GR 3 : 40054c44 GR 4 : 400544f0 GR 5 : 4005ec4c GR 6 : 4005ec4c GR 7 : 00000000 GR 8 : ffffffff GR 9 : 00059cf0 GR10 : 2001fd24 GR11 : 0005c140 GR12 : 0003a800 GR13 : 0003a800 GR14 : 0005c140 GR15 : 0005c140 GR16 : 0005c140 GR17 : 00000001 GR18 : 0005c140 GR19 : 40197148 GR20 : 00000000 GR21 : 00000000 GR22 : 00001fe9 GR23 : 00000004 GR24 : 000001b0 GR25 : 0005d020 GR26 : 4005ec88 GR27 : 00045140 GR28 : 00000000 GR29 : 0005f1b8 GR30 : 200203c0 GR31 : 40083f13 SR0 : 00000000 SR1 : 0000200b SR2 : 00000000 SR3 : 0000200b SR4 : 0000200b SR5 : 0000200b SR6 : 0000200b SR7 : 0000200b
IASQ : 0000200b 0000200b IAOQ : 4005277f 40052783 ORIG_R28 : 00000000
IIR : 0eb41288 ISR : 0000200b IOR : 00000004
sending SIGSEGV
Anyone know what's going on?
Bdale
Quoted 5 lines · Bdale Garbee
I built a package of ntp, and it installed ok, but when ntpd goes to launch, I get the following in daemon.log:
Oct 9 20:51:27 j5k ntpd[19416]: ntpd 4.0.99g Mon Oct 9 20:44:40 MDT 2000 (1) Oct 9 20:51:27 j5k ntpd[19416]: mlockall(): Cannot allocate memory
A simple prog that just calls mlockall() fails as well. It is because we currently allocate a massive stack (256MB?) for every process, and mlockall() tries to actually claim the memory for that stack. I tried allocating just a 1MB stack in fs/exec.c, and my simple mlockall() prog then worked.
Richard
Quoted 4 lines · Richard Hirst
Quoted 3 lines · Bdale Garbee
I built a package of ntp, and it installed ok, but when ntpd goes to launch, I get the following in daemon.log:
Quoted 8 lines
Quoted 2 lines
Oct 9 20:51:27 j5k ntpd[19416]: ntpd 4.0.99g Mon Oct 9 20:44:40 MDT 2000 (1) Oct 9 20:51:27 j5k ntpd[19416]: mlockall(): Cannot allocate memoryA simple prog that just calls
mlockall()fails as well. It is because we currently allocate a massive stack (256MB?) for every process, andmlockall()tries to actually claim the memory for that stack. I tried allocating just a 1MB stack infs/exec.c, and my simplemlockall()prog then worked.
I've changed the kernel to grow the user stack dynamically, so hopefully your ntpd will work now.
Richard
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Bdale Garbee
Quoted 2 lines · [email protected] (Richard Hirst) writes:
I've changed the kernel to grow the user stack dynamically, so hopefully your ntpd will work now.
Still dies, but without the
mlockall()error, so that seems fixed. The dmesg output when it fails is
Thought I'd better investigate in case it was my stack changes... (configured and built ntp natively, btw).
Turns out this crash is caused by the call to timer_create() in ntpd/ntp_timer.c.
timer_create() is in librt.a - anyone know whether we expect this to work or not atm?
Anyway, if you undefine HAVE_TIMER_CREATE and HAVE_TIMER_SETTIME in config.h and rebuild it, it does better. I now get:
11 Oct 05:21:13 ntpd[3141]: logging to file /tmp/ntpd.log
11 Oct 05:21:13 ntpd[3141]: ntpd 4.0.99g Wed Oct 11 05:17:40 MDT 2000 (5) 11 Oct 05:21:13 ntpd[3141]: precision = 10000 usec
11 Oct 05:21:13 ntpd[3141]: kern_enable is 1
11 Oct 05:21:13 ntpd[3141]: init_socket_sig: ioctl(I_SETSIG, S_INPUT) failed: Bad address
So, I undefined USE_UDP_SIGPOLL, and now ntpd runs and talks to remote ntp servers. Don't know whether it is doing what it should though...
Richard
Quoted 2 lines · Richard Hirst
timer_create()is in librt.a - anyone know whether we expect this to work or not atm?
librt.so you mean, and it may not actually work, because it pulls in libpthread.so. I did enough fixing of linuxthreads such that merely linking with -lpthread doesn't break your program, but I expect there might be other problems, and actually using threads almost certainly will not work. (we're still missing a few #defines in pt-machine.h, which I'll put in today, maybe, but there are probably VM issues in the kernel as well, and I don't know if clone(2) actually works).
Signature · 2 lines
[email protected], http://www.linuxcare.com/ Linuxcare. Support for the revolution.