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

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



Package: libc6
Version: 2.10.2-6
Severity: normal

Two C source files are attached.  One of them uses Linux fallocate()
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. >>

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. >>

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.

   ---> Drake Wilson

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.29-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libc6 depends on:
ii  libc-bin                      2.10.2-6   Embedded GNU C Library: Binaries
ii  libgcc1                       1:4.4.3-2  GCC support library

libc6 recommends no packages.

Versions of packages libc6 suggests:
ii  debconf [debconf-2.0]         1.5.28     Debian configuration management sy
ii  glibc-doc                     2.10.2-5   Embedded GNU C Library: Documentat
ii  locales                       2.10.2-5   Embedded GNU C Library: National L

-- debconf information:
  glibc/upgrade: true
* glibc/disable-screensaver:
  glibc/restart-failed:
* glibc/restart-services: ssh saslauthd rsync openbsd-inetd lprng exim4 cron atd



Reply to: