From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: laurent@vivier.eu, imp@bsdimp.com
Subject: [PATCH v4 0/9] linux-user: simplify safe signal handling
Date: Tue, 16 Nov 2021 12:02:47 +0100 [thread overview]
Message-ID: <20211116110256.365484-1-richard.henderson@linaro.org> (raw)
Warner's v3:
https://patchew.org/QEMU/20211113045603.60391-1-imp@bsdimp.com/
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.
I'll note that this last patch will at present break bsd-user,
because TARGET_ERESTARTSYS and the header from whence it comes
is currently missing there.
In addition, I think that this should be reorganized further
so that TARGET_ERESTARTSYS is (1) renamed because in *this*
context it is pretending to be a host errno, and (2) placed
in a file of its own under include/user/. At which point,
meson.build could be simplified further so that safe-syscall.S
is compiled once, not per target.
Anyway, the final patch needs some bsd-user changes sorted first.
r~
Richard Henderson (4):
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
Warner Losh (5):
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
common-user: Move safe-syscall.* from *-user
meson.build | 9 +-
{linux-user => include/user}/safe-syscall.h | 31 ++--
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/user-internals.h | 1 -
linux-user/signal.c | 13 +-
linux-user/syscall.c | 2 +-
.../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 | 2 +
{linux-user => common-user}/safe-syscall.S | 3 -
linux-user/meson.build | 1 -
41 files changed, 585 insertions(+), 562 deletions(-)
rename {linux-user => include/user}/safe-syscall.h (85%)
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
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 (94%)
--
2.25.1
next reply other threads:[~2021-11-16 11:04 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-16 11:02 Richard Henderson [this message]
2021-11-16 11:02 ` [PATCH v4 1/9] linux-user: Add host_signal_set_pc to set pc in mcontext Richard Henderson
2021-11-16 11:02 ` [PATCH v4 2/9] linux-user/signal.c: Create a common rewind_if_in_safe_syscall Richard Henderson
2021-11-16 11:02 ` [PATCH v4 3/9] linux-user/safe-syscall.inc.S: Move to common-user Richard Henderson
2021-11-16 21:03 ` Warner Losh
2021-11-17 8:11 ` Philippe Mathieu-Daudé
2021-11-17 12:49 ` Richard Henderson
2021-11-17 16:09 ` Warner Losh
2021-11-17 16:20 ` Philippe Mathieu-Daudé
2021-11-16 11:02 ` [PATCH v4 4/9] common-user: Move syscall error detection into safe_syscall_base Richard Henderson
2021-11-16 11:02 ` [PATCH v4 5/9] common-user/host/mips: Add safe-syscall.inc.S Richard Henderson
2021-11-16 11:02 ` [PATCH v4 6/9] common-user/host/sparc64: " Richard Henderson
2021-11-16 11:02 ` [PATCH v4 7/9] linux-user: Remove HAVE_SAFE_SYSCALL and hostdep.h Richard Henderson
2021-11-17 8:22 ` Philippe Mathieu-Daudé
2021-11-17 15:58 ` Warner Losh
2021-11-16 11:02 ` [PATCH v4 8/9] common-user: Adjust system call return on FreeBSD Richard Henderson
2021-11-16 20:58 ` Warner Losh
2021-11-16 21:43 ` Richard Henderson
2021-11-17 8:23 ` Philippe Mathieu-Daudé
2021-11-17 8:32 ` Richard Henderson
2021-11-17 8:38 ` Philippe Mathieu-Daudé
2021-11-16 11:02 ` [PATCH v4 9/9] common-user: Move safe-syscall.* from *-user Richard Henderson
2021-11-16 21:10 ` [PATCH v4 0/9] 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=20211116110256.365484-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).