ExAcquireResourceSharedLite() and APCs

Hi All,

When I use ExAcquireResourceSharedLite (, TRUE) running on
Windows XP Professional check build with SoftIce, I get the following
message:
EX: resource: APCs still enabled before resource

acquire !!!

After few such messages I get a blue screen with BugCheck 0x0000008E.

I tried to use KeEnterCriticalRegion() before acquiring the resource,
but then the computer gets stuck (rather than crushing).

I didn't see any documentation for this in the DDK.

Could anyone help on this...

Guy.

Guy,

IMHO KeEnterCriticalRegion does indeed help you to temporarily disable
(normal) APC’s. I think that the reason why the computer gets stuck when
you use KeEnterCriticalRegion, is because of the resource that you are
aqcuiring, and wether or not you release the resource before you enter
the file system. Oh, and you should call KeLeaveCriticalRegion ASAP, of
course.


Bartjan.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@hotmail.com
Sent: dinsdag 19 maart 2002 18:46
To: File Systems Developers
Subject: [ntfsd] ExAcquireResourceSharedLite() and APCs

Hi All,

When I use ExAcquireResourceSharedLite (, TRUE) running on
Windows XP Professional check build with SoftIce, I get the following
message:
EX: resource: APCs still enabled before resource

acquire !!!
>
> After few such messages I get a blue screen with BugCheck 0x0000008E.
>
> I tried to use KeEnterCriticalRegion() before acquiring the
> resource, but then the computer gets stuck (rather than crushing).
>
> I didn't see any documentation for this in the DDK.
>
> Could anyone help on this...
>
> Guy.
>
> ---
> You are currently subscribed to ntfsd as: xxxxx@zeelandnet.nl
> To unsubscribe send a blank email to %%email.unsub%%
>

Guy,

KeEnterCriticalRegion (or FsRtlEnterFileSystem) should be called PRIOR to
obtaining your first ERESOURCE and released AFTER releasing your last
ERESOURCE. Since KeEnterCriticalRegion will allow nesting, the safest
approach is to call KeEnterCriticalRegion before you acquire the ERESOURCE
and then release it AFTER you release the ERESOURCE.

Actually, the most prudent thing to do here is to always call
KeEnterCriticalRegion around the ownership of any dispatcher object because
this avoids re-entrancy via kernel mode APCs that could cause you to violate
your locking hierarcy which would lead to deadlocks.

If your computer “gets stuck” then you must determine what is causing your
deadlock. Try using the “!locks” command in the debugger to examine the
ERESOURCE locks in the system that have both owning and waiting threads for
them.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: xxxxx@hotmail.com [mailto:xxxxx@hotmail.com]
Sent: Tuesday, March 19, 2002 12:46 PM
To: File Systems Developers
Subject: [ntfsd] ExAcquireResourceSharedLite() and APCs

Hi All,

When I use ExAcquireResourceSharedLite (, TRUE) running on
Windows XP Professional check build with SoftIce, I get the following
message:
EX: resource: APCs still enabled before resource

acquire !!!

After few such messages I get a blue screen with BugCheck 0x0000008E.

I tried to use KeEnterCriticalRegion() before acquiring the resource,
but then the computer gets stuck (rather than crushing).

I didn't see any documentation for this in the DDK.

Could anyone help on this...

Guy.

---
You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to %%email.unsub%%

Thanks for your reply, Tony

I’m not sure I was fully understood.

I’m using KeEnterCriticalRegion before calling ExAcquireResourceSharedLite
(rather than ExAcquireResourceExclusiveLite). Is it ok ?

According to the DDK KeEnterCriticalRegion must be called prior
to calling ExAcquireResourceExclusiveLite and KeLeaveCriticalRegion
after ExReleaseResourceExclusiveLite.
However, there’s no reference to KeEnterCriticalRegion in
ExAcquireResourceSharedLite documentation. So i might be doing something
wrong.

Thanks,
Guy.

From: Tony Mason
>Reply-To: “File Systems Developers”
>To: “File Systems Developers”
>Subject: [ntfsd] RE: ExAcquireResourceSharedLite() and APCs
>Date: Tue, 19 Mar 2002 13:45:55 -0500
>
>Guy,
>
>KeEnterCriticalRegion (or FsRtlEnterFileSystem) should be called PRIOR to
>obtaining your first ERESOURCE and released AFTER releasing your last
>ERESOURCE. Since KeEnterCriticalRegion will allow nesting, the safest
>approach is to call KeEnterCriticalRegion before you acquire the ERESOURCE
>and then release it AFTER you release the ERESOURCE.
>
>Actually, the most prudent thing to do here is to always call
>KeEnterCriticalRegion around the ownership of any dispatcher object because
>this avoids re-entrancy via kernel mode APCs that could cause you to
>violate
>your locking hierarcy which would lead to deadlocks.
>
>If your computer “gets stuck” then you must determine what is causing your
>deadlock. Try using the “!locks” command in the debugger to examine the
>ERESOURCE locks in the system that have both owning and waiting threads for
>them.
>
>Regards,
>
>Tony
>
>Tony Mason
>Consulting Partner
>OSR Open Systems Resources, Inc.
>http://www.osr.com
>
>
>-----Original Message-----
>From: xxxxx@hotmail.com [mailto:xxxxx@hotmail.com]
>Sent: Tuesday, March 19, 2002 12:46 PM
>To: File Systems Developers
>Subject: [ntfsd] ExAcquireResourceSharedLite() and APCs
>
>Hi All,
>
>When I use ExAcquireResourceSharedLite (, TRUE) running on
>Windows XP Professional check build with SoftIce, I get the following
>message:
>EX: resource: APCs still enabled before resource acquire !!!
>
>After few such messages I get a blue screen with BugCheck 0x0000008E.
>
>I tried to use KeEnterCriticalRegion() before acquiring the resource,
>but then the computer gets stuck (rather than crushing).
>
>I didn’t see any documentation for this in the DDK.
>
>Could anyone help on this…
>
>Guy.
>
>—
>You are currently subscribed to ntfsd as: xxxxx@osr.com
>To unsubscribe send a blank email to %%email.unsub%%
>
>—
>You are currently subscribed to ntfsd as: xxxxx@hotmail.com
>To unsubscribe send a blank email to %%email.unsub%%

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail.
http://www.hotmail.com

Guy,

The rules apply to ExAcquireResourceSharedLite as well.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: Guy Gal [mailto:xxxxx@hotmail.com]
Sent: Wednesday, March 20, 2002 5:01 AM
To: File Systems Developers
Subject: [ntfsd] RE: ExAcquireResourceSharedLite() and APCs

Thanks for your reply, Tony

I’m not sure I was fully understood.

I’m using KeEnterCriticalRegion before calling ExAcquireResourceSharedLite
(rather than ExAcquireResourceExclusiveLite). Is it ok ?

According to the DDK KeEnterCriticalRegion must be called prior
to calling ExAcquireResourceExclusiveLite and KeLeaveCriticalRegion
after ExReleaseResourceExclusiveLite.
However, there’s no reference to KeEnterCriticalRegion in
ExAcquireResourceSharedLite documentation. So i might be doing something
wrong.

Thanks,
Guy.

From: Tony Mason
>Reply-To: “File Systems Developers”
>To: “File Systems Developers”
>Subject: [ntfsd] RE: ExAcquireResourceSharedLite() and APCs
>Date: Tue, 19 Mar 2002 13:45:55 -0500
>
>Guy,
>
>KeEnterCriticalRegion (or FsRtlEnterFileSystem) should be called PRIOR to
>obtaining your first ERESOURCE and released AFTER releasing your last
>ERESOURCE. Since KeEnterCriticalRegion will allow nesting, the safest
>approach is to call KeEnterCriticalRegion before you acquire the ERESOURCE
>and then release it AFTER you release the ERESOURCE.
>
>Actually, the most prudent thing to do here is to always call
>KeEnterCriticalRegion around the ownership of any dispatcher object because
>this avoids re-entrancy via kernel mode APCs that could cause you to
>violate
>your locking hierarcy which would lead to deadlocks.
>
>If your computer “gets stuck” then you must determine what is causing your
>deadlock. Try using the “!locks” command in the debugger to examine the
>ERESOURCE locks in the system that have both owning and waiting threads for
>them.
>
>Regards,
>
>Tony
>
>Tony Mason
>Consulting Partner
>OSR Open Systems Resources, Inc.
>http://www.osr.com
>
>
>-----Original Message-----
>From: xxxxx@hotmail.com [mailto:xxxxx@hotmail.com]
>Sent: Tuesday, March 19, 2002 12:46 PM
>To: File Systems Developers
>Subject: [ntfsd] ExAcquireResourceSharedLite() and APCs
>
>Hi All,
>
>When I use ExAcquireResourceSharedLite (, TRUE) running on
>Windows XP Professional check build with SoftIce, I get the following
>message:
>EX: resource: APCs still enabled before resource acquire !!!
>
>After few such messages I get a blue screen with BugCheck 0x0000008E.
>
>I tried to use KeEnterCriticalRegion() before acquiring the resource,
>but then the computer gets stuck (rather than crushing).
>
>I didn’t see any documentation for this in the DDK.
>
>Could anyone help on this…
>
>Guy.
>
>—
>You are currently subscribed to ntfsd as: xxxxx@osr.com
>To unsubscribe send a blank email to %%email.unsub%%
>
>—
>You are currently subscribed to ntfsd as: xxxxx@hotmail.com
>To unsubscribe send a blank email to %%email.unsub%%

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail.
http://www.hotmail.com


You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to %%email.unsub%%