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

libc6 in woody and sarge with kernel 2.4



Hi,

I think I have found a bug in the libc6 packages bundled with debian
woody and sarge. I tried searching online for this, but nothing came
up.

When a program tries to lstat() a file larger than 2gb, the syscall
lstat64() returns ok, but libc6 says something wrong happened. Here is
some test output on a woody system, tested with libc6 2.3.2 from sarge
and libc6 2.2.5 from woody, and kernel 2.2.20 from woody and a custom
2.4.26 kernel, vanilla source (Linus tree, no patches). This appears
to have worked on a redhat8 system with a custom 2.4 kernel and glibc
2.3.2, though I have not tested with this minimal program (because
that redhat8 instance does not exist any longer):

GLIBC 2.3.2 (from sarge):
  
strace kernel 2.2.20:
lstat64("largefile", 0xbffffc34) = -1 ENOSYS (Function not implemented)
lstat("largefile", {st_mode=S_IFREG|0644, st_size=2644920320, ...}) = 0
  
ltrace kernel 2.2.20:
__lxstat(3, 0xbffffebe, 0xbffffd20, 0x4014a550, 0xbffffd78) = 0
  
strace kernel 2.4.26:
lstat64("largefile", {st_mode=S_IFREG|0644, st_size=2644920320, ...}) = 0
 
ltrace kernel 2.4.26:
__lxstat(3, 0xbffffebe, 0xbffffd20, 0x4014a550, 0xbffffd78) = -1
  
GLIBC 2.2.5 (from woody):
  
strace kernel 2.2.20:
lstat64("largefile", 0xbffffc34) = -1 ENOSYS (Function not implemented)
lstat("largefile", {st_mode=S_IFREG|0644, st_size=2644920320, ...}) = 0
  
ltrace kernel 2.2.20:
__lxstat(3, 0xbffffebe, 0xbffffd14, 0x4012de48, 0xbffffd6c) = 0
  
strace kernel 2.4.26:
lstat64("largefile", {st_mode=S_IFREG|0644, st_size=2644920320, ...}) = 0
 
ltrace kernel 2.4.26:
__lxstat(3, 0xbffffebe, 0xbffffd14, 0x4012de48, 0xbffffd6c) = -1

Here is the program provoking the error:

-- testlstat.c --
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <stdio.h>
#include <error.h>
#include <errno.h>
#include <unistd.h>
 
int main (int argc, char * argv[]) {
  struct stat buf;
  if (lstat(argv[1], &buf) == -1) {
    printf("error: %s\n",strerror(errno));
    return 1;
  } else {
    printf("Success\n");
  }
  return 0;
}

Is this a known issue? Does a fix exist?

Thank you.

Ketil Froyn



Reply to: