amd64 strace misprints 64 bit i386 off_t

Ralf Neubauer ralf at strcmp.de
Sun Sep 7 15:31:57 UTC 2008


Package: strace
Version: 4.5.15-1.1ubuntu1
Severity: normal

I compiled this program under 32 bit debian lenny:

#define _XOPEN_SOURCE 500
#define _FILE_OFFSET_BITS 64

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>

int main (int argc, char **argv)
{
        int fd = open(argv[0], O_RDONLY);
        char buf[1];

        off_t offset = (off_t)0x100000001ULL;
        fprintf(stderr, "%llu\n", (unsigned long long)offset);
        pread(fd, buf, 1, offset);

        return 0;
}

on this system strace prints:
[...]
open("stracetest", O_RDONLY|O_LARGEFILE) = 3
write(2, "4294967297\n"..., 114294967297
)         = 11
pread64(3, ""..., 1, 4294967297)        = 0
exit_group(0)                           = ?

on the 64 bit machine under hardy strace prints:

open("stracetest", O_RDONLY|O_LARGEFILE) = 3
write(2, "4294967297\n", 114294967297
)            = 11
pread64(3, "", 1, 1)                    = 0
exit_group(0)                           = ?

I haven't looked further if this is a problem with 32 bit compatibility
in the kernel syscall entry or in strace but because strange things
should happen if this is a kernel problem I assume it is strace.

-- System Information:
Debian Release: lenny/sid
  APT prefers hardy-updates
  APT policy: (500, 'hardy-updates'), (500, 'hardy-security'), (500, 'hardy'), (200, 'hardy-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.24-19-generic (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages strace depends on:
ii  libc6                      2.7-10ubuntu3 GNU C Library: Shared libraries

strace recommends no packages.

-- no debconf information




More information about the ubuntu-users mailing list