Re: Stream I/O driver XXX_Close race condition?
- From: "Mark Moeller" <markmo@xxxxxxxxxxxxxx>
- Date: 14 Jun 2005 23:31:56 -0700
You hit the nail on the head Charles. It's about writing robust
drivers and understanding vulnerabilities in the system.
I don't have an app that has this problem. I discovered it during a OS
code review while tutoring an engineer on writing drivers and dealing
with race conditions. However, the scenario is quite real that this
can occur in - shutting down a thread pending in a WaitCommEvent.
Using CloseHandle to force WaitCommEvent to exit is a typical case. In
the example I sited if the thread calling WaitCommEvent suspended just
before entry into the function it is completely legit to have
CloseHandle called before WaitCommEvent is even entered. The chance of
this occuring is largely dependent on thread priorities.
I've always used an internal handle table in my drivers so that even if
my driver was called back with a defunct handle my drivers would trap
this and return an error.
Understanding all these nuances of writing a CE driver is critical for
writing fault tolerant code and creating reliable systems.
Mark Moeller
Qualnetics
.
- Follow-Ups:
- Re: Stream I/O driver XXX_Close race condition?
- From: Steve Maillet \(eMVP\)
- Re: Stream I/O driver XXX_Close race condition?
- References:
- Stream I/O driver XXX_Close race condition?
- From: Mark Moeller
- Re: Stream I/O driver XXX_Close race condition?
- From: Bruce Eitman \(eMVP\)
- Re: Stream I/O driver XXX_Close race condition?
- From: Charles Peterson
- Stream I/O driver XXX_Close race condition?
- Prev by Date: Re: how to set register to tell device.exe to load my driver?
- Next by Date: Re: How to freeze the screen so the display driver does not refresh the screen?
- Previous by thread: Re: Stream I/O driver XXX_Close race condition?
- Next by thread: Re: Stream I/O driver XXX_Close race condition?
- Index(es):
Relevant Pages
|
|