This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug time/19363] x32: times() return value wrongly truncates/sign extends from 32bit
- From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 15 Dec 2015 03:32:10 +0000
- Subject: [Bug time/19363] x32: times() return value wrongly truncates/sign extends from 32bit
- Auto-submitted: auto-generated
- References: <bug-19363-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=19363
--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, hjl/pr19363 has been created
at dd66060507f86934da9eb610b384c251ebd1168f (commit)
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=dd66060507f86934da9eb610b384c251ebd1168f
commit dd66060507f86934da9eb610b384c251ebd1168f
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Dec 14 19:09:13 2015 -0800
Use INTERNAL_SYSCALL_TIMES for Linux times
The Linux times function, which returns clock_t, is implemented with
INTERNAL_SYSCALL. Since INTERNAL_SYSCALL returns 32-bit integer and
and clock_t is 64-bit on x32, this is a mismatch on x32. times is the
only such function since there is lseek.S for x32. This patch replaces
INTERNAL_SYSCALL in Linux times.c with INTERNAL_SYSCALL_TIMES which is
default to INTERNAL_SYSCALL and provides x32 times.c with proper
INTERNAL_SYSCALL_TIMES.
There is no code change on times for i686 nor x86-64. For x32, before
this patch, there are
0000000 <__times>:
0: b8 64 00 00 40 mov $0x40000064,%eax
5: 0f 05 syscall
7: 48 63 d0 movslq %eax,%rdx
^^^^^^^^^^ Incorrect signed extension
a: 48 83 fa f2 cmp $0xfffffffffffffff2,%rdx
e: 75 07 jne 17 <__times+0x17>
10: 3d 00 f0 ff ff cmp $0xfffff000,%eax
15: 77 11 ja 28 <__times+0x28>
17: 48 83 fa ff cmp $0xffffffffffffffff,%rdx
1b: b8 00 00 00 00 mov $0x0,%eax
20: 48 0f 45 c2 cmovne %rdx,%rax
24: c3 retq
After this patch, there are
00000000 <__times>:
0: b8 64 00 00 40 mov $0x40000064,%eax
5: 0f 05 syscall
7: 48 83 f8 f2 cmp $0xfffffffffffffff2,%rax
b: 75 07 jne 14 <__times+0x14>
d: 3d 00 f0 ff ff cmp $0xfffff000,%eax
12: 77 14 ja 28 <__times+0x28>
14: 48 83 f8 ff cmp $0xffffffffffffffff,%rax
18: ba 00 00 00 00 mov $0x0,%edx
1d: 48 0f 44 c2 cmove %rdx,%rax
21: c3 retq
The incorrect signed extension is gone.
[BZ #19363]
* sysdeps/unix/sysv/linux/times.c (INTERNAL_SYSCALL_TIMES): New.
(__times): Replace INTERNAL_SYSCALL with INTERNAL_SYSCALL_TIMES.
* sysdeps/unix/sysv/linux/x86_64/x32/times.c: New file.
-----------------------------------------------------------------------
--
You are receiving this mail because:
You are on the CC list for the bug.