From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: laurent@vivier.eu, imp@bsdimp.com
Subject: [PATCH v5 00/17] linux-user: simplify safe signal handling
Date: Wed, 17 Nov 2021 17:03:55 +0100 [thread overview]
Message-ID: <20211117160412.71563-1-richard.henderson@linaro.org> (raw)
Warner's v3:
https://patchew.org/QEMU/20211113045603.60391-1-imp@bsdimp.com/
Changes for v5:
* Fix safe-syscall.S FreeBSD typos.
* Rename special TARGET_EFOO to QEMU_EFOO.
* Create *-user/special-errno.h.
* Build safe-syscall.o only once.
* meson.build cleanups.
* bsd-user builds without modification on master.
Changes for v4:
* Move errno handling into the assembly. While returning the
raw -errno is handy for x86 linux (and a few others), it is
in fact more complex for other hosts that return a separate
error indicator. At which point we wind up jumping through
hoops to return -errno, only to have the caller put it right
back into +errno with -1 result, just like syscall(3).
Pass in &errno, because the method of calculating this
varies wildly between glibc, musl, etc. This means that
the assembly need only store to a provided pointer.
* Add mips and sparc safe-syscall implementations.
Both of which, btw, have separate error indicators. ;-)
* All hosts now have it, so remove HAVE_SAFE_SYSCALL.
* Add meson.build rules for common-user/safe-syscall.S, so
that we don't have to have weird includes from *-user.
r~
Richard Henderson (13):
common-user: Move syscall error detection into safe_syscall_base
common-user/host/mips: Add safe-syscall.inc.S
common-user/host/sparc64: Add safe-syscall.inc.S
linux-user: Remove HAVE_SAFE_SYSCALL and hostdep.h
*-user: Rename TARGET_ERESTARTSYS to QEMU_ERESTARTSYS
linux-user: Rename TARGET_QEMU_ESIGRETURN to QEMU_ESIGRETURN
bsd-user: Create special-errno.h
linux-user: Create special-errno.h
meson: Add build infrastructure for common-user
common-user: Move safe-syscall.* from linux-user
linux-user: Move thunk.c from top-level
meson: Move linux_user_ss to linux-user/
meson: Move bsd_user_ss to bsd-user/
Warner Losh (4):
linux-user: Add host_signal_set_pc to set pc in mcontext
linux-user/signal.c: Create a common rewind_if_in_safe_syscall
linux-user/safe-syscall.inc.S: Move to common-user
common-user: Adjust system call return on FreeBSD
meson.build | 23 ++-
bsd-user/errno_defs.h | 6 +-
bsd-user/special-errno.h | 24 ++++
{linux-user => include/user}/safe-syscall.h | 39 ++---
linux-user/cpu_loop-common.h | 1 +
linux-user/generic/target_errno_defs.h | 17 ---
linux-user/host/aarch64/host-signal.h | 5 +
linux-user/host/aarch64/hostdep.h | 38 -----
linux-user/host/alpha/host-signal.h | 5 +
linux-user/host/arm/host-signal.h | 5 +
linux-user/host/arm/hostdep.h | 38 -----
linux-user/host/i386/host-signal.h | 5 +
linux-user/host/i386/hostdep.h | 38 -----
linux-user/host/ia64/hostdep.h | 15 --
linux-user/host/mips/host-signal.h | 5 +
linux-user/host/mips/hostdep.h | 15 --
linux-user/host/ppc/host-signal.h | 5 +
linux-user/host/ppc/hostdep.h | 15 --
linux-user/host/ppc64/hostdep.h | 38 -----
linux-user/host/riscv/host-signal.h | 5 +
linux-user/host/riscv/hostdep.h | 34 -----
linux-user/host/s390/host-signal.h | 5 +
linux-user/host/s390/hostdep.h | 15 --
linux-user/host/s390x/hostdep.h | 38 -----
linux-user/host/sparc/host-signal.h | 9 ++
linux-user/host/sparc/hostdep.h | 15 --
linux-user/host/sparc64/hostdep.h | 15 --
linux-user/host/x32/hostdep.h | 15 --
linux-user/host/x86_64/host-signal.h | 5 +
linux-user/host/x86_64/hostdep.h | 38 -----
linux-user/signal-common.h | 4 +-
linux-user/special-errno.h | 32 +++++
linux-user/user-internals.h | 1 -
linux-user/aarch64/cpu_loop.c | 4 +-
linux-user/aarch64/signal.c | 4 +-
linux-user/alpha/cpu_loop.c | 4 +-
linux-user/alpha/signal.c | 8 +-
linux-user/arm/cpu_loop.c | 4 +-
linux-user/arm/signal.c | 8 +-
linux-user/cris/cpu_loop.c | 4 +-
linux-user/cris/signal.c | 4 +-
linux-user/hexagon/cpu_loop.c | 4 +-
linux-user/hexagon/signal.c | 2 +-
linux-user/hppa/cpu_loop.c | 4 +-
linux-user/hppa/signal.c | 4 +-
linux-user/i386/cpu_loop.c | 12 +-
linux-user/i386/signal.c | 8 +-
linux-user/m68k/cpu_loop.c | 4 +-
linux-user/m68k/signal.c | 8 +-
linux-user/microblaze/cpu_loop.c | 4 +-
linux-user/microblaze/signal.c | 4 +-
linux-user/mips/cpu_loop.c | 4 +-
linux-user/mips/signal.c | 8 +-
linux-user/openrisc/cpu_loop.c | 4 +-
linux-user/ppc/cpu_loop.c | 4 +-
linux-user/ppc/signal.c | 10 +-
linux-user/riscv/cpu_loop.c | 4 +-
linux-user/riscv/signal.c | 2 +-
linux-user/s390x/cpu_loop.c | 4 +-
linux-user/s390x/signal.c | 8 +-
linux-user/sh4/cpu_loop.c | 4 +-
linux-user/sh4/signal.c | 8 +-
linux-user/signal.c | 19 ++-
linux-user/sparc/cpu_loop.c | 2 +-
linux-user/sparc/signal.c | 8 +-
linux-user/syscall.c | 21 +--
thunk.c => linux-user/thunk.c | 0
linux-user/xtensa/cpu_loop.c | 4 +-
linux-user/xtensa/signal.c | 4 +-
bsd-user/meson.build | 6 +
.../host/aarch64/safe-syscall.inc.S | 65 ++++++---
.../host/arm/safe-syscall.inc.S | 69 ++++++---
.../host/i386/safe-syscall.inc.S | 61 +++++---
common-user/host/mips/safe-syscall.inc.S | 135 ++++++++++++++++++
.../host/ppc64/safe-syscall.inc.S | 63 ++++----
.../host/riscv/safe-syscall.inc.S | 50 ++++---
.../host/s390x/safe-syscall.inc.S | 50 ++++---
common-user/host/sparc64/safe-syscall.inc.S | 91 ++++++++++++
.../host/x86_64/safe-syscall.inc.S | 80 +++++++----
common-user/meson.build | 3 +
{linux-user => common-user}/safe-syscall.S | 5 +-
linux-user/meson.build | 9 +-
82 files changed, 778 insertions(+), 689 deletions(-)
create mode 100644 bsd-user/special-errno.h
rename {linux-user => include/user}/safe-syscall.h (81%)
delete mode 100644 linux-user/host/aarch64/hostdep.h
delete mode 100644 linux-user/host/arm/hostdep.h
delete mode 100644 linux-user/host/i386/hostdep.h
delete mode 100644 linux-user/host/ia64/hostdep.h
delete mode 100644 linux-user/host/mips/hostdep.h
delete mode 100644 linux-user/host/ppc/hostdep.h
delete mode 100644 linux-user/host/ppc64/hostdep.h
delete mode 100644 linux-user/host/riscv/hostdep.h
delete mode 100644 linux-user/host/s390/hostdep.h
delete mode 100644 linux-user/host/s390x/hostdep.h
delete mode 100644 linux-user/host/sparc/hostdep.h
delete mode 100644 linux-user/host/sparc64/hostdep.h
delete mode 100644 linux-user/host/x32/hostdep.h
delete mode 100644 linux-user/host/x86_64/hostdep.h
create mode 100644 linux-user/special-errno.h
rename thunk.c => linux-user/thunk.c (100%)
rename {linux-user => common-user}/host/aarch64/safe-syscall.inc.S (64%)
rename {linux-user => common-user}/host/arm/safe-syscall.inc.S (64%)
rename {linux-user => common-user}/host/i386/safe-syscall.inc.S (71%)
create mode 100644 common-user/host/mips/safe-syscall.inc.S
rename {linux-user => common-user}/host/ppc64/safe-syscall.inc.S (68%)
rename {linux-user => common-user}/host/riscv/safe-syscall.inc.S (77%)
rename {linux-user => common-user}/host/s390x/safe-syscall.inc.S (71%)
create mode 100644 common-user/host/sparc64/safe-syscall.inc.S
rename {linux-user => common-user}/host/x86_64/safe-syscall.inc.S (64%)
create mode 100644 common-user/meson.build
rename {linux-user => common-user}/safe-syscall.S (91%)
--
2.25.1
next reply other threads:[~2021-11-17 16:06 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-17 16:03 Richard Henderson [this message]
2021-11-17 16:03 ` [PATCH v5 01/17] linux-user: Add host_signal_set_pc to set pc in mcontext Richard Henderson
2021-11-17 16:23 ` Warner Losh
2021-11-17 16:37 ` Alex Bennée
2021-11-17 16:03 ` [PATCH v5 02/17] linux-user/signal.c: Create a common rewind_if_in_safe_syscall Richard Henderson
2021-11-17 16:24 ` Warner Losh
2021-11-17 16:37 ` Alex Bennée
2021-11-17 16:03 ` [PATCH v5 03/17] linux-user/safe-syscall.inc.S: Move to common-user Richard Henderson
2021-11-17 16:25 ` Warner Losh
2021-11-17 16:38 ` Alex Bennée
2021-11-17 16:03 ` [PATCH v5 04/17] common-user: Move syscall error detection into safe_syscall_base Richard Henderson
2021-11-17 16:28 ` Warner Losh
2021-11-22 11:55 ` Peter Maydell
2021-11-22 12:21 ` Richard Henderson
2021-11-22 15:07 ` Peter Maydell
2021-11-17 16:04 ` [PATCH v5 05/17] common-user/host/mips: Add safe-syscall.inc.S Richard Henderson
2021-11-17 16:31 ` Warner Losh
2021-11-17 16:04 ` [PATCH v5 06/17] common-user/host/sparc64: " Richard Henderson
2021-11-17 16:04 ` [PATCH v5 07/17] linux-user: Remove HAVE_SAFE_SYSCALL and hostdep.h Richard Henderson
2021-11-17 16:04 ` [PATCH v5 08/17] common-user: Adjust system call return on FreeBSD Richard Henderson
2021-11-17 16:44 ` Warner Losh
2021-11-17 16:04 ` [PATCH v5 09/17] *-user: Rename TARGET_ERESTARTSYS to QEMU_ERESTARTSYS Richard Henderson
2021-11-17 16:46 ` Warner Losh
2021-11-17 16:51 ` Philippe Mathieu-Daudé
2021-11-17 16:04 ` [PATCH v5 10/17] linux-user: Rename TARGET_QEMU_ESIGRETURN to QEMU_ESIGRETURN Richard Henderson
2021-11-17 17:01 ` Warner Losh
2021-11-17 16:04 ` [PATCH v5 11/17] bsd-user: Create special-errno.h Richard Henderson
2021-11-17 17:21 ` Warner Losh
2021-11-17 16:04 ` [PATCH v5 12/17] linux-user: " Richard Henderson
2021-11-17 17:21 ` Warner Losh
2021-11-17 16:04 ` [PATCH v5 13/17] meson: Add build infrastructure for common-user Richard Henderson
2021-11-17 17:22 ` Warner Losh
2021-11-17 16:04 ` [PATCH v5 14/17] common-user: Move safe-syscall.* from linux-user Richard Henderson
2021-11-17 17:23 ` Warner Losh
2021-11-17 16:04 ` [PATCH v5 15/17] linux-user: Move thunk.c from top-level Richard Henderson
2021-11-17 16:52 ` Philippe Mathieu-Daudé
2021-11-17 17:27 ` Warner Losh
2021-11-17 16:04 ` [PATCH v5 16/17] meson: Move linux_user_ss to linux-user/ Richard Henderson
2021-11-17 16:56 ` Philippe Mathieu-Daudé
2021-11-17 17:04 ` Richard Henderson
2021-11-17 17:11 ` Philippe Mathieu-Daudé
2021-11-17 17:31 ` Warner Losh
2021-11-17 16:04 ` [PATCH v5 17/17] meson: Move bsd_user_ss to bsd-user/ Richard Henderson
2021-11-17 16:56 ` Philippe Mathieu-Daudé
2021-11-17 17:29 ` Warner Losh
2021-11-17 17:42 ` [PATCH v5 00/17] linux-user: simplify safe signal handling Warner Losh
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=20211117160412.71563-1-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=imp@bsdimp.com \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.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 NNTP newsgroup(s).