Subject: kern/29650: stat64() syscall under Linux ABI supplies wrong timestamp
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <pin@konvalo.org>
List: netbsd-bugs
Date: 03/10/2005 13:42:00
>Number: 29650
>Category: kern
>Synopsis: stat64() syscall under Linux ABI supplies wrong timestamp
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Mar 10 13:42:00 +0000 2005
>Originator: Ivan Popov
>Release: NetBSD 2.99.14
>Organization:
Konvalo.org project
>Environment:
System: NetBSD yoghurt.tekno.chalmers.se 2.99.14 NetBSD 2.99.14 (GENERIC) #0: Tue Jan 18 19:02:42 CET 2005 bouyer@pop.lip6.fr:/local/pop1/bouyer/tmp/i386/obj/local/pop1/bouyer/current-clean/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
It looks like gnu make under Linux ABI gets wrong timestamp
information from NetBSD kernel: (a GENERIC kernel shows the same problem
as below)
------------------------------------------------------
pin@yoghurt:~$ /usr/bin/uname -a
NetBSD yoghurt.tekno.chalmers.se 2.99.14 NetBSD 2.99.14 (GENERIC) #0: Tue Jan 18
+19:02:42 CET 2005
+bouyer@pop.lip6.fr:/local/pop1/bouyer/tmp/i386/obj/local/pop1/bouyer/current-cl
+ean/src/sys/arch/i386/compile/GENERIC i386
pin@yoghurt:~$ make --version
GNU Make 3.80
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
pin@yoghurt:~$ cat Makefile
a: a.c
echo DONE!
pin@yoghurt:~$ rm -f a.c; touch a.c
pin@yoghurt:~$ date
Wed Mar 9 22:06:47 CET 2005
pin@yoghurt:~$ ls -l a.c
-rw-r--r-- 1 pin users 0 2005-03-09 22:06 a.c
pin@yoghurt:~$ make
make: a.c: Timestamp out of range; substituting 1970-01-01 00:59:59.999999999
make: Warning: File `a.c' has modification time 1,6e+10 s in the future
echo DONE!
DONE!
make: warning: Clock skew detected. Your build may be incomplete.
pin@yoghurt:~$
------------------------------------------------------
(both "date" and "ls" here are run via Linux ABI, but they most probably
ignore nanoseconds in the stamps, while gnu make is known to use those)
An excerpt from a trace of the make command above:
------------------------------------------------------
...
5997 ld-konvalo.so CALL stat64(0x37b10,0xbfbfcdd0)
5997 ld-konvalo.so NAMI "a"
5997 ld-konvalo.so RET stat64 -1 errno -2 No such file or directory
5997 ld-konvalo.so CALL stat64(0x37ae0,0xbfbfcdd0)
5997 ld-konvalo.so NAMI "a.c"
5997 ld-konvalo.so RET stat64 0
5997 ld-konvalo.so CALL write(2,0xbfbfa6e0,6)
5997 ld-konvalo.so GIO fd 2 wrote 6 bytes
"make: "
5997 ld-konvalo.so RET write 6
5997 ld-konvalo.so CALL write(2,0xbfbfa700,0x47)
5997 ld-konvalo.so GIO fd 2 wrote 71 bytes
"a.c: Timestamp out of range; substituting 1970-01-01 00:59:59.99999999\
9"
5997 ld-konvalo.so RET write 71/0x47
5997 ld-konvalo.so CALL write(2,0xbdbe68e7,1)
5997 ld-konvalo.so GIO fd 2 wrote 1 bytes
"
"
5997 ld-konvalo.so RET write 1
5997 ld-konvalo.so CALL fstat64(1,0xbfbfc6d0)
5997 ld-konvalo.so RET fstat64 0
5997 ld-konvalo.so CALL ioctl(1,_IO('T',0x1,0),0xbfbfc620)
5997 ld-konvalo.so RET ioctl 0
5997 ld-konvalo.so CALL old_mmap(0xbfbfc6b0)
5997 ld-konvalo.so RET old_mmap -1114329088/0xbd94b000
5997 ld-konvalo.so CALL write(1,0xbd94b000,0xb)
5997 ld-konvalo.so GIO fd 1 wrote 11 bytes
"echo DONE!
"
...
------------------------------------------------------
(The "ld-konvalo.so" executable name is due to explicit run of glibc
dynamic loader like "ld-linux.so.2 --library-path .... <binary>"
which does not affect syscalls.
The explicit loader run is a glibc feature used as standard
for dynamically linked with glibc programs in Konvalo.org.
The glibc version used is 2.3.2 compiled for Linux kernel 2.4.19
without tls.)
I guess some bytes (nanoseconds?) in struct stat are filled differently
on NetBSD's Linux ABI compared to Linux ...
The same instance of gmake with the same instance of libraries
works well on Linux and also under FreeBSDs Linux ABI.
>How-To-Repeat:
Like above, running Linux gnu make.
>Fix:
Not known.
>Unformatted: