Re: [chrony-users] Fatal error : adjtimex() failed

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-users Archives ]


On 23/08/2012 11:47, Miroslav Lichvar wrote:
On Thu, Aug 23, 2012 at 11:04:05AM +0100, Tomalak Geret'kal wrote:
It seems odd that chrony fails to open /var/run/chrony.pid and fails
to adjtimex(), presumably both through permissions errors (though
this is only made clear-ish for the latter). There is *only* a root
user on the device, and no selinux or anything of that ilk. The
intermittent nature of the fault does not involve a change in user
context. Still a race condition?
I'm not sure. In the 2.6.21 kernel's adjtimex code there seems to be
only one place returning EPERM a that's a check for the CAP_SYS_TIME
capability which root should always have (IIRC filesystem capabilities
were not supported yet). Any chance the binary could have the suid bit
set?

Aha, thankyou! Yes, it's -rwsr-xr-x. I didn't do that. Hmm!

When I remove this bit, the adjtimex() issue progresses to the shmget() issue (which seems impervious to setuidness).
When I add it back, the adjtimex() issue returns.

So that's (sort of) one mystery solved. I'll have to investigate as to where that setuid bit is getting set.

Tom
execve("./chronyd", ["./chronyd", "-d"], [/* 16 vars */]) = 0
brk(0)                                  = 0x3d000
uname({sys="Linux", node="sw200319", ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4001d000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=1846, ...}) = 0
mmap2(NULL, 1846, PROT_READ, MAP_PRIVATE, 3, 0) = 0x4001e000
close(3)                                = 0
open("/lib/libm.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\2501\0\000"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=743679, ...}) = 0
mmap2(NULL, 704672, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x40026000
mprotect(0x400ca000, 28672, PROT_NONE)  = 0
mmap2(0x400d1000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa3) = 0x400d1000
close(3)                                = 0
open("/lib/libgcc_s.so.1", O_RDONLY)    = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0x\'\0\000"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=69850, ...}) = 0
mmap2(NULL, 79676, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x400d3000
mprotect(0x400df000, 28672, PROT_NONE)  = 0
mmap2(0x400e6000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xb) = 0x400e6000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\300Q\1\000"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1553002, ...}) = 0
mmap2(NULL, 1212984, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x400e7000
mprotect(0x40202000, 32768, PROT_NONE)  = 0
mmap2(0x4020a000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x11b) = 0x4020a000
mmap2(0x4020d000, 8760, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4020d000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4001f000
syscall_983045(0x4001f790, 0x4001fe60, 0x4002567c, 0x4001fe68, 0x40025050, 0x40025000, 0, 0xf0005, 0x50, 0x1, 0xffff5118, 0xbeae4ac4, 0, 0xbeae4940, 0x400114ec, 0x40001f78, 0x20000010, 0x4001f790, 0, 0, 0, 0xd5b8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) = 0
mprotect(0x4020a000, 8192, PROT_READ)   = 0
mprotect(0x400d1000, 4096, PROT_READ)   = 0
mprotect(0x40024000, 4096, PROT_READ)   = 0
munmap(0x4001e000, 1846)                = 0
brk(0)                                  = 0x3d000
brk(0x5e000)                            = 0x5e000
open("/etc/chrony.conf", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=210, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4001e000
read(3, "#config-sw4.2\nallow\nrefclock PPS"..., 4096) = 210
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0x4001e000, 4096)                = 0
getuid32()                              = 0
gettimeofday({1345719076, 780280}, NULL) = 0
open("/etc/localtime", O_RDONLY)        = -1 ENOENT (No such file or directory)
open("/etc/localtime", O_RDONLY)        = -1 ENOENT (No such file or directory)
write(2, "main.c:324:(main)[23-10:51:16] ", 31main.c:324:(main)[23-10:51:16] ) = 31
write(2, "chronyd version 1.26 starting\n", 30chronyd version 1.26 starting
) = 30
open("/var/run/chronyd.pid", O_RDONLY)  = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=5, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4001e000
read(3, "6279\n", 1024)                 = 5
close(3)                                = 0
munmap(0x4001e000, 4096)                = 0
getsid(6279)                            = -1 ESRCH (No such process)
open("/var/run/chronyd.pid", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
getpid()                                = 6285
fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4001e000
write(3, "6285\n", 5)                   = 5
close(3)                                = 0
munmap(0x4001e000, 4096)                = 0
gettimeofday({1345719076, 927865}, NULL) = 0
gettimeofday({1345719076, 930716}, NULL) = 0
gettimeofday({1345719076, 932936}, NULL) = 0
gettimeofday({1345719076, 934974}, NULL) = 0
gettimeofday({1345719076, 937084}, NULL) = 0
gettimeofday({1345719076, 939295}, NULL) = 0
gettimeofday({1345719076, 941514}, NULL) = 0
gettimeofday({1345719076, 943551}, NULL) = 0
gettimeofday({1345719076, 945675}, NULL) = 0
gettimeofday({1345719076, 947876}, NULL) = 0
gettimeofday({1345719076, 950092}, NULL) = 0
gettimeofday({1345719076, 952137}, NULL) = 0
gettimeofday({1345719076, 954837}, NULL) = 0
gettimeofday({1345719076, 957091}, NULL) = 0
gettimeofday({1345719076, 959307}, NULL) = 0
gettimeofday({1345719076, 961344}, NULL) = 0
gettimeofday({1345719076, 963405}, NULL) = 0
gettimeofday({1345719076, 965664}, NULL) = 0
gettimeofday({1345719076, 967887}, NULL) = 0
gettimeofday({1345719076, 969930}, NULL) = 0
gettimeofday({1345719076, 971981}, NULL) = 0
gettimeofday({1345719076, 974201}, NULL) = 0
gettimeofday({1345719076, 976466}, NULL) = 0
gettimeofday({1345719076, 979159}, NULL) = 0
gettimeofday({1345719076, 981210}, NULL) = 0
gettimeofday({1345719076, 983428}, NULL) = 0
gettimeofday({1345719076, 985721}, NULL) = 0
gettimeofday({1345719076, 987772}, NULL) = 0
gettimeofday({1345719076, 989841}, NULL) = 0
gettimeofday({1345719076, 992050}, NULL) = 0
gettimeofday({1345719076, 994280}, NULL) = 0
gettimeofday({1345719076, 996380}, NULL) = 0
gettimeofday({1345719076, 998437}, NULL) = 0
gettimeofday({1345719077, 647}, NULL)   = 0
gettimeofday({1345719077, 3558}, NULL)  = 0
gettimeofday({1345719077, 5862}, NULL)  = 0
gettimeofday({1345719077, 8102}, NULL)  = 0
gettimeofday({1345719077, 10333}, NULL) = 0
gettimeofday({1345719077, 12538}, NULL) = 0
gettimeofday({1345719077, 14751}, NULL) = 0
gettimeofday({1345719077, 17013}, NULL) = 0
gettimeofday({1345719077, 19220}, NULL) = 0
gettimeofday({1345719077, 21427}, NULL) = 0
gettimeofday({1345719077, 23635}, NULL) = 0
gettimeofday({1345719077, 25896}, NULL) = 0
gettimeofday({1345719077, 28817}, NULL) = 0
gettimeofday({1345719077, 31029}, NULL) = 0
gettimeofday({1345719077, 33237}, NULL) = 0
gettimeofday({1345719077, 35505}, NULL) = 0
gettimeofday({1345719077, 37711}, NULL) = 0
gettimeofday({1345719077, 39920}, NULL) = 0
gettimeofday({1345719077, 42139}, NULL) = 0
gettimeofday({1345719077, 44348}, NULL) = 0
gettimeofday({1345719077, 46630}, NULL) = 0
gettimeofday({1345719077, 48842}, NULL) = 0
gettimeofday({1345719077, 51057}, NULL) = 0
gettimeofday({1345719077, 53910}, NULL) = 0
gettimeofday({1345719077, 56163}, NULL) = 0
gettimeofday({1345719077, 58380}, NULL) = 0
gettimeofday({1345719077, 60594}, NULL) = 0
gettimeofday({1345719077, 62810}, NULL) = 0
gettimeofday({1345719077, 65028}, NULL) = 0
gettimeofday({1345719077, 67295}, NULL) = 0
gettimeofday({1345719077, 69512}, NULL) = 0
gettimeofday({1345719077, 71729}, NULL) = 0
gettimeofday({1345719077, 73974}, NULL) = 0
gettimeofday({1345719077, 82730}, NULL) = 0
gettimeofday({1345719077, 85663}, NULL) = 0
gettimeofday({1345719077, 87881}, NULL) = 0
gettimeofday({1345719077, 90095}, NULL) = 0
gettimeofday({1345719077, 92303}, NULL) = 0
gettimeofday({1345719077, 94519}, NULL) = 0
gettimeofday({1345719077, 96787}, NULL) = 0
gettimeofday({1345719077, 99005}, NULL) = 0
gettimeofday({1345719077, 101208}, NULL) = 0
gettimeofday({1345719077, 103437}, NULL) = 0
gettimeofday({1345719077, 105520}, NULL) = 0
gettimeofday({1345719077, 107572}, NULL) = 0
gettimeofday({1345719077, 110435}, NULL) = 0
gettimeofday({1345719077, 112656}, NULL) = 0
gettimeofday({1345719077, 114735}, NULL) = 0
gettimeofday({1345719077, 116948}, NULL) = 0
gettimeofday({1345719077, 119162}, NULL) = 0
gettimeofday({1345719077, 121391}, NULL) = 0
gettimeofday({1345719077, 123438}, NULL) = 0
gettimeofday({1345719077, 125550}, NULL) = 0
gettimeofday({1345719077, 127755}, NULL) = 0
gettimeofday({1345719077, 129983}, NULL) = 0
gettimeofday({1345719077, 132036}, NULL) = 0
gettimeofday({1345719077, 139173}, NULL) = 0
gettimeofday({1345719077, 141374}, NULL) = 0
gettimeofday({1345719077, 143579}, NULL) = 0
gettimeofday({1345719077, 145671}, NULL) = 0
gettimeofday({1345719077, 147717}, NULL) = 0
gettimeofday({1345719077, 149917}, NULL) = 0
gettimeofday({1345719077, 152125}, NULL) = 0
gettimeofday({1345719077, 154161}, NULL) = 0
gettimeofday({1345719077, 156949}, NULL) = 0
gettimeofday({1345719077, 159154}, NULL) = 0
gettimeofday({1345719077, 161359}, NULL) = 0
gettimeofday({1345719077, 163399}, NULL) = 0
gettimeofday({1345719077, 165573}, NULL) = 0
uname({sys="Linux", node="sw200319", ...}) = 0
gettimeofday({1345719077, 174832}, NULL) = 0
open("/etc/localtime", O_RDONLY)        = -1 ENOENT (No such file or directory)
write(2, "sys_linux.c:976:(get_version_spe"..., 60sys_linux.c:976:(get_version_specific_details)[23-10:51:17] ) = 60
write(2, "Linux kernel major=2 minor=6 pat"..., 38Linux kernel major=2 minor=6 patch=21
) = 38
gettimeofday({1345719077, 186803}, NULL) = 0
open("/etc/localtime", O_RDONLY)        = -1 ENOENT (No such file or directory)
write(2, "sys_linux.c:1019:(get_version_sp"..., 61sys_linux.c:1019:(get_version_specific_details)[23-10:51:17] ) = 61
write(2, "hz=100 shift_hz=7 freq_scale=0.9"..., 98hz=100 shift_hz=7 freq_scale=0.99902439 nominal_tick=10000 slew_delta_tick=833 max_tick_bias=1000
) = 98
adjtimex({modes=ADJ_OFFSET|0x8000, offset=0, freq=0, maxerror=16384000, esterror=16384000, status=STA_UNSYNC, constant=2, precision=1, tolerance=33554432, time={1345719077, 198342}, tick=10000, ppsfreq=0, jitter=0, shift=0, stabil=0, jitcnt=0, calcnt=0, errcnt=0, stbcnt=0}) = 5 (TIME_ERROR)
adjtimex({modes=ADJ_STATUS, offset=0, freq=0, maxerror=16384000, esterror=16384000, status=STA_UNSYNC, constant=2, precision=1, tolerance=33554432, time={1345719077, 202656}, tick=10000, ppsfreq=0, jitter=0, shift=0, stabil=0, jitcnt=0, calcnt=0, errcnt=0, stbcnt=0}) = 5 (TIME_ERROR)
adjtimex({modes=0, offset=0, freq=0, maxerror=16384000, esterror=16384000, status=STA_UNSYNC, constant=2, precision=1, tolerance=33554432, time={1345719077, 207705}, tick=10000, ppsfreq=0, jitter=0, shift=0, stabil=0, jitcnt=0, calcnt=0, errcnt=0, stbcnt=0}) = 5 (TIME_ERROR)
adjtimex({modes=0, offset=0, freq=0, maxerror=16384000, esterror=16384000, status=STA_UNSYNC, constant=2, precision=1, tolerance=33554432, time={1345719077, 212001}, tick=10000, ppsfreq=0, jitter=0, shift=0, stabil=0, jitcnt=0, calcnt=0, errcnt=0, stbcnt=0}) = 5 (TIME_ERROR)
SYS_281(0x2, 0x2, 0, 0x352b8, 0x37910)  = 3
fcntl64(3, F_GETFD)                     = 0
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
SYS_294(0x3, 0x1, 0x2, 0xbeae4bf4, 0x4) = 0
SYS_294(0x3, 0x1, 0x6, 0xbeae4bf4, 0x4) = 0
SYS_294(0x3, 0x1, 0x1d, 0xbeae4bf4, 0x4) = 0
SYS_294(0x3, 0, 0x8, 0xbeae4bf4, 0x4)   = 0
SYS_282(0x3, 0xbeae4bc4, 0x10, 0, 0x10) = 0
SYS_281(0xa, 0x2, 0, 0x352b8, 0x37910)  = -1 EAFNOSUPPORT (Address family not supported by protocol)
gettimeofday({1345719077, 248955}, NULL) = 0
open("/etc/localtime", O_RDONLY)        = -1 ENOENT (No such file or directory)
write(2, "ntp_io.c:117:(prepare_socket)[23"..., 43ntp_io.c:117:(prepare_socket)[23-10:51:17] ) = 43
write(2, "Could not open IPv6 NTP socket :"..., 59Could not open IPv6 NTP socket : No such file or directory
) = 59
gettimeofday({1345719077, 260487}, NULL) = 0
SYS_281(0x2, 0x2, 0, 0x143, 0x1)        = 4
fcntl64(4, F_GETFD)                     = 0
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
SYS_294(0x4, 0x1, 0x2, 0xbeae4bf4, 0x4) = 0
SYS_282(0x4, 0xbeae4bc4, 0x10, 0, 0x10) = 0
SYS_281(0xa, 0x2, 0, 0x143, 0x1)        = -1 EAFNOSUPPORT (Address family not supported by protocol)
gettimeofday({1345719077, 289644}, NULL) = 0
open("/etc/localtime", O_RDONLY)        = -1 ENOENT (No such file or directory)
write(2, "cmdmon.c:196:(prepare_socket)[23"..., 43cmdmon.c:196:(prepare_socket)[23-10:51:17] ) = 43
write(2, "Could not open IPv6 command sock"..., 63Could not open IPv6 command socket : No such file or directory
) = 63
open("/dev/pps0", O_RDWR)               = 5
fcntl64(5, F_GETFD)                     = 0
fcntl64(5, F_SETFD, FD_CLOEXEC)         = 0
ioctl(5, IOCTL_TISER_TIMEOUT, 0xbeae4b60) = 0
ioctl(5, 0x800470a3, 0xbeae4bac)        = 0
ioctl(5, IOCTL_TISER_TIMEOUT, 0xbeae4b60) = 0
ioctl(5, 0x400470a2, 0xbeae4b60)        = 0
SYS_307(0x4e545030, 0x50, 0x380, 0x2, 0x3bd20) = -1 EINVAL (Invalid argument)
gettimeofday({1345719077, 325701}, NULL) = 0
open("/etc/localtime", O_RDONLY)        = -1 ENOENT (No such file or directory)
write(2, "refclock_shm.c:72:(shm_initialis"..., 48refclock_shm.c:72:(shm_initialise)[23-10:51:17] ) = 48
write(2, "Fatal error : shmget(1314148400,"..., 85Fatal error : shmget(1314148400,80,896) failed, errno: 2 (No such file or directory)
) = 85
exit_group(0)                           = ?
Process 6285 detached


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/