diff mbox series

[v4,07/10] linux-user: Remap SIGPROF when CONFIG_GPROF

Message ID 20230823051615.1297706-8-richard.henderson@linaro.org
State New
Headers show
Series linux-user: Detect and report host crashes | expand

Commit Message

Richard Henderson Aug. 23, 2023, 5:16 a.m. UTC
Protect the host's use of SIGPROF by remapping TARGET_SIGPROF
to one of the RT signals.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/signal.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/linux-user/signal.c b/linux-user/signal.c
index 9d16e3c8c5..b8913968cc 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -523,8 +523,15 @@  static void signal_table_init(void)
      * multiplexed over a single host signal.
      * Attempts for configure "missing" signals via sigaction will be
      * silently ignored.
+     *
+     * If the host is using gprof, treat SIGPROF the same way.
      */
-    for (hsig = SIGRTMIN; hsig <= SIGRTMAX; hsig++) {
+    hsig = SIGRTMIN;
+#ifdef CONFIG_GPROF
+    host_to_target_signal_table[SIGPROF] = 0;
+    host_to_target_signal_table[hsig++] = TARGET_SIGPROF;
+#endif
+    for (; hsig <= SIGRTMAX; hsig++) {
         tsig = hsig - SIGRTMIN + TARGET_SIGRTMIN;
         if (tsig <= TARGET_NSIG) {
             host_to_target_signal_table[hsig] = tsig;