|
From: Mark W. <ma...@so...> - 2021-10-12 21:27:33
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=970820852e542506dd7a4c722fecd73e34363fde commit 970820852e542506dd7a4c722fecd73e34363fde Author: Mark Wielaard <ma...@kl...> Date: Tue Oct 12 23:25:32 2021 +0200 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: --- coregrind/vgdb-invoker-ptrace.c | 4 ++++ 1 file changed, 4 insertions(+) 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); |