paulfloyd / freebsdarm64_valgrind

[UNMAINTAINED] Repo used during the development of Valgrind for FreeBSD arm64. The code has been merged upstream so I won't be maintaining this repo.
GNU General Public License v2.0
1 stars 0 forks source link

Failures in drd #7

Closed paulfloyd closed 7 months ago

paulfloyd commented 7 months ago

drd/tests/pth_barrier (stderr) drd/tests/pth_barrier2 (stderr) drd/tests/pth_barrier3 (stderr)

Not detecting any error.

I need to compare the output with amd64 using

--trace-conflict-set-bm=yes --trace-conflict-set=yes

Tried but the traces aren't easy to read. This looks hard to debug.

I tried compiling the TC with GCC, no change.

paulfloyd commented 7 months ago

I need to figure out a bit more what DRD is doing.

My understanding is that it creates 'segments' for each thread that runs between any kind of thread synchonization points (mutex, barrier, thread creation and destruction maybe more). The segment has a 'bitmap' which records the memory accesses. It also has a VectorClock which I think is used for sequential consistency.

The error message gts printed by drd_report_data_race. Not very helpful. From drd_tool_error_pp. Which is just a callback. Off into coregrind pp_Error.

One og VG_(show_lasterror) VG(show_allerrors) VG(uniqueerror) VG(maybe_record_error). I'm going to go for drd_report_race with a kind of DataRaceErr.

static VG_REGPARM(1) void drd_trace_store_1(Addr addr)

and that gets used from instrument_store


static VG_REGPARM(1) void drd_trace_store_1(Addr addr)
{
   if (DRD_(running_thread_is_recording_stores)()
       && (s_check_stack_accesses
           || ! DRD_(thread_address_on_stack)(addr))
       && bm_access_store_1_triggers_conflict(addr)
       && ! DRD_(is_suppressed)(addr, addr + 1))
   {
      drd_report_race(addr, 1, eStore);
   }
}

Lots of things to check there

Is the thread recording stores?

return (DRD_(gthreadinfo)[DRD(g_drd_running_tid)].synchrnesting == 0 && DRD(gthreadinfo)[DRD(g_drd_running_tid)].is_recording_stores); }

Do they both have a synchr_nesting of 0?

is_recording _stores _should_always be on (only gets turned off via client request or thread exit)

Does it think that it is on the stack??? Try --check-stack-var=yes

Does it think that it is suppressed? I don't think so -s said nothing.

That only leaves

static __inline__
Bool bm_access_store_1_triggers_conflict(const Addr a1)
{
   DRD_(bm_access_store_1)(DRD_(sg_bm)(DRD_(running_thread_get_segment)()), a1);
   return DRD_(bm_store_1_has_conflict_with)(DRD_(thread_get_conflict_set)(),
                                             a1);
}

Checking the bitmaps will be harder. Later.

Maybe try ENABLE_DRD_CONSISTENCY_CHECKS (check it works on amd64 first) Try --ptrace-addr= I think that it is always the same address

paulfloyd commented 7 months ago

This was due to an overzealous default suppression of pthread_create.