From: Mark Wielaard Date: Tue, 12 Oct 2021 21:25:32 +0000 (+0200) Subject: vgdb: only queue up to 64 pending signals when waiting for SIGSTOP X-Git-Tag: VALGRIND_3_18_0~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=970820852e542506dd7a4c722fecd73e34363fde;p=thirdparty%2Fvalgrind.git vgdb: only queue up to 64 pending signals when waiting for SIGSTOP We should not queue infinite pending signals so we won't run out of memory when the SIGSTOP never arrives. --- diff --git a/coregrind/vgdb-invoker-ptrace.c b/coregrind/vgdb-invoker-ptrace.c index 389748960f..07f3400f95 100644 --- a/coregrind/vgdb-invoker-ptrace.c +++ b/coregrind/vgdb-invoker-ptrace.c @@ -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);