MCH Driver - Why no thread safety?

c++ / delphi package - dll injection and api hooking
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Re: MCH Driver - Why no thread safety?

Post by madshi »

You've missed a trick. I've moved the MatchStrArray calls into CheckDll() and CheckDll() executes inside a critical section and the first thing CheckDll() does is check if the dll in question is still in the list of active dll injection requests. Only then MatchStrArray is called. So MatchStrArray is only called if the dll in question wasn't freed yet. I believe this solution should be 100% thread safe.
EaSy
Posts: 150
Joined: Tue Oct 23, 2012 12:33 pm

Re: MCH Driver - Why no thread safety?

Post by EaSy »

Heh, I can see it now, i was looking at the old version of DriverEvents.c file. It looks safe now. Thx.
EaSy
Posts: 150
Joined: Tue Oct 23, 2012 12:33 pm

Re: MCH Driver - Why no thread safety?

Post by EaSy »

We checked your latest beta build and there are 3 major issues with driver that need to be immediately addressed:

1) -stopDisallowed causing driver to throw an error 31 on "SC start xxx", other values (safeStopAllowed, unsafeStopAllowed) work fine
2) there are BSODs during system turn off and restart (file attached)
3) i personally encoutered a deadlock during "_ZwUnloadDriver@4" call located in StopInjectionDriver function

Also, please allow upload of .dmp files, thx.

Thanks
PP
Attachments
Mini031113-01.rar
(17.08 KiB) Downloaded 310 times
EaSy
Posts: 150
Joined: Tue Oct 23, 2012 12:33 pm

Re: MCH Driver - Why no thread safety?

Post by EaSy »

On the bright side, my stress test shows no more BSODs in injection routine.
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Re: MCH Driver - Why no thread safety?

Post by madshi »

On a quick check I couldn't find a way to define which extensions can be attached to the forum and which not.

I've found the reason for the deadlock and I've fixed it. However, I can't seem to reproduce the BSODs. Unfortunately debugging the minidump you uploaded didn't help me too much cause I don't have matching pdb files for the drivers the minidump was created with, anymore. Could you please drop me an email (madshi (at) gmail)? Then I'll send you new drivers (with the deadlock fix) with matching pdb files for BSOD testing.

Looking into "-stopDisallowed" now.
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Re: MCH Driver - Why no thread safety?

Post by madshi »

Here's a new build which should fix the deadlock and the -stopDisallowed problems:

http://madshi.net/madCollectionBeta.exe (2.7.4.16)

There are no debug symbols for the driver, though. So for BSOD testing please use the drivers I sent you via email. Thanks!
Post Reply