[Bug time/19363] New: x32: times() return value wrongly truncates/sign extends from 32bit

vapier at gentoo dot org sourceware-bugzilla@sourceware.org
Mon Dec 14 23:12:00 GMT 2015


https://sourceware.org/bugzilla/show_bug.cgi?id=19363

            Bug ID: 19363
           Summary: x32: times() return value wrongly truncates/sign
                    extends from 32bit
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: time
          Assignee: unassigned at sourceware dot org
          Reporter: vapier at gentoo dot org
                CC: hjl.tools at gmail dot com
  Target Milestone: ---
              Host: x86_64-linux-gnux32

simple test code:
$ cat times.c
#include <errno.h>
#include <sched.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/syscall.h>
#include <sys/times.h>
#include <sys/wait.h>

main() {
        struct tms tbuf;
        clock_t res = times(&tbuf);
        printf("%llu %llx: %m\n", res, res);
}
$ gcc -mx32 times.c && ./a.out
18446744071615284719 ffffffff832c05ef: Success

times is supposed to return a 64bit value, but the definition on x32 breaks
that.  it's because sysdeps/unix/sysv/linux/times.c utilizes INTERNAL_SYSCALL
and those macros on x32 use "long int" everywhere (which is 32bit on x32).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list