mbox series

[v7,00/15] linux-user: simplify safe signal handling

Message ID 20211214002604.161983-1-richard.henderson@linaro.org
Headers show
Series linux-user: simplify safe signal handling | expand

Message

Richard Henderson Dec. 14, 2021, 12:25 a.m. UTC
Changes for v7:
  * Drop incorrect ppc64 "cleanup", which reminded me that we
    need to select a non-syscall-clobbered register.  So that
    meant changes to the mips edition.

Changes for v6:
  * Re-order patches so that the move to common happens after
    all of the changes to linux-user.  Seems less confusing
    this way.  As a consequence, the meson.build changes for
    common-user have to happen at the same time, lest we get
    meson configure errors for missing directories.
  * Use a helper, safe_syscall_set_errno_tail, to set errno
    instead of passing in &errno to safe_syscall_base.
    This avoids the aligned register pairs problem that Peter
    mentioned, as well as being more efficient in the common
    case of syscall success.  As a consequence, some R-B have
    been dropped.
  * New untabify patch (peter).
  * PPC64 cleanup split out of larger change.

For convenience the tree is at

  https://gitlab.com/rth7680/qemu/-/tree/lu-safesignal

Xuerui, if you could rebase your tcg/loongarch work on
top of this, I'd like to get both series in early in the
next development cycle.


r~


Richard Henderson (15):
  linux-user: Untabify all safe-syscall.inc.S
  linux-user: Move syscall error detection into safe_syscall_base
  linux-user/host/mips: Add safe-syscall.inc.S
  linux-user/host/sparc64: Add safe-syscall.inc.S
  linux-user: Remove HAVE_SAFE_SYSCALL and hostdep.h
  linux-user: Rename TARGET_ERESTARTSYS to QEMU_ERESTARTSYS
  bsd-user: Rename TARGET_ERESTARTSYS to QEMU_ERESTARTSYS
  linux-user: Rename TARGET_QEMU_ESIGRETURN to QEMU_ESIGRETURN
  linux-user: Create special-errno.h
  bsd-user: Create special-errno.h
  common-user: Move safe-syscall.* from linux-user
  common-user: Adjust system call return on FreeBSD
  linux-user: Move thunk.c from top-level
  meson: Move linux_user_ss to linux-user/
  meson: Move bsd_user_ss to bsd-user/

 meson.build                                   |  23 ++-
 bsd-user/errno_defs.h                         |   6 +-
 bsd-user/special-errno.h                      |  24 +++
 {linux-user => include/user}/safe-syscall.h   |  37 ++---
 linux-user/cpu_loop-common.h                  |   1 +
 linux-user/generic/target_errno_defs.h        |  17 --
 linux-user/host/aarch64/hostdep.h             |  18 ---
 linux-user/host/arm/hostdep.h                 |  18 ---
 linux-user/host/i386/hostdep.h                |  18 ---
 linux-user/host/ia64/hostdep.h                |  15 --
 linux-user/host/mips/hostdep.h                |  15 --
 linux-user/host/ppc/hostdep.h                 |  15 --
 linux-user/host/ppc64/hostdep.h               |  18 ---
 linux-user/host/riscv/hostdep.h               |  14 --
 linux-user/host/s390/hostdep.h                |  15 --
 linux-user/host/s390x/hostdep.h               |  18 ---
 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/hostdep.h              |  18 ---
 linux-user/signal-common.h                    |   4 +-
 linux-user/special-errno.h                    |  32 ++++
 linux-user/user-internals.h                   |   1 -
 common-user/safe-syscall-error.c              |  25 +++
 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                           |  10 +-
 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 +-
 MAINTAINERS                                   |   3 +-
 bsd-user/meson.build                          |   6 +
 common-user/host/aarch64/safe-syscall.inc.S   |  88 +++++++++++
 common-user/host/arm/safe-syscall.inc.S       | 108 +++++++++++++
 common-user/host/i386/safe-syscall.inc.S      | 126 +++++++++++++++
 common-user/host/mips/safe-syscall.inc.S      | 148 ++++++++++++++++++
 common-user/host/ppc64/safe-syscall.inc.S     |  94 +++++++++++
 common-user/host/riscv/safe-syscall.inc.S     |  79 ++++++++++
 common-user/host/s390x/safe-syscall.inc.S     |  98 ++++++++++++
 common-user/host/sparc64/safe-syscall.inc.S   |  89 +++++++++++
 .../host/x86_64/safe-syscall.inc.S            |  44 ++++--
 common-user/meson.build                       |   6 +
 {linux-user => common-user}/safe-syscall.S    |   5 +-
 linux-user/host/aarch64/safe-syscall.inc.S    |  75 ---------
 linux-user/host/arm/safe-syscall.inc.S        |  90 -----------
 linux-user/host/i386/safe-syscall.inc.S       | 100 ------------
 linux-user/host/ppc64/safe-syscall.inc.S      |  96 ------------
 linux-user/host/riscv/safe-syscall.inc.S      |  77 ---------
 linux-user/host/s390x/safe-syscall.inc.S      |  90 -----------
 linux-user/meson.build                        |   9 +-
 80 files changed, 1099 insertions(+), 932 deletions(-)
 create mode 100644 bsd-user/special-errno.h
 rename {linux-user => include/user}/safe-syscall.h (83%)
 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
 create mode 100644 common-user/safe-syscall-error.c
 rename thunk.c => linux-user/thunk.c (100%)
 create mode 100644 common-user/host/aarch64/safe-syscall.inc.S
 create mode 100644 common-user/host/arm/safe-syscall.inc.S
 create mode 100644 common-user/host/i386/safe-syscall.inc.S
 create mode 100644 common-user/host/mips/safe-syscall.inc.S
 create mode 100644 common-user/host/ppc64/safe-syscall.inc.S
 create mode 100644 common-user/host/riscv/safe-syscall.inc.S
 create mode 100644 common-user/host/s390x/safe-syscall.inc.S
 create mode 100644 common-user/host/sparc64/safe-syscall.inc.S
 rename {linux-user => common-user}/host/x86_64/safe-syscall.inc.S (81%)
 create mode 100644 common-user/meson.build
 rename {linux-user => common-user}/safe-syscall.S (91%)
 delete mode 100644 linux-user/host/aarch64/safe-syscall.inc.S
 delete mode 100644 linux-user/host/arm/safe-syscall.inc.S
 delete mode 100644 linux-user/host/i386/safe-syscall.inc.S
 delete mode 100644 linux-user/host/ppc64/safe-syscall.inc.S
 delete mode 100644 linux-user/host/riscv/safe-syscall.inc.S
 delete mode 100644 linux-user/host/s390x/safe-syscall.inc.S

Comments

WANG Xuerui Dec. 14, 2021, 8:05 a.m. UTC | #1
Hi Richard,

On 12/14/21 08:25, Richard Henderson wrote:
> For convenience the tree is at
>
>    https://gitlab.com/rth7680/qemu/-/tree/lu-safesignal
>
> Xuerui, if you could rebase your tcg/loongarch work on
> top of this, I'd like to get both series in early in the
> next development cycle.
>
Thanks for the heads-up! I've just done this and sent v9.