[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#570603: libc6: fallocate and posix_fallocate do weird system calls



retitle strace: don't 
reassign 570603 strace: wrong arguments for fallocate on 64-bit architectures
thanks

On Fri, Feb 19, 2010 at 08:35:59PM -0600, Drake Wilson wrote:
> Package: libc6
> Version: 2.10.2-6
> Severity: normal
> 
> Two C source files are attached.  One of them uses Linux fallocate()

They are not.

> and one uses posix_fallocate() from POSIX:2001.  Both are ostensibly
> supported by eglibc.  I'm running a stock kernel from unstable (some
> background text removed):
> 
>   $ uname -r
>   2.6.29-1-amd64
>   $ dpkg -l linux-image-2.6.29-1-amd64
>   ii  linux-image-2.6.29-1-amd64  2.6.29-3  Linux 2.6.29 image on AMD64
> 
> Each of the C programs will attempt to open and truncate a file named
> "file", then allocate one MiB of space for it, changing its size.
> Here's what happens instead:
> 
>   $ strace ./linux
>   [...]
>   open("file", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
>   fallocate(3, 0, 4503599627370496, 6895618648722965280) = -1 EOPNOTSUPP (Operation not supported)
>   << The hexadecimal representations of those two numbers are
>      0x0010000000000000 and 0x5fb228a05fb10320. >>

strace considers that the values are passed using 2 32-bit values, while
on a 64-bit architecture there are directly passed as a 64-bit value.

> And:
> 
>   $ strace ./posix
>   open("file", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
>   fallocate(3, 0, 4503599627370496, 1048576) = -1 EOPNOTSUPP (Operation not supported)
>   << This is followed by an emulation of posix_fallocate using one-byte
>      pwrites.  Jesus. >>

Your filesystem does not support fallocate, so the glibc is emulating it
with a pwrite.

> This is obviously bogus.
> 
> This feels like libc screwing up the system call parameters, which is
> why I'm reporting it here, but I'm not certain of that.  It could also
> potentially be strace or the kernel, in which case please reassign as
> necessary, as usual.

Reassigning.

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net



Reply to: