From 5ff8c992aba475f4c4d93b9d022e878e388b6a96 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 5 Apr 2024 15:23:32 +0200 Subject: [PATCH] Don't call vg_assert inside sync_signalhandler_from_kernel Calling vg_assert inside a core signal handler will mess up the core backtrace. Making it even harder to find bugs in the core. --- coregrind/m_signals.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c index 5977e3857..cd3128d2b 100644 --- a/coregrind/m_signals.c +++ b/coregrind/m_signals.c @@ -2922,9 +2922,11 @@ void sync_signalhandler_from_kernel ( ThreadId tid, if (0) VG_(kill_self)(sigNo); /* generate a core dump */ - //if (tid == 0) /* could happen after everyone has exited */ - // tid = VG_(master_tid); - vg_assert(tid != 0); + /* tid == 0 could happen after everyone has exited, which indicates + a bug in the core (cleanup) code. Don't assert tid must be valid, + that will mess up the valgrind core backtrace if it fails, coming + from the signal handler. */ + // vg_assert(tid != 0); UnwindStartRegs startRegs; VG_(memset)(&startRegs, 0, sizeof(startRegs)); -- 2.47.2