This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/19371] Wrong error return on syscall ()
- From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Wed, 16 Dec 2015 14:57:57 +0000
- Subject: [Bug libc/19371] Wrong error return on syscall ()
- Auto-submitted: auto-generated
- References: <bug-19371-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=19371
--- Comment #2 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/pr19371/master has been created
at bf0e161423748feb7950110d6074ebbcd102cb7e (commit)
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=bf0e161423748feb7950110d6074ebbcd102cb7e
commit bf0e161423748feb7950110d6074ebbcd102cb7e
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Dec 16 06:50:42 2015 -0800
Properly handle x32 syscall
X32 syscall() may return 64-bit integer as lseek, time and times. Its
return type should be __syscall_slong_t instead of long int. We need
to properly return 64-bit error value.
Before the patch:
Dump of assembler code for function syscall:
0x000dab20 <+0>: mov %rdi,%rax
0x000dab23 <+3>: mov %rsi,%rdi
0x000dab26 <+6>: mov %rdx,%rsi
0x000dab29 <+9>: mov %rcx,%rdx
0x000dab2c <+12>: mov %r8,%r10
0x000dab2f <+15>: mov %r9,%r8
0x000dab32 <+18>: mov 0x8(%rsp),%r9
0x000dab37 <+23>: syscall
0x000dab39 <+25>: cmp $0xfffffffffffff001,%rax
0x000dab3f <+31>: jae 0xdab42 <syscall+34>
0x000dab41 <+33>: retq
0x000dab42 <+34>: mov 0x2b3367(%rip),%rcx # 0x38deb0
0x000dab49 <+41>: neg %eax
0x000dab4b <+43>: mov %eax,%fs:(%rcx)
0x000dab4e <+46>: or $0xffffffff,%eax
^^^^^^^^^^^^^^^^^^ This is 32-bit error return.
0x000dab51 <+49>: retq
End of assembler dump.
After the patch:
Dump of assembler code for function syscall:
0x000daaf0 <+0>: mov %rdi,%rax
0x000daaf3 <+3>: mov %rsi,%rdi
0x000daaf6 <+6>: mov %rdx,%rsi
0x000daaf9 <+9>: mov %rcx,%rdx
0x000daafc <+12>: mov %r8,%r10
0x000daaff <+15>: mov %r9,%r8
0x000dab02 <+18>: mov 0x8(%rsp),%r9
0x000dab07 <+23>: syscall
0x000dab09 <+25>: cmp $0xfffffffffffff001,%rax
0x000dab0f <+31>: jae 0xdab12 <syscall+34>
0x000dab11 <+33>: retq
0x000dab12 <+34>: mov 0x2b3397(%rip),%rcx # 0x38deb0
0x000dab19 <+41>: neg %eax
0x000dab1b <+43>: mov %eax,%fs:(%rcx)
0x000dab1e <+46>: or $0xffffffffffffffff,%rax
0x000dab22 <+50>: retq
End of assembler dump.
[BZ #19371]
* posix/unistd.h (syscall): Use __syscall_slong_t for return
type.
* sysdeps/unix/sysv/linux/x86_64/x32/syscall.S: New file.
-----------------------------------------------------------------------
--
You are receiving this mail because:
You are on the CC list for the bug.