Skip to content

bsd-user: upstream signal implementation

Warner Losh qemu-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest40 patches 3 repliesIn review
  2. v240 patches 31 repliesSuperseded
  3. v130 patches 74 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/40bsd-user: Complete FreeBSD siginfobsd-user/freebsd/target_os_siginfo.h+14 -10 replies
2/40bsd-user: Create setup_sigframe_arch to setup sigframe contextbsd-user/freebsd/target_os_signal.h bsd-user/i386/signal.c bsd-user/x86_64/signal.c+29 -00 replies
3/40bsd-user/arm/signal.c: Implement setup_sigframe_arch for armbsd-user/arm/signal.c+33 -170 replies
4/40bsd-user/arm/signal.c: get_mcontext should zero vfp databsd-user/arm/signal.c+9 -00 replies
5/40bsd-user: Remove vestiges of signal queueing codebsd-user/main.c bsd-user/qemu.h+2 -200 replies
6/40bsd-user: Bring in docs from linux-user for signal_pendingbsd-user/qemu.h+8 -10 replies
7/40bsd-user/arm/target_arch_cpu.h: Move EXCP_ATOMIC to match linux-userbsd-user/arm/target_arch_cpu.h+3 -30 replies
8/40bsd-user/signal.c: implement force_sig_faultbsd-user/signal-common.h bsd-user/signal.c+32 -00 replies
9/40bsd-user/signal-common.h: Move signal functions prototypes to herebsd-user/arm/target_arch_cpu.h bsd-user/i386/target_arch_cpu.h bsd-user/qemu.h +2 more+9 -80 replies
10/40bsd-user/signal.c: Implement cpu_loop_exit_sigsegvbsd-user/signal.c+12 -30 replies
11/40bsd-user/signal.c: implement cpu_loop_exit_sigbusbsd-user/signal.c+9 -30 replies
12/40bsd-user/arm/arget_arch_cpu.h: Move EXCP_DEBUG and EXCP_BKPT togetherbsd-user/arm/target_arch_cpu.h+2 -200 replies
13/40bsd-user/arm/target_arch_cpu.h: Correct code pointerbsd-user/arm/target_arch_cpu.h+1 -10 replies
14/40bsd-user/arm/target_arch_cpu.h: Use force_sig_fault for EXCP_UDEFbsd-user/arm/target_arch_cpu.h+13 -120 replies
15/40bsd-user/arm/target_arch_cpu.h: Implement data faultsbsd-user/arm/target_arch_cpu.h+35 -100 replies
16/40bsd-user/signal.c: implement abstract target / host signal translationbsd-user/signal-common.h bsd-user/signal.c+18 -00 replies
17/40bsd-user/signal.c: Implement signal_init()bsd-user/qemu.h bsd-user/signal.c+74 -00 replies
18/40bsd-user/signal.c: Add si_type argument to queue_signalbsd-user/signal-common.h bsd-user/signal.c+28 -30 replies
19/40bsd-user/host/arm/host-signal.h: Implement host_signal_*bsd-user/host/arm/host-signal.h+35 -00 replies
20/40bsd-user/host/i386/host-signal.h: Implement host_signal_*bsd-user/host/i386/host-signal.h+37 -00 replies
21/40bsd-user/host/x86_64/host-signal.h: Implement host_signal_*bsd-user/host/x86_64/host-signal.h+37 -00 replies
22/40bsd-user: Add host signals to the buildbsd-user/signal.c meson.build+2 -00 replies
23/40bsd-user: Add trace events for bsd-userbsd-user/signal.c bsd-user/trace-events bsd-user/trace.h +1 more+17 -10 replies
24/40bsd-user/signal.c: host_to_target_siginfo_noswapbsd-user/signal.c+113 -00 replies
25/40bsd-user/signal.c: Implement rewind_if_in_safe_syscallbsd-user/qemu.h bsd-user/signal.c+14 -10 replies
26/40bsd-user/signal.c: Implement host_signal_handlerbsd-user/signal.c+105 -00 replies
27/40bsd-user/strace.c: print_taken_signalbsd-user/qemu.h bsd-user/strace.c+107 -00 replies
28/40bsd-user/signal.c: Implement dump_core_and_abortbsd-user/signal.c bsd-user/syscall_defs.h+77 -00 replies
29/40bsd-user/signal.c: Fill in queue_signalbsd-user/qemu.h bsd-user/signal.c+17 -10 replies
30/40bsd-user/signal.c: sigset manipulation routines.bsd-user/signal-common.h bsd-user/signal.c+76 -00 replies
31/40bsd-user/signal.c: setup_framebsd-user/main.c bsd-user/qemu.h bsd-user/signal.c+90 -10 replies
32/40bsd-user/signal.c: handle_pending_signalbsd-user/qemu.h bsd-user/signal.c+94 -00 replies
33/40bsd-user/signal.c: tswap_siginfobsd-user/signal.c+53 -00 replies
34/40bsd-user/signal.c: process_pending_signalsbsd-user/signal.c+55 -10 replies
35/40bsd-user/signal.c: implement do_sigreturnbsd-user/signal-common.h bsd-user/signal.c+56 -11 reply
36/40bsd-user/signal.c: implement do_sigactionbsd-user/signal-common.h bsd-user/signal.c+105 -02 replies
37/40bsd-user/signal.c: do_sigaltstackbsd-user/signal.c+67 -50 replies
38/40MAINTAINERS: Add tests/vm/*bsd to the list to get reviews onMAINTAINERS+1 -00 replies
39/40bsd-user: Rename arg name for target_cpu_reset to envbsd-user/arm/target_arch_cpu.h bsd-user/i386/target_arch_cpu.h bsd-user/x86_64/target_arch_cpu.h+5 -50 replies
40/40bsd-user/freebsd/target_os_ucontext.h: Prefer env as arg name for CPUArchState argsbsd-user/freebsd/target_os_ucontext.h+3 -30 replies

Reviews trailers per patch

All 40 patches have a Reviewed-by or Acked-by.

PatchRichard HendersonPeter Maydell
1/40R-b
2/40R-b
3/40R-b
4/40R-b
5/40R-b
6/40R-b
7/40R-b R-b
8/40R-b R-b
9/40R-b
10/40R-b R-b
11/40R-b R-b
12/40R-b R-b
13/40R-b R-b
14/40R-b R-b
15/40R-b R-b
16/40R-b R-b
17/40R-b R-b
18/40R-b
19/40R-b
20/40R-b R-b
21/40R-b R-b
22/40R-b R-b
23/40R-b R-b
24/40R-b
25/40R-b R-b
26/40R-b
27/40R-b R-b
28/40R-b
29/40R-b
30/40R-b
31/40R-b
32/40R-b
33/40R-b
34/40R-b
35/40R-b
36/40R-b
37/40R-b
38/40R-b
39/40R-b
40/40R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 00/40] bsd-user: upstream signal implementation

Upstream the bsd-user fork signal implementation, for the most part. This series of commits represents nearly all of the infrastructure that surround signals, except the actual system call glue (that was also reworked in the fork and needs its own series). In addition, this adds the sigsegv and sigbus code to arm. Even in the fork, we don't have good x86 signal implementation, so there's little to upstream for that at the moment.

bsd-user's signal implementation is similar to linux-user's. The full context can be found in the bsd-user's fork's 'blitz branch' at
https://github.com/qemu-bsd-user/qemu-bsd-user/tree/blitz which shows how these are used to implement various system calls. Since this was built from linux-user's stack stuff, evolved for BSD with the passage of a few years, it no-doubt missed some bug fixes from linux-user (though nothing obvious stood out in the quick comparison I made). After the first round of reviews, many of these improvements have been incorporated.

All the patches have been reviewed by at least one person, except these hunks:
bsd-user/signal.c: implement do_sigaction
bsd-user/signal.c: implement do_sigreturn
though more eyes on any if these changes is quite welcome. All the patches have also been forward ported to the bsd-user 'blitz' branch and we now pass more tests there than we did before (though it's only back up to a similar number of tests to our ancient rebase-3.2 version).

New in version 3:

o Fixed do_sigcation to allow querying of SIGKILL or SIGSTOP.
o Fixed host/target confusion for do_sigaction return codes. Also added comments about why we use sigprocmask(2) instead of pthread_sigmask(3) since a question about this came up in review.
o For do_sigreturn, don't set the actual signal mask, but instead defer that to the main loop to avoid races with signals that are newly active, but blocked by the signal handler's signal mask and the main loop, as is done in linux-user.
o Fixed or added a number of comments based on review feedback for typos or todo items.
o bsd-user/signal-common.h: Move signal functions prototypes to here Move includes of signal-common.h to this patch hunk in */target_arch_cpu.h to fix compile issues.
o Also, rebased to current tip of master and fixed a minor conflict or two (which should get rid of the does not apply warning on patchew).

Patchew history: https://patchew.org/QEMU/[email protected]/

Warner Losh (40):
bsd-user: Complete FreeBSD siginfo
bsd-user: Create setup_sigframe_arch to setup sigframe context bsd-user/arm/signal.c: Implement setup_sigframe_arch for arm bsd-user/arm/signal.c: get_mcontext should zero vfp data
bsd-user: Remove vestiges of signal queueing code
bsd-user: Bring in docs from linux-user for signal_pending bsd-user/arm/target_arch_cpu.h: Move EXCP_ATOMIC to match linux-user bsd-user/signal.c: implement force_sig_fault bsd-user/signal-common.h: Move signal functions prototypes to here bsd-user/signal.c: Implement cpu_loop_exit_sigsegv bsd-user/signal.c: implement cpu_loop_exit_sigbus bsd-user/arm/arget_arch_cpu.h: Move EXCP_DEBUG and EXCP_BKPT together bsd-user/arm/target_arch_cpu.h: Correct code pointer bsd-user/arm/target_arch_cpu.h: Use force_sig_fault for EXCP_UDEF bsd-user/arm/target_arch_cpu.h: Implement data faults bsd-user/signal.c: implement abstract target / host signal translation bsd-user/signal.c: Implement signal_init() bsd-user/signal.c: Add si_type argument to queue_signal bsd-user/host/arm/host-signal.h: Implement host_signal_* bsd-user/host/i386/host-signal.h: Implement host_signal_* bsd-user/host/x86_64/host-signal.h: Implement host_signal_*
bsd-user: Add host signals to the build
bsd-user: Add trace events for bsd-user
bsd-user/signal.c: host_to_target_siginfo_noswap bsd-user/signal.c: Implement rewind_if_in_safe_syscall bsd-user/signal.c: Implement host_signal_handler bsd-user/strace.c: print_taken_signal
bsd-user/signal.c: Implement dump_core_and_abort bsd-user/signal.c: Fill in queue_signal
bsd-user/signal.c: sigset manipulation routines. bsd-user/signal.c: setup_frame
bsd-user/signal.c: handle_pending_signal bsd-user/signal.c: tswap_siginfo
bsd-user/signal.c: process_pending_signals bsd-user/signal.c: implement do_sigreturn bsd-user/signal.c: implement do_sigaction bsd-user/signal.c: do_sigaltstack
MAINTAINERS: Add tests/vm/*bsd to the list to get reviews on
bsd-user: Rename arg name for target_cpu_reset to env bsd-user/freebsd/target_os_ucontext.h: Prefer env as arg name for
CPUArchState args

 MAINTAINERS                           |    1 +
 bsd-user/arm/signal.c                 |   59 +-
 bsd-user/arm/target_arch_cpu.h        |  101 +--
 bsd-user/freebsd/target_os_siginfo.h  |   15 +-
 bsd-user/freebsd/target_os_signal.h   |    3 +
 bsd-user/freebsd/target_os_ucontext.h |    6 +-
 bsd-user/host/arm/host-signal.h       |   35 +
 bsd-user/host/i386/host-signal.h      |   37 +
 bsd-user/host/x86_64/host-signal.h    |   37 +
 bsd-user/i386/signal.c                |   13 +
 bsd-user/i386/target_arch_cpu.h       |    5 +-
 bsd-user/main.c                       |   14 +-
 bsd-user/qemu.h                       |   66 +-
 bsd-user/signal-common.h              |   70 ++
 bsd-user/signal.c                     | 1008 ++++++++++++++++++++++++-
 bsd-user/strace.c                     |   97 +++
 bsd-user/syscall_defs.h               |    1 +
 bsd-user/trace-events                 |   11 +
 bsd-user/trace.h                      |    1 +
 bsd-user/x86_64/signal.c              |   13 +
 bsd-user/x86_64/target_arch_cpu.h     |    5 +-
 meson.build                           |    6 +-
 22 files changed, 1490 insertions(+), 114 deletions(-)
 create mode 100644 bsd-user/host/arm/host-signal.h
 create mode 100644 bsd-user/host/i386/host-signal.h
 create mode 100644 bsd-user/host/x86_64/host-signal.h
 create mode 100644 bsd-user/signal-common.h
 create mode 100644 bsd-user/trace-events
 create mode 100644 bsd-user/trace.h
Signature · 1 line
2.33.1