From 7c733ecff6373624103577cd883ac0776262d5fb Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 17 Nov 2004 00:02:04 +0000 Subject: [PATCH] Change VG_(nuke_all_threads) to disassociate the the stacks of the threads being killed from the threads rather than marking them as inaccessible. This should fix the problem with the environment (and other data from the stacks of other threads) causing warnings after a fork. I believe that VG_(nuke_all_threads) is only called in places where this is the behaviour that we want or where it doesn't matter because we're about to exit anyway. MERGE TO STABLE git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_2_2_0_BRANCH@3033 --- coregrind/vg_scheduler.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/coregrind/vg_scheduler.c b/coregrind/vg_scheduler.c index 733f4845fb..285502a254 100644 --- a/coregrind/vg_scheduler.c +++ b/coregrind/vg_scheduler.c @@ -1420,9 +1420,12 @@ void cleanup_after_thread_exited ( ThreadId tid, Bool forcekill ) { vg_assert(is_valid_or_empty_tid(tid)); vg_assert(VG_(threads)[tid].status == VgTs_Empty); + /* Its stack is now off-limits */ - VG_TRACK( die_mem_stack, VG_(threads)[tid].stack_base, - VG_(threads)[tid].stack_size ); + if (VG_(threads)[tid].stack_base) { + VG_TRACK( die_mem_stack, VG_(threads)[tid].stack_base, + VG_(threads)[tid].stack_size ); + } /* Deallocate its LDT, if it ever had one. */ VG_(deallocate_LDT_for_thread)( VG_(threads)[tid].ldt ); @@ -1519,6 +1522,8 @@ void VG_(nuke_all_threads_except) ( ThreadId me ) "VG_(nuke_all_threads_except): nuking tid %d\n", tid); VG_(proxy_delete)(tid, True); VG_(threads)[tid].status = VgTs_Empty; + VG_(threads)[tid].stack_base = (Addr)NULL; + VG_(threads)[tid].stack_size = 0; cleanup_after_thread_exited( tid, True ); } } -- 2.47.2