Bug 406354

Summary: dhat is broken on x86 (32bit)
Product: [Developer tools] valgrind Reporter: Mark Wielaard <mark>
Component: dhatAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 3.15 SVN   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Mark Wielaard 2019-04-09 12:27:45 UTC
dhat will crash on x86 (32bit) because it doesn't handle Vg_CoreClientReq in its track_post_mem_write.

dh_handle_noninsn_write will be called with Vg_CoreClientReq during shutdown when trying to setup an argument for the freeres_wrapper(). On other architectures this will be done through a register, but on x86 we setup the argument on the stack. See final_tidyup () in coregrind/m_main.c.

Proposed fix. Just handle it like a syscall memory argument write:

diff --git a/dhat/dh_main.c b/dhat/dh_main.c
index 47a9327bd..a93332884 100644
--- a/dhat/dh_main.c
+++ b/dhat/dh_main.c
@@ -794,6 +794,7 @@ void dh_handle_noninsn_write ( CorePart part, ThreadId tid,
 {
    switch (part) {
       case Vg_CoreSysCall:
+      case Vg_CoreClientReq:
          dh_handle_write(base, size);
          break;
       case Vg_CoreSignal:
Comment 1 Mark Wielaard 2019-04-10 15:10:19 UTC
commit 4960f47c7dc39032a216c41b991dd138b91e5e5d
Author: Mark Wielaard <mark@klomp.org>
Date:   Wed Apr 10 01:22:37 2019 +0200

    dhat is broken on x86 (32bit)
    
    dhat will crash on x86 (32bit) because it doesn't handle Vg_CoreClientReq
    in its track_post_mem_write.
    
    dh_handle_noninsn_write will be called with Vg_CoreClientReq during
    shutdown when trying to setup an argument for the freeres_wrapper().
    On other architectures this will be done through a register, but on
    x86 we setup the argument on the stack. See final_tidyup () in
    coregrind/m_main.c.
    
    Just handle it like a syscall memory argument write.
    
    https://bugs.kde.org/show_bug.cgi?id=406354