]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
vgdb: only queue up to 64 pending signals when waiting for SIGSTOP
authorMark Wielaard <mark@klomp.org>
Tue, 12 Oct 2021 21:25:32 +0000 (23:25 +0200)
committerMark Wielaard <mark@klomp.org>
Tue, 12 Oct 2021 21:25:40 +0000 (23:25 +0200)
We should not queue infinite pending signals so we won't run out of
memory when the SIGSTOP never arrives.

coregrind/vgdb-invoker-ptrace.c

index 389748960f14d34fd4b05f1eaa49eeb5e38f05aa..07f3400f957c152bd95740375a270d6d6609c6b6 100644 (file)
@@ -300,6 +300,10 @@ Bool waitstopped (pid_t pid, int signal_expected, const char *msg)
 
          // realloc a bigger queue, and store new signal at the end.
          // This is not very efficient but we assume not many sigs are queued.
+         if (signal_queue_sz >= 64) {
+            DEBUG(0, "too many queued signals while waiting for SIGSTOP\n");
+            return False;
+         }
          signal_queue_sz++;
          signal_queue = vrealloc(signal_queue,
                                  sizeof(siginfo_t) * signal_queue_sz);