public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: libc-stable@sourceware.org
Subject: [2.31/2.30] [PATCH 0/6] Properly pass long to syscall [BZ #25810/#25896]
Date: Thu, 30 Apr 2020 12:34:17 -0700	[thread overview]
Message-ID: <20200430193423.807713-1-hjl.tools@gmail.com> (raw)

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.

This patch set backports fixes from master branch to properly extend
long argument to long long before passing it to syscall for x32.  It
also adds a C wrapper to pass arguments in

/* Control process execution.  */
extern int prctl (int __option, ...) __THROW;

to prctl syscall:

extern int prctl (int, unsigned long int, unsigned long int,
		  unsigned long int, unsigned long int);

I will check it into 2.31 and 2.30 branches next Thursday.

H.J. Lu (6):
  x32: Properly pass long to syscall [BZ #25810]
  Add SYSCALL_ULONG_ARG_[12] to pass long to syscall [BZ #25810]
  Add a syscall test for [BZ #25810]
  Mark unsigned long arguments with U in more syscalls [BZ #25810]
  Add C wrappers for process_vm_readv/process_vm_writev [BZ #25810]
  Add a C wrapper for prctl [BZ #25896]

 include/sys/prctl.h                         |   1 +
 misc/Makefile                               |   2 +-
 misc/tst-syscalls.c                         | 167 ++++++++++++++++++++
 sysdeps/unix/make-syscalls.sh               |  24 +++
 sysdeps/unix/syscall-template.S             |  49 +++++-
 sysdeps/unix/syscalls.list                  |  22 +--
 sysdeps/unix/sysv/linux/Makefile            |   4 +-
 sysdeps/unix/sysv/linux/prctl.c             |  42 +++++
 sysdeps/unix/sysv/linux/process_vm_readv.c  |  32 ++++
 sysdeps/unix/sysv/linux/process_vm_writev.c |  32 ++++
 sysdeps/unix/sysv/linux/syscalls.list       |  41 +++--
 sysdeps/unix/sysv/linux/x86_64/sysdep.h     |  86 +++++++---
 sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h |  35 ++++
 13 files changed, 479 insertions(+), 58 deletions(-)
 create mode 100644 misc/tst-syscalls.c
 create mode 100644 sysdeps/unix/sysv/linux/prctl.c
 create mode 100644 sysdeps/unix/sysv/linux/process_vm_readv.c
 create mode 100644 sysdeps/unix/sysv/linux/process_vm_writev.c

-- 
2.26.2


             reply	other threads:[~2020-04-30 19:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 19:34 H.J. Lu [this message]
2020-04-30 19:34 ` [2.31/2.30] [PATCH 1/6] x32: Properly pass long to syscall [BZ #25810] H.J. Lu
2020-04-30 19:34 ` [2.31/2.30] [PATCH 2/6] Add SYSCALL_ULONG_ARG_[12] to " H.J. Lu
2020-04-30 19:34 ` [2.31/2.30] [PATCH 3/6] Add a syscall test for " H.J. Lu
2020-04-30 19:34 ` [2.31/2.30] [PATCH 4/6] Mark unsigned long arguments with U in more syscalls " H.J. Lu
2020-04-30 19:34 ` [2.31/2.30] [PATCH 5/6] Add C wrappers for process_vm_readv/process_vm_writev " H.J. Lu
2020-04-30 19:34 ` [2.31/2.30] [PATCH 6/6] Add a C wrapper for prctl [BZ #25896] H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200430193423.807713-1-hjl.tools@gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=libc-stable@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).