Bug 406354 - dhat is broken on x86 (32bit)
Summary: dhat is broken on x86 (32bit)
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: dhat (other bugs)
Version First Reported In: 3.15 SVN
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-09 12:27 UTC by Mark Wielaard
Modified: 2019-04-10 15:10 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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