V2 [PATCH 0/2] x32: Properly pass long to syscall [BZ #25810]
H.J. Lu
hjl.tools@gmail.com
Mon Apr 13 17:51:15 GMT 2020
X32 has 32-bit long and pointer with 64-bit off_t. Since x32 psABI
requires that pointers passed in registers must be zero-extended to
64bit, x32 can share many syscall interfaces with LP64. When a LP64
syscall with long and unsigned long arguments is used for x32, these
arguments must be properly extended to 64-bit. Otherwise if the upper
32 bits of the register have undefined value, such a syscall will be
rejected by kernel.
For syscalls implemented in assembly codes, 'U' is added to syscall
signature key letters for unsigned long. SYSCALL_ULONG_ARG_1 and
SYSCALL_ULONG_ARG_2 are passed to syscall-template.S for the first
and the second unsigned long arguments if PSEUDOS_HAVE_4_ARGS is
defined. They are used by x32 to zero-extend 32-bit arguments to
64 bits.
Tested on i386, x86-64 and x32 as well as with build-many-glibcs.py.
OK for master branch?
H.J. Lu (2):
Add SYSCALL_ULONG_ARG_[12] to pass long to syscall [BZ #25810]
Add a syscall test for [BZ #25810]
misc/Makefile | 2 +-
misc/tst-syscalls.c | 146 ++++++++++++++++++++
sysdeps/unix/make-syscalls.sh | 88 ++++++++++++
sysdeps/unix/syscall-template.S | 43 +++++-
sysdeps/unix/syscalls.list | 6 +-
sysdeps/unix/sysv/linux/syscalls.list | 14 +-
sysdeps/unix/sysv/linux/x86_64/sysdep.h | 70 ++++++++--
sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h | 20 ++-
8 files changed, 360 insertions(+), 29 deletions(-)
create mode 100644 misc/tst-syscalls.c
--
2.25.2
More information about the Libc-alpha
mailing list