Archive for November, 2006

More on object lifetimes

Saturday, November 18th, 2006

In an earlier post, I described a subtle race condition resulting from the differing lifetimes of miniport adapters and control device objects. Last week, Gianluca Varenni, the maintainer of WinPcap and one of the brains at CACE technology, pointed out that Microsoft had recently changed the Passthru sample to add reference counting in some instances to adapter objects. I went back and looked, and sure enough, the current DDK WDK sample has additional reference counting built into the driver.

Microsoft didn’t add any comments to the sample describing the reference counting addition, but I found this bug myself a while ago and implemented essentially the same solution. The basic problem is that there is a race between the two different adapter tear-down paths – the one that is initiated from halting the virtual miniport itself and the other that is triggered by the halting of the underlying miniport.

Gianluca also pointed out that nobody in their right mind would write an IM driver from scratch, other than as an educational experience, because it’s entirely too difficult to get the various NDIS synchronization issues right unless you’re an absolute expert at it. Obviously, even Microsoft is still finding bugs.

The good news is that IM’s are dead. Vista has a much-improved lightweight filtering architecture, so the writing is no the wall.

EULA clarifications

Tuesday, November 14th, 2006

A big thanks to Johan Marien from Microsoft for addressing some of the recent licensing questions raised over the WDK samples’ EULA. According to Johan, the license restrictions on redistribution of WDK source were present in the SP1 DDK, and the samples.txt file was added to provide a mechanism for making certain source code redistributable in the future.

His post on NTFSD has all of the details, which I won’t repeat here. He also asks for feedback on which samples you would like to see made available for redistribution, so if you have a business need, it may be worth bringing it up with him. Otherwise, it looks like you shouldn’t distribute source code derived from WDK samples to customers, unless you have a separate agreement with Microsoft.

Check that EULA

Monday, November 13th, 2006

Tony Mason from OSR sent a mail to NTFSD today detailing his concerns about the RTM WDK’s newly improved EULA. I am not a lawyer, and neither is Tony, but it looks like source redistribution has been greatly restricted compared to previous kits. If you depend on samples in the kit, it looks like it would be a good idea to read the RTM EULA carefully (or better yet, send it to your lawyer).

Vista ships

Wednesday, November 8th, 2006

It had to happen eventually. :-) What’s it going to be like getting to ship actual production code with the WDK? I can’t wait to strip out all of the #ifdefs for the old kits…

Congrats to the team(s). Shipping is hard. Shipping something that big is really hard.

I think I voted

Tuesday, November 7th, 2006

Since I do not post political stuff on my blog, the following is (by definition) not political.

I voted today. I used one of those electronic machines. I talked to the election judge about it briefly.

Steve: Is there an option for a paper receipt in case the smart card doesn’t work?
Judge: No, but you’re welcome to use a paper ballot over there

(Steve notices cobwebs on the lonely paper voting station)

Steve: But most people seem to use the electronic machines. How do they know what votes are transferred to the cards?
Judge: We can tell at the end of the day; we get a printout.
Me: How can I tell that my vote is sent to the card correctly?
Judge: The computer tells you.
Me: But what if the computer makes a mistake? Computers crash sometimes, you know.
Judge (looking puzzled): I don’t think that’s supposed to happen.
Me: Why not print out a paper receipt? You get one from the ATM.
Judge: You should write that idea down on this little comment card and mail it in.

She didn’t seem convinced. I wonder if her mind will change if her party loses by a razor-thin margin, given the reports elsewhere of voting machine problems.

More: Ed Felton’s blog

Windows CE 6.0 released

Tuesday, November 7th, 2006

That other Microsoft OS seems to have launched last week. Not my area precisely, but it looks like there’s some interesting stuff there. Here’s another site with some interesting details.

…and the same thing goes for NdisInterlocked*()

Monday, November 6th, 2006

A few days ago I wrote about how to keep ExInterlocked*() operations interlocked. Well, the same thing goes for NDIS drivers.

NDIS documents a set of routines that look a whole lot like the ExInterlocked* routines:

#define NdisInterlockedInsertHeadList(...) \
    ExInterlockedInsertHeadList(...)

Unsurprisingly, the rule is the same: Once you use a given spin lock with any NdisInterlocked* function, it must always be used with an NdisInterlocked* function. If you missed the first article, you may want to re-read it for a more detailed explanation.

Not only is there no documentation of this on MSDN, but what documentation there is is wrong: it says that the functions raise to DISPATCH_LEVEL, but in reality, they raise to the highest IRQL in the system (at least when #define‘d to their ExInterlocked counterparts, which is whenever BINARY_COMPATIBLE is not defined).

The documentation also states that the NdisInterlocked* routines must be called from <= DISPATCH_LEVEL; this is probably wrong but I would encourage following the docs regardless unless/until Microsoft clarifies them.

Time to recertify

Monday, November 6th, 2006

Ever since I passed the CCIE lab back in 1999, I’ve done everything in my power to procrastinate the mandatory recertification exams. Never in my history with Cisco have I managed to re-certify early.

Well, it’s that time again, so I just scheduled my exam. The cost went up to $300 – for one 2-hour test! They’re not kidding around any more; I guess I should actually try to pass instead of my usual routine of going in cold and hoping for the best. :-)

I am not a phisherman

Monday, November 6th, 2006

The march of progress continues, and I keep pheeling safer and safer!

It turns out that something about my recent CSQ rules post triggered IE7’s automatic phishing philter. I know of no good reason that it would pick up that post (and only that post!) other than a couple of words in the title of the article it links to (about CONTAINING_RECORD), which I’m not going to repeat here phor phear of being philtered.

Anyway, apologies if you got a nasty warning phrom my site this weekend.

It only took a week!

Monday, November 6th, 2006

The Month of Kernel Bugs blog just posted their first Windows hole. They’ve hit several other major OSes already. This one looks like it’s related to Win32k. They claim arbitrary code execution, which makes it a local administrator privilege escalation.

The best part is that it was apparently reported two years ago.