Closed steve-offutt closed 4 years ago
I cannot share the EVTX that triggered this race detector. However, after some testing it appears in my experience that the race detector is triggered on larger files ~50MB or larger. I just tried running some of the EVTX located here: https://github.com/sbousseaden/EVTX-ATTACK-SAMPLES.git and none seem to trigger it yet.
It appears that the race detector is triggering on the global lastParsedElements
. The only place that this variable is being altered is within the function evtx/utils.go > UpdateLastElements()
According to the comments in globals.go
, lastParsedElements
is used for debug purposes. Is this still the case?
I can confirm that after commenting out the guts on the function UpdateLastElements()
the race detector is no longer triggered.
Hi @steve-offutt,
I am not going to fix this issue because if I do I will remove debugging capability in case of issue. Even though the race is present I don't think it is a big deal since it does not impact functionality of the library and tools. Probably you know it but I would not recommend you to compile with the -race option for everyday use because the tool performance is impacted a lot by the race detector.
Cheers,
Hi @steve-offutt,
I fixed the data race in a more appropriate way. I used a RWMutex as you suggested for the lastElement structure. Additionnaly, I introduced a debug flag for the parser for which the lastElement structure is updated and used only when the debug flag is set. As a conclusion setting and releasing the mutex does not slow down concurrency in normal circumstances.
Thanks for reporting the issue and have a nice day,
Thank you!
Build
evtxdump
with the following:Then attempt to dump any EVTX with
./evtxdump $EVTX_FILE