lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LSU.2.01.1001111000290.14377@obet.zrqbmnf.qr>
Date:	Mon, 11 Jan 2010 10:06:45 +0100 (CET)
From:	Jan Engelhardt <jengelh@...ozas.de>
To:	David Miller <davem@...emloft.net>
cc:	sparclinux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: fstat seems broken on sparc64


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@...set:~$ dpkg-query -W | grep libc6-sparc64
>libc6-sparc64	2.10.2-2
>davem@...set:~$ 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@...set:~$ gcc -m64 -o fstat_test fstat_test.c
>davem@...set:~$ ./fstat_test
>1261510364.0
>1261510364.0
>1261510364.0
>davem@...set:~$ 
>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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ