Re: Stream I/O driver XXX_Close race condition?



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

.



Relevant Pages

  • i2c/ smbus question
    ... I2C_SMBUS_BLOCK_DATA properly (didn't send the lenght byte) and some ... drivers (our sound drivers) rely on that behaviour (that's fine, ... I'm a bit surprised that there seem to be no wrapper for writing with ...
    (Linux-Kernel)
  • Re: WERNER
    ... Getting some promise from a recruiter in writing isn;t going to do you much ... It's like getting your girfriend to promise sex 5 times per week ... can speak to enough current drivers to find out how they are being treated. ...
    (misc.transport.trucking)
  • Device for building USB host drivers
    ... I have tons of queries on writing a USB Flash drivers on Windows CE 5.0 ... for my school project. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Driver Development Books?
    ... > One of my security related books, Rootkits, tells me about how to write ... > drivers for a completely different reason so I know a bit more about how ... There are indeed no books that I know of on the subject of writing ... to dig into the kernel source code, look for appropriate manual pages, ...
    (freebsd-hackers)