* Re: fstat seems broken on sparc64 [not found] ` <20100110.131158.242584083.davem@davemloft.net> @ 2010-01-10 23:15 ` Jan Engelhardt 2010-01-11 6:42 ` David Miller 0 siblings, 1 reply; 3+ messages in thread From: Jan Engelhardt @ 2010-01-10 23:15 UTC (permalink / raw) To: David Miller; +Cc: sparclinux, Linux Kernel Mailing List On Sunday 2010-01-10 22:11, David Miller wrote: > >> libc6 2.10.2-4 > >Perfect, now you just have to audit what changed between the -2 and >the -4 package to find the bug :-) I really do not believe you when you say your glibc is not affected. Maybe some things did not became clear as part of the discussion, so let me quickly restate: - talking about -m64 / libc6-sparc64_2.10.2-*_sparc.deb only - syscall is screwed up. strace outputs: C func | i386 | x86_64 | sparc32 | sparc64 --------+-----------+------------+-----------+--------------- stat | stat64 | stat | stat64 | stat64 lstat | lstat64 | lstat | lstat64 | lstat64 fstatat | fstatat64 | newfstatat | fstatat64 | fstatat64 fstat | fstat64 | fstat | fstat64 | fstat (*) - I now found and fixed the problem, here is the patch for you to study (as code speaks louder) Index: glibc-2.10.1/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c =================================================================== --- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c +++ glibc-2.10.1/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c @@ -1 +1 @@ -#include "../../fxstat.c" +#include "../../i386/fxstat.c" (Hint: Compare with sparc64/lxstat.c) ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: fstat seems broken on sparc64 2010-01-10 23:15 ` fstat seems broken on sparc64 Jan Engelhardt @ 2010-01-11 6:42 ` David Miller 2010-01-11 9:06 ` Jan Engelhardt 0 siblings, 1 reply; 3+ messages in thread From: David Miller @ 2010-01-11 6:42 UTC (permalink / raw) To: jengelh; +Cc: sparclinux, linux-kernel From: Jan Engelhardt <jengelh@medozas.de> Date: Mon, 11 Jan 2010 00:15:17 +0100 (CET) > On Sunday 2010-01-10 22:11, David Miller wrote: >> >>> libc6 2.10.2-4 >> >>Perfect, now you just have to audit what changed between the -2 and >>the -4 package to find the bug :-) > > I really do not believe you when you say your glibc is not affected. Why not :-) davem@sunset:~$ dpkg-query -W | grep libc6-sparc64 libc6-sparc64 2.10.2-2 davem@sunset:~$ cat fstat_test.c #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> int main(void) { struct stat sb; int fd = open("foo", O_RDWR | O_CREAT, 0666); if (fd < 0) abort(); if (fstat(fd, &sb) < 0) abort(); printf("%lu.%lu\n", sb.st_mtim.tv_sec, sb.st_mtim.tv_nsec); if (stat("foo", &sb) < 0) abort(); printf("%lu.%lu\n", sb.st_mtim.tv_sec, sb.st_mtim.tv_nsec); if (fstatat(AT_FDCWD, "foo", &sb, 0) < 0) abort(); printf("%lu.%lu\n", sb.st_mtim.tv_sec, sb.st_mtim.tv_nsec); return 0; } davem@sunset:~$ gcc -m64 -o fstat_test fstat_test.c davem@sunset:~$ ./fstat_test 1261510364.0 1261510364.0 1261510364.0 davem@sunset:~$ But, indeed when I run it under strace64 it goes: open("foo", O_RDWR|O_CREAT, 0666) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0 I wonder why I get a sane output from the test program even though it's not using fstat64. > - I now found and fixed the problem, here is the patch for > you to study (as code speaks louder) > > Index: glibc-2.10.1/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c > =================================================================== > --- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c > +++ glibc-2.10.1/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c > @@ -1 +1 @@ > -#include "../../fxstat.c" > +#include "../../i386/fxstat.c" > > (Hint: Compare with sparc64/lxstat.c Thanks a lot! Please submit this to the glibc/eglibc folks for inclusion! ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: fstat seems broken on sparc64 2010-01-11 6:42 ` David Miller @ 2010-01-11 9:06 ` Jan Engelhardt 0 siblings, 0 replies; 3+ messages in thread From: Jan Engelhardt @ 2010-01-11 9:06 UTC (permalink / raw) To: David Miller; +Cc: sparclinux, linux-kernel On Monday 2010-01-11 07:42, David Miller wrote: >> On Sunday 2010-01-10 22:11, David Miller wrote: >>> >>>> libc6 2.10.2-4 >>> >>>Perfect, now you just have to audit what changed between the -2 and >>>the -4 package to find the bug :-) >> >> I really do not believe you when you say your glibc is not affected. > >Why not :-) > >davem@sunset:~$ dpkg-query -W | grep libc6-sparc64 >libc6-sparc64 2.10.2-2 >davem@sunset:~$ cat fstat_test.c >#include <sys/stat.h> >#include <fcntl.h> >#include <stdio.h> >#include <stdlib.h> > >int main(void) >{ > struct stat sb; > int fd = open("foo", O_RDWR | O_CREAT, 0666); > > if (fd < 0) > abort(); > if (fstat(fd, &sb) < 0) > abort(); > printf("%lu.%lu\n", sb.st_mtim.tv_sec, sb.st_mtim.tv_nsec); > if (stat("foo", &sb) < 0) > abort(); > printf("%lu.%lu\n", sb.st_mtim.tv_sec, sb.st_mtim.tv_nsec); > if (fstatat(AT_FDCWD, "foo", &sb, 0) < 0) > abort(); > printf("%lu.%lu\n", sb.st_mtim.tv_sec, sb.st_mtim.tv_nsec); > return 0; >} >davem@sunset:~$ gcc -m64 -o fstat_test fstat_test.c >davem@sunset:~$ ./fstat_test >1261510364.0 >1261510364.0 >1261510364.0 >davem@sunset:~$ >But, indeed when I run it under strace64 it goes: > >open("foo", O_RDWR|O_CREAT, 0666) = 3 >fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 >fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0 > >I wonder why I get a sane output from the test program even though >it's not using fstat64. I would recommend that you run the testcase on a filesystem that supports and records subsecond timestamps, and that the file is created at a moment where the subsecond part is not 0. When in doubt, use touch(1) to apply some subseconds, but usually, just running it will create it at a non-zero subsecond with a high probability. >> =================================================================== >> --- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c >> +++ glibc-2.10.1/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c >> @@ -1 +1 @@ >> -#include "../../fxstat.c" >> +#include "../../i386/fxstat.c" >> >> (Hint: Compare with sparc64/lxstat.c > >Thanks a lot! > >Please submit this to the glibc/eglibc folks for inclusion! > http://sources.redhat.com/bugzilla/show_bug.cgi?id=11155 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-01-11 9:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <alpine.LSU.2.01.0912141511280.27692@obet.zrqbmnf.qr>
[not found] ` <20091214.233840.236673621.davem@davemloft.net>
[not found] ` <alpine.LSU.2.01.1001082355250.20848@obet.zrqbmnf.qr>
[not found] ` <20100110.131158.242584083.davem@davemloft.net>
2010-01-10 23:15 ` fstat seems broken on sparc64 Jan Engelhardt
2010-01-11 6:42 ` David Miller
2010-01-11 9:06 ` Jan Engelhardt
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®