"__guarded_by" SAL Notation?

I think most of us will agree that getting the locking/concurrency correct in a driver can be a major pain in the ass. It’s a PITA to test. It’s a PITA to find problems.

There have been a couple of very interesting papers published by Microsoft Research (MSR) about extending SAL notations and static analysis to support checking appropriate locking:

http://research.microsoft.com/pubs/70617/tr-2008-108.pdf
http://research.microsoft.com/pubs/70601/tr-2008-91.pdf

Both of these describe a new SAL notation “__guarded_by”

Now, I admit it: I’ve not been a big supporter of SAL notations. I think they’re ugly, make my otherwise gorgeous code hard to read, and tend to catch the types of errors that generate more false positives than assistance.

But, if “__guarded_by” would actually work for kernel mode drivers, and PFD would support this notation, well, well… I might actually become a serious SAL notation supporter (which would be bad news for everyone at OSR, because we’d have to add SAL notation to all our code and THAT would be one of the most annoying things ever).

I therefore have two questions:

a) To the community: What do you think… Does this sound worthwhile? Would you happily use SAL notations to check the locking in your drivers, assuming PFD supported this (and it worked)?

b) To our Softie Colleagues: What’s the chance of this seeing the light of day in PFD in the WDK??

Peter
OSR

B) it is a work in progress, i do not know how much support is in the w7 wdk, but i think it is close to none. So with that said, i cannot tell you which wdk it will appear in, but when we know which wdk it will ship in, we will let you know as quickly as possible so that you can play with the bits and give us feedback

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@osr.com
Sent: Tuesday, August 25, 2009 7:24 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] “__guarded_by” SAL Notation?

I think most of us will agree that getting the locking/concurrency correct in a driver can be a major pain in the ass. It’s a PITA to test. It’s a PITA to find problems.

There have been a couple of very interesting papers published by Microsoft Research (MSR) about extending SAL notations and static analysis to support checking appropriate locking:

http://research.microsoft.com/pubs/70617/tr-2008-108.pdf
http://research.microsoft.com/pubs/70601/tr-2008-91.pdf

Both of these describe a new SAL notation “__guarded_by”

Now, I admit it: I’ve not been a big supporter of SAL notations. I think they’re ugly, make my otherwise gorgeous code hard to read, and tend to catch the types of errors that generate more false positives than assistance.

But, if “__guarded_by” would actually work for kernel mode drivers, and PFD would support this notation, well, well… I might actually become a serious SAL notation supporter (which would be bad news for everyone at OSR, because we’d have to add SAL notation to all our code and THAT would be one of the most annoying things ever).

I therefore have two questions:

a) To the community: What do you think… Does this sound worthwhile? Would you happily use SAL notations to check the locking in your drivers, assuming PFD supported this (and it worked)?

b) To our Softie Colleagues: What’s the chance of this seeing the light of day in PFD in the WDK??

Peter
OSR


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I having just gone through this PITA I would certainly give it
consideration.

A similar thought concerns reference counted protected “thinks” in general.
I really like the KMDF reference-counted memory-related architecture, but
can’t really use it in my own drivers. It seems to add reference counts to
objects and their parents in a systematic way, and the Cleanup and Destroy
callbacks are handy.

In addition, when I look at various code I see a million different ways that
reference counting is implemented. Often MACROs of various designs with
similar objectives and other schemes. All “home-brewed” - although some with
loving care over years of experience.

Couldn’t a fairly general-purpose protected reference-counted facility be
added to the kernel?

Think along the lines of CSQ. I don’t think there is “magic” in CSQ that
isn’t described in the Windows Platform Design Notes and elsewhere; just a
pain to get right if one makes a single typo. Have some tracking features
that would be enabled under DEBUG.

Something like “Reference Counted Protected Resource Accessor” (RCPRA).

Somebody brighter than myself might give this some thought…

Thomas F. Divine

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@osr.com
Sent: Tuesday, August 25, 2009 10:24 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] “__guarded_by” SAL Notation?

I think most of us will agree that getting the locking/concurrency correct
in a driver can be a major pain in the ass. It’s a PITA to test. It’s a
PITA to find problems.

There have been a couple of very interesting papers published by Microsoft
Research (MSR) about extending SAL notations and static analysis to support
checking appropriate locking:

http://research.microsoft.com/pubs/70617/tr-2008-108.pdf
http://research.microsoft.com/pubs/70601/tr-2008-91.pdf

Both of these describe a new SAL notation “__guarded_by”

Now, I admit it: I’ve not been a big supporter of SAL notations. I think
they’re ugly, make my otherwise gorgeous code hard to read, and tend to
catch the types of errors that generate more false positives than
assistance.

But, if “__guarded_by” would actually work for kernel mode drivers, and PFD
would support this notation, well, well… I might actually become a serious
SAL notation supporter (which would be bad news for everyone at OSR, because
we’d have to add SAL notation to all our code and THAT would be one of the
most annoying things ever).

I therefore have two questions:

a) To the community: What do you think… Does this sound worthwhile?
Would you happily use SAL notations to check the locking in your drivers,
assuming PFD supported this (and it worked)?

b) To our Softie Colleagues: What’s the chance of this seeing the light of
day in PFD in the WDK??

Peter
OSR


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

I’m still grumbly over my recent bad experiences trying to integrate
the WIN7 WDK into a production build environment with the annoying and
unconfigurable OACR. I now have a permanently red-faced widget on my
desktop for no good reason. I take back anything good I ever said
about it.

Yes a *working* prefast lock checking mechanism would help.

“play with the bits and give us feedback” - (from a post that
technically follows this one) - we do that, we did that, but there
doesn’t appear to be a lot of effect - the feedback goes in and then
disappears into a black hole somewhere.

Sorry, more grumpy than usual.

Mark Roddy

On Tue, Aug 25, 2009 at 10:24 AM, wrote:
> I think most of us will agree that getting the locking/concurrency correct in a driver can be a major pain in the ass. ?It’s a PITA to test. ?It’s a PITA to find problems.
>
> There have been a couple of very interesting papers published by Microsoft Research (MSR) about extending SAL notations and static analysis to support checking appropriate locking:
>
> http://research.microsoft.com/pubs/70617/tr-2008-108.pdf
> http://research.microsoft.com/pubs/70601/tr-2008-91.pdf
>
> Both of these describe a new SAL notation " guarded_by"
>
> Now, I admit it: I’ve not been a big supporter of SAL notations. ?I think they’re ugly, make my otherwise gorgeous code hard to read, and tend to catch the types of errors that generate more false positives than assistance.
>
> But, if "
guarded_by" would actually work for kernel mode drivers, and PFD would support this notation, well, well… I might actually become a serious SAL notation supporter (which would be bad news for everyone at OSR, because we’d have to add SAL notation to all our code and THAT would be one of the most annoying things ever).
>
> I therefore have two questions:
>
> a) To the community: What do you think… Does this sound worthwhile? ? Would you happily use SAL notations to check the locking in your drivers, assuming PFD supported this (and it worked)?
>
> b) To our Softie Colleagues: ?What’s the chance of this seeing the light of day in PFD in the WDK??
>
> Peter
> OSR
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>

Mark, I’ve never seen you grumpy, annoyed, but never grumpy!

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Tuesday, August 25, 2009 11:03 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] “__guarded_by” SAL Notation?

I’m still grumbly over my recent bad experiences trying to integrate
the WIN7 WDK into a production build environment with the annoying and
unconfigurable OACR. I now have a permanently red-faced widget on my
desktop for no good reason. I take back anything good I ever said
about it.

Yes a *working* prefast lock checking mechanism would help.

“play with the bits and give us feedback” - (from a post that
technically follows this one) - we do that, we did that, but there
doesn’t appear to be a lot of effect - the feedback goes in and then
disappears into a black hole somewhere.

Sorry, more grumpy than usual.

Mark Roddy

On Tue, Aug 25, 2009 at 10:24 AM, wrote:
> I think most of us will agree that getting the locking/concurrency correct in a driver can be a major pain in the ass. ?It’s a PITA to test. ?It’s a PITA to find problems.
>
> There have been a couple of very interesting papers published by Microsoft Research (MSR) about extending SAL notations and static analysis to support checking appropriate locking:
>
> http://research.microsoft.com/pubs/70617/tr-2008-108.pdf
> http://research.microsoft.com/pubs/70601/tr-2008-91.pdf
>
> Both of these describe a new SAL notation " guarded_by"
>
> Now, I admit it: I’ve not been a big supporter of SAL notations. ?I think they’re ugly, make my otherwise gorgeous code hard to read, and tend to catch the types of errors that generate more false positives than assistance.
>
> But, if "
guarded_by" would actually work for kernel mode drivers, and PFD would support this notation, well, well… I might actually become a serious SAL notation supporter (which would be bad news for everyone at OSR, because we’d have to add SAL notation to all our code and THAT would be one of the most annoying things ever).
>
> I therefore have two questions:
>
> a) To the community: What do you think… Does this sound worthwhile? ? Would you happily use SAL notations to check the locking in your drivers, assuming PFD supported this (and it worked)?
>
> b) To our Softie Colleagues: ?What’s the chance of this seeing the light of day in PFD in the WDK??
>
> Peter
> OSR
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I’d like to see it.

mm

I removed myself from the Microsoft Beta years ago; feedback of the form
“the design is completely wrong and totally unusable” is not considered.
joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Tuesday, August 25, 2009 11:03 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] “__guarded_by” SAL Notation?

I’m still grumbly over my recent bad experiences trying to integrate
the WIN7 WDK into a production build environment with the annoying and
unconfigurable OACR. I now have a permanently red-faced widget on my
desktop for no good reason. I take back anything good I ever said
about it.

Yes a *working* prefast lock checking mechanism would help.

“play with the bits and give us feedback” - (from a post that
technically follows this one) - we do that, we did that, but there
doesn’t appear to be a lot of effect - the feedback goes in and then
disappears into a black hole somewhere.

Sorry, more grumpy than usual.

Mark Roddy

On Tue, Aug 25, 2009 at 10:24 AM, wrote:
> I think most of us will agree that getting the locking/concurrency =
correct
in a driver can be a major pain in the ass. =A0It’s a PITA to test. =
=A0It’s a
PITA to find problems.
>
> There have been a couple of very interesting papers published by =
Microsoft
Research (MSR) about extending SAL notations and static analysis to =
support
checking appropriate locking:
>
> http://research.microsoft.com/pubs/70617/tr-2008-108.pdf
> http://research.microsoft.com/pubs/70601/tr-2008-91.pdf
>
> Both of these describe a new SAL notation " guarded_by"
>
> Now, I admit it: I’ve not been a big supporter of SAL notations. =A0I =
think
they’re ugly, make my otherwise gorgeous code hard to read, and tend to
catch the types of errors that generate more false positives than
assistance.
>
> But, if "
guarded_by" would actually work for kernel mode drivers, =
and
PFD would support this notation, well, well… I might actually become a
serious SAL notation supporter (which would be bad news for everyone at =
OSR,
because we’d have to add SAL notation to all our code and THAT would be =
one
of the most annoying things ever).
>
> I therefore have two questions:
>
> a) To the community: What do you think… Does this sound worthwhile? =
=A0
Would you happily use SAL notations to check the locking in your =
drivers,
assuming PFD supported this (and it worked)?
>
> b) To our Softie Colleagues: =A0What’s the chance of this seeing the =
light
of day in PFD in the WDK??
>
> Peter
> OSR
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=3DListServer
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:=20
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=3DListServer

–=20
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Grumbly is when grumpy people are incessantly and obsessively
grumbling over some specific object of interest, for example OACR.

I am reading the OACR “documentation” here
http://msdn.microsoft.com/en-us/library/ee358838.aspx and starting to
understand (I think) that OACR has its own COMPLETELY SEPARATE filter
mechanism independent of anything one might use for a NORMAL prefast
build. The implication of which is that a production environment that
runs ‘prefast clean’ can have different results than what a developer
perceives from OACR on his or her desktop.

Mark Roddy

On Tue, Aug 25, 2009 at 11:56 AM, Mark Cariddi wrote:
> Mark, I’ve never seen you grumpy, annoyed, but never grumpy!
>
> -----Original Message-----
> From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
> Sent: Tuesday, August 25, 2009 11:03 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] “__guarded_by” SAL Notation?
>
> I’m still grumbly over my recent bad experiences trying to integrate
> the WIN7 WDK into a production build environment with the annoying and
> unconfigurable OACR. I ?now have a permanently red-faced widget on my
> desktop for no good reason. I take back anything good I ever said
> about it.
>
> Yes a working prefast lock checking mechanism would help.
>
> “play with the bits and give us feedback” - (from a post that
> technically follows this one) - we do that, we did that, but there
> doesn’t appear to be a lot of effect - the feedback goes in and then
> disappears into a black hole somewhere.
>
> Sorry, more grumpy than usual.
>
> Mark Roddy
>
>
>
> On Tue, Aug 25, 2009 at 10:24 AM, wrote:
>> I think most of us will agree that getting the locking/concurrency correct in a driver can be a major pain in the ass. ?It’s a PITA to test. ?It’s a PITA to find problems.
>>
>> There have been a couple of very interesting papers published by Microsoft Research (MSR) about extending SAL notations and static analysis to support checking appropriate locking:
>>
>> http://research.microsoft.com/pubs/70617/tr-2008-108.pdf
>> http://research.microsoft.com/pubs/70601/tr-2008-91.pdf
>>
>> Both of these describe a new SAL notation “__guarded_by”
>>
>> Now, I admit it: I’ve not been a big supporter of SAL notations. ?I think they’re ugly, make my otherwise gorgeous code hard to read, and tend to catch the types of errors that generate more false positives than assistance.
>>
>> But, if “__guarded_by” would actually work for kernel mode drivers, and PFD would support this notation, well, well… I might actually become a serious SAL notation supporter (which would be bad news for everyone at OSR, because we’d have to add SAL notation to all our code and THAT would be one of the most annoying things ever).
>>
>> I therefore have two questions:
>>
>> a) To the community: What do you think… Does this sound worthwhile? ? Would you happily use SAL notations to check the locking in your drivers, assuming PFD supported this (and it worked)?
>>
>> b) To our Softie Colleagues: ?What’s the chance of this seeing the light of day in PFD in the WDK??
>>
>> Peter
>> OSR
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>

Hmm. That is unfortunate. Presumably, these two systems will not exactly converge over time, either.

The PREfast viewer uses a different filter engine and filter description mechanism than OACR. The >entries in this section allow you to use the OACR style filters in the PREfast viewer.

That’s an interesting way of saying it. It would seem like it should say that OACR is different, and that the file should allow you to use PreFAST style filters in OACR.

mm

Well, Mr. Roddy, you just cleared up what had been a small mystery at OSR: Mark Cariddi was mentioning earlier today that OACR was generating warnings, but when he brought up the viewer he didn’t see anything.

It didn’t matter much, so he didn’t pursue it further… but this certainly sounds like it could have been caused by what you’re describing, no?

Peter
OSR

I am probably going to regret this, so let’s just put this in a form that is generic. Feedback like “this sucks,” “I hate this feature,” " the design is completely wrong and totally unusable" is a nice way to vent, but totally useless from the perspective of those who receive it. Instead, pretend that you are giving feedback in a code review. What would the dev who wrote the code do with “this sucks”. Absolutely nothing. But if you said “your code is broken because you are touching a field that should be guarded by a lock after dropping the lock”, that is much more actionable. If you give actionable (reasonably emotion free) feedback in the beta, at least for the wdk, its samples and its tools, I personally promise that the team is looking at it and evaluating it. We may end up not doing what you want (and hence your feeling that it is a black hole), but we do look at it and have lots of discussions around it

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Joseph M. Newcomer
Sent: Tuesday, August 25, 2009 8:55 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] “__guarded_by” SAL Notation?

I removed myself from the Microsoft Beta years ago; feedback of the form “the design is completely wrong and totally unusable” is not considered.
joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Tuesday, August 25, 2009 11:03 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] “__guarded_by” SAL Notation?

I’m still grumbly over my recent bad experiences trying to integrate the WIN7 WDK into a production build environment with the annoying and unconfigurable OACR. I now have a permanently red-faced widget on my desktop for no good reason. I take back anything good I ever said about it.

Yes a *working* prefast lock checking mechanism would help.

“play with the bits and give us feedback” - (from a post that technically follows this one) - we do that, we did that, but there doesn’t appear to be a lot of effect - the feedback goes in and then disappears into a black hole somewhere.

Sorry, more grumpy than usual.

Mark Roddy

On Tue, Aug 25, 2009 at 10:24 AM, wrote:
> I think most of us will agree that getting the locking/concurrency
> correct
in a driver can be a major pain in the ass. It’s a PITA to test. It’s a PITA to find problems.
>
> There have been a couple of very interesting papers published by
> Microsoft
Research (MSR) about extending SAL notations and static analysis to support checking appropriate locking:
>
> http://research.microsoft.com/pubs/70617/tr-2008-108.pdf
> http://research.microsoft.com/pubs/70601/tr-2008-91.pdf
>
> Both of these describe a new SAL notation " guarded_by"
>
> Now, I admit it: I’ve not been a big supporter of SAL notations. I
> think
they’re ugly, make my otherwise gorgeous code hard to read, and tend to catch the types of errors that generate more false positives than assistance.
>
> But, if "
guarded_by" would actually work for kernel mode drivers,
> and
PFD would support this notation, well, well… I might actually become a serious SAL notation supporter (which would be bad news for everyone at OSR, because we’d have to add SAL notation to all our code and THAT would be one of the most annoying things ever).
>
> I therefore have two questions:
>
> a) To the community: What do you think… Does this sound worthwhile?
Would you happily use SAL notations to check the locking in your drivers, assuming PFD supported this (and it worked)?
>
> b) To our Softie Colleagues: What’s the chance of this seeing the
> light
of day in PFD in the WDK??
>
> Peter
> OSR
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

With all due respect, that’s what you get if you break the way people have
been working for decades without supplying them source or documentation
about the changes and leave it up to them to sort it out. If you start
throwing red alert GUI screens at people when they run a CONSOLE
application, force them to change the way they work, ignore principles that
so far have always been respected everywhere, well… let’s be reasonable
and say that those are sure fire ways to set folks off. I would honestly say
that criticism here has been very mild and generally the Windows kernel
developers in this group have full respect for MS while being extremely
reluctant to give any type of negative criticism at all. My perception is
that this shows that RDF is unavoidable once you become part of the empire
and it affects even the most sensible people existing.

//Daniel

“Doron Holan” wrote in message
news:xxxxx@ntdev…
> I am probably going to regret this, so let’s just put this in a form that
> is generic. Feedback like “this sucks,” “I hate this feature,” " the
> design is completely wrong and totally unusable" is a nice way to vent,
> but totally useless from the perspective of those who receive it.
> Instead, pretend that you are giving feedback in a code review. What
> would the dev who wrote the code do with “this sucks”. Absolutely
> nothing. But if you said “your code is broken because you are touching a
> field that should be guarded by a lock after dropping the lock”, that is
> much more actionable. If you give actionable (reasonably emotion free)
> feedback in the beta, at least for the wdk, its samples and its tools, I
> personally promise that the team is looking at it and evaluating it. We
> may end up not doing what you want (and hence your feeling that it is a
> black hole), but we do look at it and have lots of discussions around it
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Joseph M. Newcomer
> Sent: Tuesday, August 25, 2009 8:55 AM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] “__guarded_by” SAL Notation?
>
> I removed myself from the Microsoft Beta years ago; feedback of the form
> “the design is completely wrong and totally unusable” is not considered.
> joe
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
> Sent: Tuesday, August 25, 2009 11:03 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] “__guarded_by” SAL Notation?
>
> I’m still grumbly over my recent bad experiences trying to integrate the
> WIN7 WDK into a production build environment with the annoying and
> unconfigurable OACR. I now have a permanently red-faced widget on my
> desktop for no good reason. I take back anything good I ever said about
> it.
>
> Yes a working prefast lock checking mechanism would help.
>
> “play with the bits and give us feedback” - (from a post that technically
> follows this one) - we do that, we did that, but there doesn’t appear to
> be a lot of effect - the feedback goes in and then disappears into a black
> hole somewhere.
>
> Sorry, more grumpy than usual.
>
> Mark Roddy
>
>
>
> On Tue, Aug 25, 2009 at 10:24 AM, wrote:
>> I think most of us will agree that getting the locking/concurrency
>> correct
> in a driver can be a major pain in the ass. It’s a PITA to test. It’s a
> PITA to find problems.
>>
>> There have been a couple of very interesting papers published by
>> Microsoft
> Research (MSR) about extending SAL notations and static analysis to
> support checking appropriate locking:
>>
>> http://research.microsoft.com/pubs/70617/tr-2008-108.pdf
>> http://research.microsoft.com/pubs/70601/tr-2008-91.pdf
>>
>> Both of these describe a new SAL notation " guarded_by"
>>
>> Now, I admit it: I’ve not been a big supporter of SAL notations. I
>> think
> they’re ugly, make my otherwise gorgeous code hard to read, and tend to
> catch the types of errors that generate more false positives than
> assistance.
>>
>> But, if "
guarded_by" would actually work for kernel mode drivers,
>> and
> PFD would support this notation, well, well… I might actually become a
> serious SAL notation supporter (which would be bad news for everyone at
> OSR, because we’d have to add SAL notation to all our code and THAT would
> be one of the most annoying things ever).
>>
>> I therefore have two questions:
>>
>> a) To the community: What do you think… Does this sound worthwhile?
> Would you happily use SAL notations to check the locking in your drivers,
> assuming PFD supported this (and it worked)?
>>
>> b) To our Softie Colleagues: What’s the chance of this seeing the
>> light
> of day in PFD in the WDK??
>>
>> Peter
>> OSR
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> –
> This message has been scanned for viruses and dangerous content by
> MailScanner, and is believed to be clean.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>

I was talking about giving back feedback in general, not specific to OACR. OACR went through the same set of reactions internally at msft for awhile, but devs here (in office, windows, and other groups) have come around to like and embrace it. Change is not necessarily bad, but the thought of departing from what you know and love can be more difficult to accept than the change itself. The point here is that (even for OACR) “this sucks”, while mild is not productive. “I don’t like it, I want me command line tool back” is much clearer in terms of what you want to see happen.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@resplendence.com
Sent: Tuesday, August 25, 2009 1:05 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] “__guarded_by” SAL Notation?

With all due respect, that’s what you get if you break the way people have been working for decades without supplying them source or documentation about the changes and leave it up to them to sort it out. If you start throwing red alert GUI screens at people when they run a CONSOLE application, force them to change the way they work, ignore principles that so far have always been respected everywhere, well… let’s be reasonable and say that those are sure fire ways to set folks off. I would honestly say that criticism here has been very mild and generally the Windows kernel developers in this group have full respect for MS while being extremely reluctant to give any type of negative criticism at all. My perception is that this shows that RDF is unavoidable once you become part of the empire and it affects even the most sensible people existing.

//Daniel

“Doron Holan” wrote in message news:xxxxx@ntdev…
> I am probably going to regret this, so let’s just put this in a form
> that is generic. Feedback like “this sucks,” “I hate this feature,” “
> the design is completely wrong and totally unusable” is a nice way to
> vent, but totally useless from the perspective of those who receive it.
> Instead, pretend that you are giving feedback in a code review. What
> would the dev who wrote the code do with “this sucks”. Absolutely
> nothing. But if you said “your code is broken because you are
> touching a field that should be guarded by a lock after dropping the
> lock”, that is much more actionable. If you give actionable
> (reasonably emotion free) feedback in the beta, at least for the wdk,
> its samples and its tools, I personally promise that the team is
> looking at it and evaluating it. We may end up not doing what you
> want (and hence your feeling that it is a black hole), but we do look
> at it and have lots of discussions around it
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Joseph M.
> Newcomer
> Sent: Tuesday, August 25, 2009 8:55 AM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] “__guarded_by” SAL Notation?
>
> I removed myself from the Microsoft Beta years ago; feedback of the
> form “the design is completely wrong and totally unusable” is not considered.
> joe
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
> Sent: Tuesday, August 25, 2009 11:03 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] “__guarded_by” SAL Notation?
>
> I’m still grumbly over my recent bad experiences trying to integrate
> the
> WIN7 WDK into a production build environment with the annoying and
> unconfigurable OACR. I now have a permanently red-faced widget on my
> desktop for no good reason. I take back anything good I ever said
> about it.
>
> Yes a working prefast lock checking mechanism would help.
>
> “play with the bits and give us feedback” - (from a post that
> technically follows this one) - we do that, we did that, but there
> doesn’t appear to be a lot of effect - the feedback goes in and then
> disappears into a black hole somewhere.
>
> Sorry, more grumpy than usual.
>
> Mark Roddy
>
>
>
> On Tue, Aug 25, 2009 at 10:24 AM, wrote:
>> I think most of us will agree that getting the locking/concurrency
>> correct
> in a driver can be a major pain in the ass. It’s a PITA to test.
> It’s a PITA to find problems.
>>
>> There have been a couple of very interesting papers published by
>> Microsoft
> Research (MSR) about extending SAL notations and static analysis to
> support checking appropriate locking:
>>
>> http://research.microsoft.com/pubs/70617/tr-2008-108.pdf
>> http://research.microsoft.com/pubs/70601/tr-2008-91.pdf
>>
>> Both of these describe a new SAL notation " guarded_by"
>>
>> Now, I admit it: I’ve not been a big supporter of SAL notations. I
>> think
> they’re ugly, make my otherwise gorgeous code hard to read, and tend
> to catch the types of errors that generate more false positives than
> assistance.
>>
>> But, if "
guarded_by" would actually work for kernel mode drivers,
>> and
> PFD would support this notation, well, well… I might actually become
> a serious SAL notation supporter (which would be bad news for everyone
> at OSR, because we’d have to add SAL notation to all our code and THAT
> would be one of the most annoying things ever).
>>
>> I therefore have two questions:
>>
>> a) To the community: What do you think… Does this sound worthwhile?
> Would you happily use SAL notations to check the locking in your
> drivers, assuming PFD supported this (and it worked)?
>>
>> b) To our Softie Colleagues: What’s the chance of this seeing the
>> light
> of day in PFD in the WDK??
>>
>> Peter
>> OSR
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> –
> This message has been scanned for viruses and dangerous content by
> MailScanner, and is believed to be clean.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I agree that ‘this sucks’ is not helpful. I rather doubt that this is
the actual sum of the feedback Joe provided, but I don’t know for
sure.

When OACR etc was sprung on us at the DDC we out here provided a lot
of feedback that was far more constructive and specific than ‘this
sucks’, even if that phrase may have popped up every now and then.
Don. There was a steady drip of “oh no, you really shouldn’t do it
this way” re how OACR works, what has to be done to modify its
behavior, where those modifications have to be done, etc. and yet the
RTM WDK has all the flaws, more or less, of what was demo’d at the
DDC. Too bad. Kind of frustrating for us out here. Now we are all
stuck trying to wedge this into existing build tools.

What hardly any of us have time for is in-depth use of beta level
build tools. Unless we work for a large enough or rich enough
corporation to fund somebody to go play with upcoming new tools, the
best we can do is take a peek and provide rather superficial feedback
before this stuff goes RTM. We aren’t even allowed, by license, to
distribute anything build with beta WDKs, so these tools do not go
into production environments until it is way too late to change them.
So another facet of the problem, in addition to and related to the
lack of perceived response to feedback, is that outside Redmond most
of the feedback is going to arrive long after everything inside
Redmond has been put in the vault.

Mark Roddy

On Tue, Aug 25, 2009 at 4:09 PM, Doron Holan wrote:
> I was talking about giving back feedback in general, not specific to OACR. ?OACR went through the same set of reactions internally at msft for awhile, but devs here (in office, windows, and other groups) have come around to like and embrace it. ?Change is not necessarily bad, but the thought of departing from what you know and love can be more difficult to accept than the change itself. ?The point here is that (even for OACR) “this sucks”, while mild is not productive. ?“I don’t like it, I want me command line tool back” is much clearer in terms of what you want to see happen.
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@resplendence.com
> Sent: Tuesday, August 25, 2009 1:05 PM
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] “__guarded_by” SAL Notation?
>
> With all due respect, that’s what you get if you break the way people have been working for decades without supplying them source or documentation about the changes and leave it up to them to sort it out. If you start throwing red alert GUI screens at people when they run a CONSOLE application, force them to change the way they work, ignore principles that so far have always been respected everywhere, well… let’s be reasonable and say that those are sure fire ways to set folks off. I would honestly say that criticism here has been very mild and generally the Windows kernel developers in this group have full respect for MS while being extremely reluctant to give any type of negative criticism at all. My perception is that this shows that RDF is unavoidable once you become part of the empire and it affects even the most sensible people existing.
>
> //Daniel
>
>
>
> “Doron Holan” wrote in message news:xxxxx@ntdev…
>> I am probably going to regret this, so let’s just put this in a form
>> that is generic. ?Feedback like “this sucks,” “I hate this feature,” “
>> the design is completely wrong and totally unusable” is a nice way to
>> vent, but totally useless from the perspective of those who receive it.
>> Instead, pretend that you are ?giving feedback in a code review. ?What
>> would the dev who wrote the code do with “this sucks”. ?Absolutely
>> nothing. ?But if you said “your code is broken because you are
>> touching a field that should be guarded by a lock after dropping the
>> lock”, that is much more actionable. If you give actionable
>> (reasonably emotion free) feedback in the beta, at least for the wdk,
>> its samples and its tools, I personally promise that the team is
>> looking at it and evaluating it. ?We may end up not doing what you
>> want (and hence your feeling that it is a black hole), but we do look
>> at it and have lots of discussions around it
>>
>> d
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Joseph M.
>> Newcomer
>> Sent: Tuesday, August 25, 2009 8:55 AM
>> To: Windows System Software Devs Interest List
>> Subject: RE: [ntdev] “__guarded_by” SAL Notation?
>>
>> I removed myself from the Microsoft Beta years ago; feedback of the
>> form “the design is completely wrong and totally unusable” is not considered.
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?joe
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
>> Sent: Tuesday, August 25, 2009 11:03 AM
>> To: Windows System Software Devs Interest List
>> Subject: Re: [ntdev] “__guarded_by” SAL Notation?
>>
>> I’m still grumbly over my recent bad experiences trying to integrate
>> the
>> WIN7 WDK into a production build environment with the annoying and
>> unconfigurable OACR. I ?now have a permanently red-faced widget on my
>> desktop for no good reason. I take back anything good I ever said
>> about it.
>>
>> Yes a working prefast lock checking mechanism would help.
>>
>> “play with the bits and give us feedback” - (from a post that
>> technically follows this one) - we do that, we did that, but there
>> doesn’t appear to be a lot of effect - the feedback goes in and then
>> disappears into a black hole somewhere.
>>
>> Sorry, more grumpy than usual.
>>
>> Mark Roddy
>>
>>
>>
>> On Tue, Aug 25, 2009 at 10:24 AM, wrote:
>>> I think most of us will agree that getting the locking/concurrency
>>> correct
>> in a driver can be a major pain in the ass. ?It’s a PITA to test.
>> It’s a PITA to find problems.
>>>
>>> There have been a couple of very interesting papers published by
>>> Microsoft
>> Research (MSR) about extending SAL notations and static analysis to
>> support checking appropriate locking:
>>>
>>> http://research.microsoft.com/pubs/70617/tr-2008-108.pdf
>>> http://research.microsoft.com/pubs/70601/tr-2008-91.pdf
>>>
>>> Both of these describe a new SAL notation “__guarded_by”
>>>
>>> Now, I admit it: I’ve not been a big supporter of SAL notations. ?I
>>> think
>> they’re ugly, make my otherwise gorgeous code hard to read, and tend
>> to catch the types of errors that generate more false positives than
>> assistance.
>>>
>>> But, if “__guarded_by” would actually work for kernel mode drivers,
>>> and
>> PFD would support this notation, well, well… I might actually become
>> a serious SAL notation supporter (which would be bad news for everyone
>> at OSR, because we’d have to add SAL notation to all our code and THAT
>> would be one of the most annoying things ever).
>>>
>>> I therefore have two questions:
>>>
>>> a) To the community: What do you think… Does this sound worthwhile?
>> Would you happily use SAL notations to check the locking in your
>> drivers, assuming PFD supported this (and it worked)?
>>>
>>> b) To our Softie Colleagues: ?What’s the chance of this seeing the
>>> light
>> of day in PFD in the WDK??
>>>
>>> Peter
>>> OSR
>>>
>>>
>>> —
>>> NTDEV is sponsored by OSR
>>>
>>> For our schedule of WDF, WDM, debugging and other seminars visit:
>>> http://www.osr.com/seminars
>>>
>>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>> –
>> This message has been scanned for viruses and dangerous content by
>> MailScanner, and is believed to be clean.
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>

(sigh) Sic transit gloria… another thread that I hoped would be useful dies an untimely and ignominious death…

I shoulda knowd betta,

Peter
OSR

> If you give actionable (reasonably emotion free) feedback in the beta

For me anyway, the emotional content of feedback can have meaning. I can
think of a specific piece of code I reviewed years ago that used 4k bytes of
stack space in a function that was called at DPC level. My feedback during a
code review was something like “I can’t prove this will ever crash, but my
gut feeling is using 4K of stack at DPC level is risky and feel concerned
about this code”. About a month later, a bug was found where during a
network packet indicate, a callback into a packet send routine happened,
consuming a large amount kernel stack, and this function was called, causing
a crash. Even though my emotions tend to be a somewhat noisy source of
information, lots of times they have given me extremely valuable insights
into software.

Perhaps if someone wants to give feedback that feels emotional, the emotion
is just a piece of information that some complex interaction may happen in
the code, and giving some specific examples that backs up the emotion would
be useful feedback.

An example, instead of “This code sucks”, feedback like “This code reminds
me of code that failed because of X, Y, and Z. I can’t prove it will fail
due to X, Y, and Z, but feel it needs more analysis to assure it’s ok”. I
wish every bug were just simple black and white, but unfortunately some are
more shades of grey. I know when reviewing code, I’ve often found bugs when
I’m able to shift my mindset, and consider the possibility that something
isn’t actually like I thought it was. Processors have this nasty habit of
doing exactly what they are told to do, not what our intent was. Every time
there is a buffer overrun, the programmer’s thinking was it could never
happen. Any process that makes your brain see reality more clearly will
likely improve the stability of code.

As a side note, some computer languages also have less ambiguity about
programmer intent vs. actual action. A quick example, if I write “a[12] =
6;” in C, there is absolutely no guarantee I didn’t just corrupt the memory
just after a, and an hour later that corrupted memory causes a crash. If I
write that same statement in say C#, I don’t believe there is any chance I
just corrupted memory, although I may have just received a compile or
run-time error. In C++, I could teach the compiler that a is something with
bounds, and it should generate code to check that a subscript access doesn’t
violate those bounds (it won’t be automatically guaranteed like in C#).

On the flip side, if you receive a bug report that says “This code sucks”,
it might be useful to ask, what about the code is causing that emotion. It’s
NOT a criticism of you personally, it’s more an inability of the
reviewer/user to articulate in clear words what the problem is, although
they know something seems wrong. I’m sure people doing user interface design
almost always get feedback of “This sucks” and need to interact with the
feedback source to understand the hidden meaning of “This sucks”, and break
it down into little actionable pieces. UI science has extensive tools to
actually figure out how to translate “it sucks” into actionable specific
understanding.

Explaining your personal experience that gives you the emotional response of
“This sucks” also can be useful. For example, if I just have ported 20,000
lines of Linux C code to Windows, and the first time I try to compile it get
an OACR message that my code has 6456 errors, my reaction often would be
“OACR sucks, big-time”. My response may be to then turn off OACR for a long
time, because it’s clearly not helping. Knowing my experience, and my
context of when I react with “OACR sucks” would help the OACR developers
understand that a bit more accurate description might be “If OACR finds
errors in 25% of my code, perhaps the developer knows already, and perhaps
OACR should shut up for a while, or perhaps give a single message like Dear
developer, I see you’re a bit overwhelmed with your new code, so we will
suppress OACR feedback until the error ratio drops below 3%”.

I personally think having automated code checking facilities is a terrific
thing. If I can feel more secure about the lock correctness of some code by
adding “__guarded_by” annotations, that’s a good thing. An important issue
is: can I trust my effort of adding annotations will be justified in better
code. That’s where the “feel more secure” part comes from. If I trust
prefast to improve things in exchange for my work, I’m signed up. To gain
trust in prefast’s ability to check lock correctness (and every other kind
of correctness) some sample cases I can look at and run would be very
helpful. Trust has to be earned, and is not just always assumed (I guess
that’s why I’m a computer scientist and not a priest). Finding errors in MY
code is one way prefast earns my trust, but having it’s abilities and
weaknesses demonstrated in samples would also improve my trust. So, dear
Microsoft prefast team, I would trust prefast more if you could supply a
bunch of samples that demonstrate errors it can find (that the compiler
can’t), like under “tools\education\prefast samples”. It would also help to
have info on what kinds of errors it can’t find, so I know where to focus my
effort during code reviews.

Just an opinion…

Jan

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4367 (20090825) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com