D1, {b5388508, 2, b5388508, 88dafb2c} what is the 3rd parameter???

Sorry Tim, but i am not getting what do you mean from “You are getting what
looks like a jump or call
into paged memory.” are you intend to say calling .

On Wed, Aug 5, 2009 at 9:56 PM, Tim Roberts wrote:

> Karthik Gurumurthy wrote:
> > I have a spin lock and after getting the lock i am calling a funcion
> > which is non paged in that function Rtlcopymemory is used.
> > Can this be the cause for this BSOD???
>
> Only if you are copying from paged memory, but it wouldn’t look like the
> crash you are seeing. You are getting what looks like a jump or call
> into paged memory.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> 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
>

Karthik Gurumurthy wrote:

ok, but how can i load symbols of ks.sys (kernel stream provided by
microsoft) or it is the way what skywing told(.symfix)

You need to have a path to the Microsoft symbol server in your symbol
path. That’s the step you are missing. There are many references on
the web saying how to do that. As an example, you could add this to
your symbol path:
SRV*c:\winddk\symbols*http://msdl.microsoft.com/download/symbols

That will put a local copy of the symbols in c:\winddk\symbols on your
hard disk.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Thanks Skywing, i ll go through the document once again.

Alex,
as you said both memory are likely to be non-recsident (what is the
best way to identify that???) and since IRQL is at DPC how can i do
RtlCopyMemory here, do i need to reduce the IRQL then after restore IT?

Karthik SG

On Wed, Aug 5, 2009 at 9:51 PM, Skywing wrote:

> The debugger documentation talks at length about how symbols and the
> symbol server work. I’d strongly encourage you to read through that portion
> of debugger.chm as it is generally useful knowledge.
>
> That being said, try inspecting the output of these commands:
>
> !sym noisy
> .symfix+ c:\symbols
> .reload
>
> …where c:\symbols is your preferred downstream store location.
>
> You must issue a .reload to cause the debugger to attempt to re-load
> symbols for which a load attempt has already been made.
>
> - S
>
> ------------------------------
> From: Karthik Gurumurthy
> Sent: Wednesday, August 05, 2009 02:47
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] D1, {b5388508, 2, b5388508, 88dafb2c} what is the 3rd
> parameter???
>
> ok, but how can i load symbols of ks.sys (kernel stream provided by
> microsoft) or it is the way what skywing told(.symfix)
>
> Karthik SG
>
> On Wed, Aug 5, 2009 at 2:32 PM, sivakumar thulasimani wrote:
>
>> if the following output is what you get as part of stack trace still, then
>> it hasnt loaded the correct symbol files yet.
>>
>> >ba50bd54 b5306452 0000000a b531d508 00000002 nt+0x22f43
>> >ba50bd7c 8053877d 87a3ed98 00000000 8a23fda8 ks+0x1452
>> >ba50bdac 805cff70 87a3ed98 00000000 00000000 nt+0x6177d
>> >ba50bddc 805460ee 8053868e 00000002 00000000 nt+0xf8f70
>> >00000000 00000000 00000000 00000000 00000000 nt+0x6f0ee
>>
>>
>> it should be more like “nt!KiThreadStartup+0x16” or
>> “ks!WorkerThread+0x70” in the stack. check the symbols for both nt and ks.
>>
>> -rtshiva
>> — 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
>

Karthik Gurumurthy wrote:

Sorry Tim, but i am not getting what do you mean from “You are getting
what looks like a jump or call
into paged memory.” are you intend to say calling .

I meant what I said. You yourself said that the “2” means the fault
came from execute access, not read or write access. The fact that the
bad address is the same as the instruction that caused the fault
supports this. The only way that can happen is if the processor is
running code that is in memory, which tries to jump or call to an
address that is in paged memory.

In practical terms, most transfers over a long distance are going to be
calls; jumps in compiled code are typically only used within a single
function, and a single function isn’t usually large enough to have half
paged in and half paged out.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

> as you said both memory are likely to be non-recsident (what is the best way to identify that???)

and since IRQL is at DPC how can i do RtlCopyMemory here, do i need to reduce the IRQL then after

No, you cannot call KeLowerIrql arbitrary, you can do this only if you called KeRaiseIrql yourself before.

You just cannot touch pageable memory at >= DISPATCH, redesign your code to make this memory nonpaged.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

hi,
After fixing all the symbols the analyze result is

************************************************************************************
DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1)
An attempt was made to access a pageable (or completely invalid) address at
an
interrupt request level (IRQL) that is too high. This is usually
caused by drivers using improper addresses.
If kernel debugger is available get stack backtrace.
Arguments:
Arg1: b531d508, memory referenced
Arg2: 00000002, IRQL
Arg3: b531d508, value 0 = read operation, 1 = write operation
Arg4: 879cd664, address which referenced memory

Debugging Details:

WORKER_ROUTINE:
ks!KsWorkSinkItemWorker+0
b531d508 8bff mov edi,edi

WORK_ITEM: 879cd664

CURRENT_IRQL: 2

CUSTOMER_CRASH_COUNT: 2

DEFAULT_BUCKET_ID: DRIVER_FAULT

BUGCHECK_STR: 0xD1

PROCESS_NAME: System

LAST_CONTROL_TRANSFER: from b5306452 to 804f9f43

STACK_TEXT:
ba50bd54 b5306452 0000000a b531d508 00000002 nt!KeBugCheckEx+0x1b
ba50bd7c 8053877d 87a3ed98 00000000 8a23fda8 ks!WorkerThread+0x70
ba50bdac 805cff70 87a3ed98 00000000 00000000 nt!ExpWorkerThread+0xef
ba50bddc 805460ee 8053868e 00000002 00000000 nt!PspSystemThreadStartup+0x34
00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16

STACK_COMMAND: kb

FOLLOWUP_IP:
ks!WorkerThread+70
b5306452 ff1520d030b5 call dword ptr [ks!_imp_KfReleaseSpinLock
(b530d020)]

SYMBOL_STACK_INDEX: 1

SYMBOL_NAME: ks!WorkerThread+70

FOLLOWUP_NAME: MachineOwner

MODULE_NAME: ks

IMAGE_NAME: ks.sys

DEBUG_FLR_IMAGE_TIMESTAMP: 48025c12

FAILURE_BUCKET_ID: 0xD1_ks!WorkerThread+70

BUCKET_ID: 0xD1_ks!WorkerThread+70

Followup: MachineOwner

******************************************************************************************************************

Karthik SG

On Thu, Aug 6, 2009 at 1:34 AM, Maxim S. Shatskih wrote:

> > as you said both memory are likely to be non-recsident (what is
> the best way to identify that???)
> >and since IRQL is at DPC how can i do RtlCopyMemory here, do i need to
> reduce the IRQL then after
>
> No, you cannot call KeLowerIrql arbitrary, you can do this only if you
> called KeRaiseIrql yourself before.
>
> You just cannot touch pageable memory at >= DISPATCH, redesign your code to
> make this memory nonpaged.
>
> --
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> ---
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> OSR Seminars – OSR
>
> To unsubscribe, visit the List Server section of OSR Online at
> ListServer/Forum
>

Hi karthik,
Are you calling RtlCopyMemory after you release the spinlock or
while the spinlock is still held ? as holding a spinlock raises the IRQL to
dispatch level and the documentation for RtlCopyMemory clearly states that
you can call it only when the caller’s IRQL <= APC Level.

-rtshiva

On Thu, Aug 6, 2009 at 10:02 AM, Karthik Gurumurthy <
xxxxx@nextbitcpu.com> wrote:

hi,
After fixing all the symbols the analyze result is

************************************************************************************
DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1)
An attempt was made to access a pageable (or completely invalid) address at
an
interrupt request level (IRQL) that is too high. This is usually
caused by drivers using improper addresses.
If kernel debugger is available get stack backtrace.
Arguments:
Arg1: b531d508, memory referenced
Arg2: 00000002, IRQL
Arg3: b531d508, value 0 = read operation, 1 = write operation
Arg4: 879cd664, address which referenced memory

Debugging Details:

WORKER_ROUTINE:
ks!KsWorkSinkItemWorker+0
b531d508 8bff mov edi,edi

WORK_ITEM: 879cd664

CURRENT_IRQL: 2

CUSTOMER_CRASH_COUNT: 2

DEFAULT_BUCKET_ID: DRIVER_FAULT

BUGCHECK_STR: 0xD1

PROCESS_NAME: System

LAST_CONTROL_TRANSFER: from b5306452 to 804f9f43

STACK_TEXT:
ba50bd54 b5306452 0000000a b531d508 00000002 nt!KeBugCheckEx+0x1b
ba50bd7c 8053877d 87a3ed98 00000000 8a23fda8 ks!WorkerThread+0x70
ba50bdac 805cff70 87a3ed98 00000000 00000000 nt!ExpWorkerThread+0xef
ba50bddc 805460ee 8053868e 00000002 00000000 nt!PspSystemThreadStartup+0x34
00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16

STACK_COMMAND: kb

FOLLOWUP_IP:
ks!WorkerThread+70
b5306452 ff1520d030b5 call dword ptr [ks!_imp_KfReleaseSpinLock
(b530d020)]

SYMBOL_STACK_INDEX: 1

SYMBOL_NAME: ks!WorkerThread+70

FOLLOWUP_NAME: MachineOwner

MODULE_NAME: ks

IMAGE_NAME: ks.sys

DEBUG_FLR_IMAGE_TIMESTAMP: 48025c12

FAILURE_BUCKET_ID: 0xD1_ks!WorkerThread+70

BUCKET_ID: 0xD1_ks!WorkerThread+70

Followup: MachineOwner

******************************************************************************************************************

Karthik SG

On Thu, Aug 6, 2009 at 1:34 AM, Maxim S. Shatskih > > wrote:
>
>> > as you said both memory are likely to be non-recsident (what
>> is the best way to identify that???)
>> >and since IRQL is at DPC how can i do RtlCopyMemory here, do i need to
>> reduce the IRQL then after
>>
>> No, you cannot call KeLowerIrql arbitrary, you can do this only if you
>> called KeRaiseIrql yourself before.
>>
>> You just cannot touch pageable memory at >= DISPATCH, redesign your code
>> to make this memory nonpaged.
>>
>> –
>> Maxim S. Shatskih
>> Windows DDK MVP
>> xxxxx@storagecraft.com
>> http://www.storagecraft.com
>>
>>
>> —
>> 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
>

Hi Shiva,
RtlcopyMemory is called while lock is on and it is non-paged (i
tought that both from and to memory are resident) but it seems they are not.
Do you know how to find both the memory is resident or not.

Karthik SG

On Thu, Aug 6, 2009 at 10:34 AM, sivakumar thulasimani wrote:

> Hi karthik,
> Are you calling RtlCopyMemory after you release the spinlock or
> while the spinlock is still held ? as holding a spinlock raises the IRQL to
> dispatch level and the documentation for RtlCopyMemory clearly states that
> you can call it only when the caller’s IRQL <= APC Level.
>
> -rtshiva
>
> On Thu, Aug 6, 2009 at 10:02 AM, Karthik Gurumurthy <
> xxxxx@nextbitcpu.com> wrote:
>
>> hi,
>> After fixing all the symbols the analyze result is
>>
>>
>>
>> DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1)
>> An attempt was made to access a pageable (or completely invalid) address
>> at an
>> interrupt request level (IRQL) that is too high. This is usually
>> caused by drivers using improper addresses.
>> If kernel debugger is available get stack backtrace.
>> Arguments:
>> Arg1: b531d508, memory referenced
>> Arg2: 00000002, IRQL
>> Arg3: b531d508, value 0 = read operation, 1 = write operation
>> Arg4: 879cd664, address which referenced memory
>>
>> Debugging Details:
>> ------------------
>>
>>
>> WORKER_ROUTINE:
>> ks!KsWorkSinkItemWorker+0
>> b531d508 8bff mov edi,edi
>>
>> WORK_ITEM: 879cd664
>>
>> CURRENT_IRQL: 2
>>
>> CUSTOMER_CRASH_COUNT: 2
>>
>> DEFAULT_BUCKET_ID: DRIVER_FAULT
>>
>> BUGCHECK_STR: 0xD1
>>
>> PROCESS_NAME: System
>>
>> LAST_CONTROL_TRANSFER: from b5306452 to 804f9f43
>>
>> STACK_TEXT:
>> ba50bd54 b5306452 0000000a b531d508 00000002 nt!KeBugCheckEx+0x1b
>> ba50bd7c 8053877d 87a3ed98 00000000 8a23fda8 ks!WorkerThread+0x70
>> ba50bdac 805cff70 87a3ed98 00000000 00000000 nt!ExpWorkerThread+0xef
>> ba50bddc 805460ee 8053868e 00000002 00000000
>> nt!PspSystemThreadStartup+0x34
>> 00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16
>>
>>
>> STACK_COMMAND: kb
>>
>> FOLLOWUP_IP:
>> ks!WorkerThread+70
>> b5306452 ff1520d030b5 call dword ptr [ks!_imp_KfReleaseSpinLock
>> (b530d020)]
>>
>> SYMBOL_STACK_INDEX: 1
>>
>> SYMBOL_NAME: ks!WorkerThread+70
>>
>> FOLLOWUP_NAME: MachineOwner
>>
>> MODULE_NAME: ks
>>
>> IMAGE_NAME: ks.sys
>>
>> DEBUG_FLR_IMAGE_TIMESTAMP: 48025c12
>>
>> FAILURE_BUCKET_ID: 0xD1_ks!WorkerThread+70
>>
>> BUCKET_ID: 0xD1_ks!WorkerThread+70
>>
>> Followup: MachineOwner
>> ---------
>>
>>
******************************
>>
>> Karthik SG
>>
>> On Thu, Aug 6, 2009 at 1:34 AM, Maxim S. Shatskih <
>> xxxxx@storagecraft.com> wrote:
>>
>>> > as you said both memory are likely to be non-recsident (what
>>> is the best way to identify that???)
>>> >and since IRQL is at DPC how can i do RtlCopyMemory here, do i need to
>>> reduce the IRQL then after
>>>
>>> No, you cannot call KeLowerIrql arbitrary, you can do this only if you
>>> called KeRaiseIrql yourself before.
>>>
>>> You just cannot touch pageable memory at >= DISPATCH, redesign your code
>>> to make this memory nonpaged.
>>>
>>> –
>>> Maxim S. Shatskih
>>> Windows DDK MVP
>>> xxxxx@storagecraft.com
>>> http://www.storagecraft.com
>>>
>>>
>>> —
>>> 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

Hi karthik,
It was just a guess that RtlCopyMemory could have caused it,
So keep your options open still :). Hmm… as for how to see if memory is
resided or not , is the target and the destination memory location allocated
in non paged memory or is it in stack ? . Also check the parameters you are
passing to the KS workitem. are they valid ? just another guess is are you
supposed to send the spinlock also to this workitem and is this spinlock in
stack?

-rtshiva
On Thu, Aug 6, 2009 at 10:39 AM, Karthik Gurumurthy <
xxxxx@nextbitcpu.com> wrote:

Hi Shiva,
RtlcopyMemory is called while lock is on and it is non-paged (i
tought that both from and to memory are resident) but it seems they are not.
Do you know how to find both the memory is resident or not.

Karthik SG

On Thu, Aug 6, 2009 at 10:34 AM, sivakumar thulasimani <
xxxxx@gmail.com> wrote:

> Hi karthik,
> Are you calling RtlCopyMemory after you release the spinlock or
> while the spinlock is still held ? as holding a spinlock raises the IRQL to
> dispatch level and the documentation for RtlCopyMemory clearly states that
> you can call it only when the caller’s IRQL <= APC Level.
>
> -rtshiva
>
> On Thu, Aug 6, 2009 at 10:02 AM, Karthik Gurumurthy <
> xxxxx@nextbitcpu.com> wrote:
>
>> hi,
>> After fixing all the symbols the analyze result is
>>
>>
>> ************************************************************************************
>> DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1)
>> An attempt was made to access a pageable (or completely invalid) address
>> at an
>> interrupt request level (IRQL) that is too high. This is usually
>> caused by drivers using improper addresses.
>> If kernel debugger is available get stack backtrace.
>> Arguments:
>> Arg1: b531d508, memory referenced
>> Arg2: 00000002, IRQL
>> Arg3: b531d508, value 0 = read operation, 1 = write operation
>> Arg4: 879cd664, address which referenced memory
>>
>> Debugging Details:
>> ------------------
>>
>>
>> WORKER_ROUTINE:
>> ks!KsWorkSinkItemWorker+0
>> b531d508 8bff mov edi,edi
>>
>> WORK_ITEM: 879cd664
>>
>> CURRENT_IRQL: 2
>>
>> CUSTOMER_CRASH_COUNT: 2
>>
>> DEFAULT_BUCKET_ID: DRIVER_FAULT
>>
>> BUGCHECK_STR: 0xD1
>>
>> PROCESS_NAME: System
>>
>> LAST_CONTROL_TRANSFER: from b5306452 to 804f9f43
>>
>> STACK_TEXT:
>> ba50bd54 b5306452 0000000a b531d508 00000002 nt!KeBugCheckEx+0x1b
>> ba50bd7c 8053877d 87a3ed98 00000000 8a23fda8 ks!WorkerThread+0x70
>> ba50bdac 805cff70 87a3ed98 00000000 00000000 nt!ExpWorkerThread+0xef
>> ba50bddc 805460ee 8053868e 00000002 00000000
>> nt!PspSystemThreadStartup+0x34
>> 00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16
>>
>>
>> STACK_COMMAND: kb
>>
>> FOLLOWUP_IP:
>> ks!WorkerThread+70
>> b5306452 ff1520d030b5 call dword ptr [ks!_imp_KfReleaseSpinLock
>> (b530d020)]
>>
>> SYMBOL_STACK_INDEX: 1
>>
>> SYMBOL_NAME: ks!WorkerThread+70
>>
>> FOLLOWUP_NAME: MachineOwner
>>
>> MODULE_NAME: ks
>>
>> IMAGE_NAME: ks.sys
>>
>> DEBUG_FLR_IMAGE_TIMESTAMP: 48025c12
>>
>> FAILURE_BUCKET_ID: 0xD1_ks!WorkerThread+70
>>
>> BUCKET_ID: 0xD1_ks!WorkerThread+70
>>
>> Followup: MachineOwner
>> ---------
>>
>> ******************************************************************************************************************
>>
>> Karthik SG
>>
>> On Thu, Aug 6, 2009 at 1:34 AM, Maxim S. Shatskih <
>> xxxxx@storagecraft.com> wrote:
>>
>>> > as you said both memory are likely to be non-recsident (what
>>> is the best way to identify that???)
>>> >and since IRQL is at DPC how can i do RtlCopyMemory here, do i need to
>>> reduce the IRQL then after
>>>
>>> No, you cannot call KeLowerIrql arbitrary, you can do this only if you
>>> called KeRaiseIrql yourself before.
>>>
>>> You just cannot touch pageable memory at >= DISPATCH, redesign your code
>>> to make this memory nonpaged.
>>>
>>> –
>>> Maxim S. Shatskih
>>> Windows DDK MVP
>>> xxxxx@storagecraft.com
>>> http://www.storagecraft.com
>>>
>>>
>>> —
>>> 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

— 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

shiva,
The peculiar thing here is i am not using any workitems its just an
copy operation, its an virtual wavepci audio driver i am copying mapped data
into me buffer, this crash is not frequent all things render and capture
operation will go on smoothly but some time out of blue this BSOD comes up.
My driver is NXTBT.sys but in analyze report their is no trace of this
driver!!.

Karthik SG

On Thu, Aug 6, 2009 at 10:56 AM, sivakumar thulasimani wrote:

> Hi karthik,
> It was just a guess that RtlCopyMemory could have caused it,
> So keep your options open still :). Hmm… as for how to see if memory is
> resided or not , is the target and the destination memory location allocated
> in non paged memory or is it in stack ? . Also check the parameters you are
> passing to the KS workitem. are they valid ? just another guess is are you
> supposed to send the spinlock also to this workitem and is this spinlock in
> stack?
>
> -rtshiva
> On Thu, Aug 6, 2009 at 10:39 AM, Karthik Gurumurthy <
> xxxxx@nextbitcpu.com> wrote:
>
>> Hi Shiva,
>> RtlcopyMemory is called while lock is on and it is non-paged
>> (i tought that both from and to memory are resident) but it seems they are
>> not. Do you know how to find both the memory is resident or not.
>>
>> Karthik SG
>>
>> On Thu, Aug 6, 2009 at 10:34 AM, sivakumar thulasimani <
>> xxxxx@gmail.com> wrote:
>>
>>> Hi karthik,
>>> Are you calling RtlCopyMemory after you release the spinlock or
>>> while the spinlock is still held ? as holding a spinlock raises the IRQL to
>>> dispatch level and the documentation for RtlCopyMemory clearly states that
>>> you can call it only when the caller’s IRQL <= APC Level.
>>>
>>> -rtshiva
>>>
>>> On Thu, Aug 6, 2009 at 10:02 AM, Karthik Gurumurthy <
>>> xxxxx@nextbitcpu.com> wrote:
>>>
>>>> hi,
>>>> After fixing all the symbols the analyze result is
>>>>
>>>>
>>>>
>>>> DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1)
>>>> An attempt was made to access a pageable (or completely invalid) address
>>>> at an
>>>> interrupt request level (IRQL) that is too high. This is usually
>>>> caused by drivers using improper addresses.
>>>> If kernel debugger is available get stack backtrace.
>>>> Arguments:
>>>> Arg1: b531d508, memory referenced
>>>> Arg2: 00000002, IRQL
>>>> Arg3: b531d508, value 0 = read operation, 1 = write operation
>>>> Arg4: 879cd664, address which referenced memory
>>>>
>>>> Debugging Details:
>>>> ------------------
>>>>
>>>>
>>>> WORKER_ROUTINE:
>>>> ks!KsWorkSinkItemWorker+0
>>>> b531d508 8bff mov edi,edi
>>>>
>>>> WORK_ITEM: 879cd664
>>>>
>>>> CURRENT_IRQL: 2
>>>>
>>>> CUSTOMER_CRASH_COUNT: 2
>>>>
>>>> DEFAULT_BUCKET_ID: DRIVER_FAULT
>>>>
>>>> BUGCHECK_STR: 0xD1
>>>>
>>>> PROCESS_NAME: System
>>>>
>>>> LAST_CONTROL_TRANSFER: from b5306452 to 804f9f43
>>>>
>>>> STACK_TEXT:
>>>> ba50bd54 b5306452 0000000a b531d508 00000002 nt!KeBugCheckEx+0x1b
>>>> ba50bd7c 8053877d 87a3ed98 00000000 8a23fda8 ks!WorkerThread+0x70
>>>> ba50bdac 805cff70 87a3ed98 00000000 00000000 nt!ExpWorkerThread+0xef
>>>> ba50bddc 805460ee 8053868e 00000002 00000000
>>>> nt!PspSystemThreadStartup+0x34
>>>> 00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16
>>>>
>>>>
>>>> STACK_COMMAND: kb
>>>>
>>>> FOLLOWUP_IP:
>>>> ks!WorkerThread+70
>>>> b5306452 ff1520d030b5 call dword ptr [ks!_imp_KfReleaseSpinLock
>>>> (b530d020)]
>>>>
>>>> SYMBOL_STACK_INDEX: 1
>>>>
>>>> SYMBOL_NAME: ks!WorkerThread+70
>>>>
>>>> FOLLOWUP_NAME: MachineOwner
>>>>
>>>> MODULE_NAME: ks
>>>>
>>>> IMAGE_NAME: ks.sys
>>>>
>>>> DEBUG_FLR_IMAGE_TIMESTAMP: 48025c12
>>>>
>>>> FAILURE_BUCKET_ID: 0xD1_ks!WorkerThread+70
>>>>
>>>> BUCKET_ID: 0xD1_ks!WorkerThread+70
>>>>
>>>> Followup: MachineOwner
>>>> ---------
>>>>
>>>>
******************************
>>>>
>>>> Karthik SG
>>>>
>>>> On Thu, Aug 6, 2009 at 1:34 AM, Maxim S. Shatskih <
>>>> xxxxx@storagecraft.com> wrote:
>>>>
>>>>> > as you said both memory are likely to be non-recsident
>>>>> (what is the best way to identify that???)
>>>>> >and since IRQL is at DPC how can i do RtlCopyMemory here, do i need
>>>>> to reduce the IRQL then after
>>>>>
>>>>> No, you cannot call KeLowerIrql arbitrary, you can do this only if you
>>>>> called KeRaiseIrql yourself before.
>>>>>
>>>>> You just cannot touch pageable memory at >= DISPATCH, redesign your
>>>>> code to make this memory nonpaged.
>>>>>
>>>>> –
>>>>> Maxim S. Shatskih
>>>>> Windows DDK MVP
>>>>> xxxxx@storagecraft.com
>>>>> http://www.storagecraft.com
>>>>>
>>>>>
>>>>> —
>>>>> 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
>>
>>
>> — 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
>

Hi karthik,
I have no idea on how to use Kernel Streaming but you have said that
your driver uses Kernel streaming, so i think that there must be some
paramters or data that you have to transfer to it. Based on the !analyze -v
output my interpretation is as follows ( hoping the more exprienced will
correct me if i am wrong )

STACK_TEXT:
ba50bd54 b5306452 0000000a b531d508 00000002 nt!KeBugCheckEx+0x1b
ba50bd7c 8053877d 87a3ed98 00000000 8a23fda8 ks!WorkerThread+0x70

Now the address “b531d508” i think is within the KS module. In Xp code this
is what i see for Ks!workerthread

f6b537ee ff1510b0b5f6 call dword ptr [ks!_imp__KeGetCurrentIrql
(f6b5b010)]
f6b537f4 84c0 test al,al
f6b537f6 0f853d0c0000 jne ks!WorkerThread+0x4f (f6b54439)

ks!WorkerThread+0x4f:
f6b54439 56 push esi
f6b5443a ff7608 push dword ptr [esi+8]
f6b5443d ff1510b0b5f6 call dword ptr [ks!_imp__KeGetCurrentIrql
(f6b5b010)]
f6b54443 0fb6c0 movzx eax,al
f6b54446 50 push eax
f6b54447 ff7608 push dword ptr [esi+8]
f6b5444a 6a0a push 0Ah
f6b5444c ff15e4b0b5f6 call dword ptr [ks!_imp__KeBugCheckEx (f6b5b0e4)]

Which seems that the worker thread intentionally checks the IRQL and
preforms a bugcheck if it is anything greater than passive level. So Why it
performs the check you have to find out ;).

-rtshiva

On Thu, Aug 6, 2009 at 11:07 AM, Karthik Gurumurthy <
xxxxx@nextbitcpu.com> wrote:

shiva,
The peculiar thing here is i am not using any workitems its just an
copy operation, its an virtual wavepci audio driver i am copying mapped data
into me buffer, this crash is not frequent all things render and capture
operation will go on smoothly but some time out of blue this BSOD comes up.
My driver is NXTBT.sys but in analyze report their is no trace of this
driver!!.

Karthik SG

On Thu, Aug 6, 2009 at 10:56 AM, sivakumar thulasimani <
xxxxx@gmail.com> wrote:

> Hi karthik,
> It was just a guess that RtlCopyMemory could have caused it,
> So keep your options open still :). Hmm… as for how to see if memory is
> resided or not , is the target and the destination memory location allocated
> in non paged memory or is it in stack ? . Also check the parameters you are
> passing to the KS workitem. are they valid ? just another guess is are you
> supposed to send the spinlock also to this workitem and is this spinlock in
> stack?
>
> -rtshiva
> On Thu, Aug 6, 2009 at 10:39 AM, Karthik Gurumurthy <
> xxxxx@nextbitcpu.com> wrote:
>
>> Hi Shiva,
>> RtlcopyMemory is called while lock is on and it is non-paged
>> (i tought that both from and to memory are resident) but it seems they are
>> not. Do you know how to find both the memory is resident or not.
>>
>> Karthik SG
>>
>> On Thu, Aug 6, 2009 at 10:34 AM, sivakumar thulasimani <
>> xxxxx@gmail.com> wrote:
>>
>>> Hi karthik,
>>> Are you calling RtlCopyMemory after you release the spinlock or
>>> while the spinlock is still held ? as holding a spinlock raises the IRQL to
>>> dispatch level and the documentation for RtlCopyMemory clearly states that
>>> you can call it only when the caller’s IRQL <= APC Level.
>>>
>>> -rtshiva
>>>
>>> On Thu, Aug 6, 2009 at 10:02 AM, Karthik Gurumurthy <
>>> xxxxx@nextbitcpu.com> wrote:
>>>
>>>> hi,
>>>> After fixing all the symbols the analyze result is
>>>>
>>>>
>>>> ************************************************************************************
>>>> DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1)
>>>> An attempt was made to access a pageable (or completely invalid)
>>>> address at an
>>>> interrupt request level (IRQL) that is too high. This is usually
>>>> caused by drivers using improper addresses.
>>>> If kernel debugger is available get stack backtrace.
>>>> Arguments:
>>>> Arg1: b531d508, memory referenced
>>>> Arg2: 00000002, IRQL
>>>> Arg3: b531d508, value 0 = read operation, 1 = write operation
>>>> Arg4: 879cd664, address which referenced memory
>>>>
>>>> Debugging Details:
>>>> ------------------
>>>>
>>>>
>>>> WORKER_ROUTINE:
>>>> ks!KsWorkSinkItemWorker+0
>>>> b531d508 8bff mov edi,edi
>>>>
>>>> WORK_ITEM: 879cd664
>>>>
>>>> CURRENT_IRQL: 2
>>>>
>>>> CUSTOMER_CRASH_COUNT: 2
>>>>
>>>> DEFAULT_BUCKET_ID: DRIVER_FAULT
>>>>
>>>> BUGCHECK_STR: 0xD1
>>>>
>>>> PROCESS_NAME: System
>>>>
>>>> LAST_CONTROL_TRANSFER: from b5306452 to 804f9f43
>>>>
>>>> STACK_TEXT:
>>>> ba50bd54 b5306452 0000000a b531d508 00000002 nt!KeBugCheckEx+0x1b
>>>> ba50bd7c 8053877d 87a3ed98 00000000 8a23fda8 ks!WorkerThread+0x70
>>>> ba50bdac 805cff70 87a3ed98 00000000 00000000 nt!ExpWorkerThread+0xef
>>>> ba50bddc 805460ee 8053868e 00000002 00000000
>>>> nt!PspSystemThreadStartup+0x34
>>>> 00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16
>>>>
>>>>
>>>> STACK_COMMAND: kb
>>>>
>>>> FOLLOWUP_IP:
>>>> ks!WorkerThread+70
>>>> b5306452 ff1520d030b5 call dword ptr [ks!_imp_KfReleaseSpinLock
>>>> (b530d020)]
>>>>
>>>> SYMBOL_STACK_INDEX: 1
>>>>
>>>> SYMBOL_NAME: ks!WorkerThread+70
>>>>
>>>> FOLLOWUP_NAME: MachineOwner
>>>>
>>>> MODULE_NAME: ks
>>>>
>>>> IMAGE_NAME: ks.sys
>>>>
>>>> DEBUG_FLR_IMAGE_TIMESTAMP: 48025c12
>>>>
>>>> FAILURE_BUCKET_ID: 0xD1_ks!WorkerThread+70
>>>>
>>>> BUCKET_ID: 0xD1_ks!WorkerThread+70
>>>>
>>>> Followup: MachineOwner
>>>> ---------
>>>>
>>>> ******************************************************************************************************************
>>>>
>>>> Karthik SG
>>>>
>>>> On Thu, Aug 6, 2009 at 1:34 AM, Maxim S. Shatskih <
>>>> xxxxx@storagecraft.com> wrote:
>>>>
>>>>> > as you said both memory are likely to be non-recsident
>>>>> (what is the best way to identify that???)
>>>>> >and since IRQL is at DPC how can i do RtlCopyMemory here, do i need
>>>>> to reduce the IRQL then after
>>>>>
>>>>> No, you cannot call KeLowerIrql arbitrary, you can do this only if you
>>>>> called KeRaiseIrql yourself before.
>>>>>
>>>>> You just cannot touch pageable memory at >= DISPATCH, redesign your
>>>>> code to make this memory nonpaged.
>>>>>
>>>>> –
>>>>> Maxim S. Shatskih
>>>>> Windows DDK MVP
>>>>> xxxxx@storagecraft.com
>>>>> http://www.storagecraft.com
>>>>>
>>>>>
>>>>> —
>>>>> 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
>>
>>
>> — 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

? which is a little feature of the worker thread implementation that raises
a bugcheck if the work item routine happens to return with IRQL raised above
PASSIVE_LEVEL.

I will point you back to my original question: ?Do you release your
spinlock properly??

Because there is mounting evidence to suggest you do not with result being
that on return from your driver the KS worker thread that has just services
some sort of passive level activity entry point in your code (either
directly or indirectly) has returned with some entity having not restored
IRQL (and most likely not having released a spinlock properly or at all).

So quit dancing around RtlCopyMemory(). It is bloody memcpy, an intrinsic,
that works just fine at any IRQL so long as the memory it touches (source /
destination) are resident or can be made resident. If your problem was with
the memory accessed by RtlCopyMemory/memcpy/repmovs_ then the bugcheck for
invalid access would have been raised and the address in the bugcheck data
would be pointing your right at your driver and the buffer you were
RtlCopyMemory() to/from.

Go find the lock you don?t release correctly. If you want the debugger to
land in your code and point you right at the problem then get in the habit
of adding code like this to the entry/exit of callback routines that have a
call contract of IRLQ < DISPATCH_LEVEL

VOID

MyClass::MyVirtualFunctionThatIsCalledByPortClsAtPassiveLevel()

{

#if DBG

KIRQL dbgEntryIrql = KeGetCurrentIrql();

#endif

ASSERT(dbgEntryIrql < DISPATCH_LEVEL);

… do your stuff including forgetting to restore IRQL

ASSERT(KeGetCurrentIrql() == dbgEntryIrql);

}

Heck, since you are writing a KS/PortCls driver you event get to hang
yourself with C++. Write a simple class that does the check automatically
no matter ?how? you exit the function (think CTOR capture IRQL, DTOR test on
exit). The class can compile to nothing in the free build.

Instead of flailing about in the debugger, write code that checks itself in
the debug version. If you have a call entry/exit contract from an external
component (this is usually overkill to validate entry/exit contracts on all
of your functions in your driver)

?This function is called at PASSIVE_LEVEL?

Or

?This function is called at IRQL < DISPATCH_LEVEL?

Or

?This function is called at DISPATCH_LEVEL?

Then test and ASSERT() that contract is maintained. That way, you catch
*your* bugs while still in the code that is about to cause the BSOD and you
catch *the other guys bug* before you go do all the damage and get blamed
for it.

Good Luck,

Dave Cattley

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of sivakumar thulasimani
Sent: Thursday, August 06, 2009 2:24 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] D1, {b5388508, 2, b5388508, 88dafb2c} what is the 3rd
parameter???

Hi karthik,

I have no idea on how to use Kernel Streaming but you have said that
your driver uses Kernel streaming, so i think that there must be some
paramters or data that you have to transfer to it. Based on the !analyze -v
output my interpretation is as follows ( hoping the more exprienced will
correct me if i am wrong )

STACK_TEXT:

ba50bd54 b5306452 0000000a b531d508 00000002 nt!KeBugCheckEx+0x1b
ba50bd7c 8053877d 87a3ed98 00000000 8a23fda8 ks!WorkerThread+0x70

Now the address “b531d508” i think is within the KS module. In Xp code this
is what i see for Ks!workerthread

f6b537ee ff1510b0b5f6 call dword ptr [ks!_imp__KeGetCurrentIrql
(f6b5b010)]
f6b537f4 84c0 test al,al
f6b537f6 0f853d0c0000 jne ks!WorkerThread+0x4f (f6b54439)

ks!WorkerThread+0x4f:
f6b54439 56 push esi
f6b5443a ff7608 push dword ptr [esi+8]
f6b5443d ff1510b0b5f6 call dword ptr [ks!_imp__KeGetCurrentIrql
(f6b5b010)]
f6b54443 0fb6c0 movzx eax,al
f6b54446 50 push eax
f6b54447 ff7608 push dword ptr [esi+8]
f6b5444a 6a0a push 0Ah
f6b5444c ff15e4b0b5f6 call dword ptr [ks!_imp__KeBugCheckEx (f6b5b0e4)]

Which seems that the worker thread intentionally checks the IRQL and
preforms a bugcheck if it is anything greater than passive level. So Why it
performs the check you have to find out ;).

-rtshiva

On Thu, Aug 6, 2009 at 11:07 AM, Karthik Gurumurthy
wrote:

shiva,
The peculiar thing here is i am not using any workitems its just an
copy operation, its an virtual wavepci audio driver i am copying mapped data
into me buffer, this crash is not frequent all things render and capture
operation will go on smoothly but some time out of blue this BSOD comes up.
My driver is NXTBT.sys but in analyze report their is no trace of this
driver!!.

Karthik SG

On Thu, Aug 6, 2009 at 10:56 AM, sivakumar thulasimani
wrote:

Hi karthik,

It was just a guess that RtlCopyMemory could have caused it,
So keep your options open still :). Hmm… as for how to see if memory is
resided or not , is the target and the destination memory location allocated
in non paged memory or is it in stack ? . Also check the parameters you are
passing to the KS workitem. are they valid ? just another guess is are you
supposed to send the spinlock also to this workitem and is this spinlock in
stack?

-rtshiva

On Thu, Aug 6, 2009 at 10:39 AM, Karthik Gurumurthy
wrote:

Hi Shiva,
RtlcopyMemory is called while lock is on and it is non-paged (i
tought that both from and to memory are resident) but it seems they are not.
Do you know how to find both the memory is resident or not.

Karthik SG

On Thu, Aug 6, 2009 at 10:34 AM, sivakumar thulasimani
wrote:

Hi karthik,

Are you calling RtlCopyMemory after you release the spinlock or
while the spinlock is still held ? as holding a spinlock raises the IRQL to
dispatch level and the documentation for RtlCopyMemory clearly states that
you can call it only when the caller’s IRQL <= APC Level.

-rtshiva

On Thu, Aug 6, 2009 at 10:02 AM, Karthik Gurumurthy
wrote:

hi,
After fixing all the symbols the analyze result is

********************************************************************

DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1)
An attempt was made to access a pageable (or completely invalid) address at
an
interrupt request level (IRQL) that is too high. This is usually
caused by drivers using improper addresses.
If kernel debugger is available get stack backtrace.
Arguments:
Arg1: b531d508, memory referenced
Arg2: 00000002, IRQL
Arg3: b531d508, value 0 = read operation, 1 = write operation
Arg4: 879cd664, address which referenced memory

Debugging Details:
------------------

WORKER_ROUTINE:
ks!KsWorkSinkItemWorker+0

b531d508 8bff mov edi,edi

WORK_ITEM: 879cd664

CURRENT_IRQL: 2

CUSTOMER_CRASH_COUNT: 2

DEFAULT_BUCKET_ID: DRIVER_FAULT

BUGCHECK_STR: 0xD1

PROCESS_NAME: System

LAST_CONTROL_TRANSFER: from b5306452 to 804f9f43

STACK_TEXT:

ba50bd54 b5306452 0000000a b531d508 00000002 nt!KeBugCheckEx+0x1b
ba50bd7c 8053877d 87a3ed98 00000000 8a23fda8 ks!WorkerThread+0x70
ba50bdac 805cff70 87a3ed98 00000000 00000000 nt!ExpWorkerThread+0xef
ba50bddc 805460ee 8053868e 00000002 00000000 nt!PspSystemThreadStartup+0x34
00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16

STACK_COMMAND: kb

FOLLOWUP_IP:

ks!WorkerThread+70
b5306452 ff1520d030b5 call dword ptr [ks!_imp_KfReleaseSpinLock
(b530d020)]

SYMBOL_STACK_INDEX: 1

SYMBOL_NAME: ks!WorkerThread+70

FOLLOWUP_NAME: MachineOwner

MODULE_NAME: ks

IMAGE_NAME: ks.sys

DEBUG_FLR_IMAGE_TIMESTAMP: 48025c12

FAILURE_BUCKET_ID: 0xD1_ks!WorkerThread+70

BUCKET_ID: 0xD1_ks!WorkerThread+70

Followup: MachineOwner
---------
**************************************


Karthik SG

On Thu, Aug 6, 2009 at 1:34 AM, Maxim S. Shatskih
wrote:

> as you said both memory are likely to be non-recsident (what is
the best way to identify that???)
>and since IRQL is at DPC how can i do RtlCopyMemory here, do i need to
reduce the IRQL then after

No, you cannot call KeLowerIrql arbitrary, you can do this only if you
called KeRaiseIrql yourself before.

You just cannot touch pageable memory at >= DISPATCH, redesign your code to
make this memory nonpaged.



Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com http:</http:>



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

— 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

— 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

VOID
MyClass::MyVirtualFunctionThatIsCalledByPortClsAtPassiveLevel()
{
#if DBG
KIRQL dbgEntryIrql = KeGetCurrentIrql();
#endif
ASSERT(dbgEntryIrql < DISPATCH_LEVEL);

PAGED_CODE macro does this.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Almost. The last time that I checked the WDK PAGED_CODE macro will not
ASSERT under XP. It does display a debug message. I have not hit/tried it
under NT6.

Bill Wandel

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]
On Behalf Of Maxim S. Shatskih
Sent: Thursday, August 06, 2009 7:01 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] D1, {b5388508, 2, b5388508, 88dafb2c} what is the 3rd
parameter???

VOID
MyClass::MyVirtualFunctionThatIsCalledByPortClsAtPassiveLevel()
{
#if DBG
KIRQL dbgEntryIrql = KeGetCurrentIrql();
#endif
ASSERT(dbgEntryIrql < DISPATCH_LEVEL);

PAGED_CODE macro does this.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com


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 believe that it NT_ASSERT()s.

mm

Which will not assert under XP but will display a message. I haven’t tried
this in quite awhile but this was the case when the PAGED_CODE macro was
changed. I had to redefine it in my drivers to get it to actually break into
the debugger.

Bill

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]
On Behalf Of xxxxx@evitechnology.com
Sent: Thursday, August 06, 2009 7:31 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] D1, {b5388508, 2, b5388508, 88dafb2c} what is the 3rd
parameter???

I believe that it NT_ASSERT()s.

mm


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 forgot to mention that part, or really that that was why I thought (but wasn’t sure) the difference was due to. If I recall correctly, DbgRaiseAssertionFailure() ->___intc(), but what __int2c() does on XP is where my knowledge got hazy.

What I do know is that the ASSERT() to NT_ASSERT() thing has sucked mightily. The impact on XP has never been much of a problem for me, but the lack-o-useful msft assertions bites.

mm

Max,

True enough. I just use PAGED_CODE() though to annotate that the function
is in paged code, not that it has an entry/exit contract of PASSIVE_LEVEL.

The subtle distinction of course is that an function with entry/exit
contract of PASSIVE_LEVEL might still raise IRQL but a PAGED_CODE() function
is less ‘clear’ on that point. Obviously if the function is in paged code,
it cannot raise IRQL.

If the OP wanted, they could probably run prefast on the driver and it would
tell them where they did not restore IRQL correctly.

Cheers,
Dave Cattley

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Thursday, August 06, 2009 7:01 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] D1, {b5388508, 2, b5388508, 88dafb2c} what is the 3rd
parameter???

VOID
MyClass::MyVirtualFunctionThatIsCalledByPortClsAtPassiveLevel()
{
#if DBG
KIRQL dbgEntryIrql = KeGetCurrentIrql();
#endif
ASSERT(dbgEntryIrql < DISPATCH_LEVEL);

PAGED_CODE macro does this.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com


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

To answer your question, the third parameter is the address of the
worker routine, probably in your driver, that has been called and then
returned with IRQL != PASSIVE_LEVEL. This is also the first parameter.
b531d508 - try using the windbg command ‘ln’ (list nearest) with this
address.

As others have suggested, examine your code for IRQL violations such
as not releasing a spinlock.

Are you sure you are not using KsRegisterWorker or
KsRegisterCountedWorker or KsQueueWorkItem?

Actually KS can be doing this for you, internally as part of its pin
class, and likely calling into one of your routines, in which case
b531d508 is going to be a routine inside ks, probably
KsWorkSinkItemWorker.

Mark Roddy

On Thu, Aug 6, 2009 at 1:37 AM, Karthik
Gurumurthy wrote:
> shiva,
> ??? The peculiar thing here is i am not using any workitems its just an
> copy operation, its an virtual wavepci audio driver i am copying mapped data
> into me buffer, this crash is not frequent all things render and capture
> operation will go on smoothly but some time out of blue this BSOD comes up.
> My driver is NXTBT.sys but in analyze report their is no trace of this
> driver!!.
>
> Karthik SG
>
> On Thu, Aug 6, 2009 at 10:56 AM, sivakumar thulasimani
> wrote:
>>
>> Hi karthik,
>> ??? It was just a guess that RtlCopyMemory could have caused it,
>> So keep your options open still :). Hmm… as for how to see if memory is
>> resided or not , is the target and the destination memory location allocated
>> in non paged memory or is it in stack ? . Also check the parameters you are
>> passing to the?KS workitem. are they valid ? just another guess is are you
>> supposed to send the spinlock also to this workitem and is this spinlock in
>> stack?
>>
>> -rtshiva
>> On Thu, Aug 6, 2009 at 10:39 AM, Karthik Gurumurthy
>> wrote:
>>>
>>> Hi Shiva,
>>> ??? RtlcopyMemory is called while lock is on and it is non-paged
>>> (i tought that both from and to memory are resident) but it seems they are
>>> not. Do you know how to find both the memory is resident or not.
>>>
>>> Karthik SG
>>>
>>> On Thu, Aug 6, 2009 at 10:34 AM, sivakumar thulasimani
>>> wrote:
>>>>
>>>> Hi karthik,
>>>> ??? Are you calling RtlCopyMemory after you release the spinlock or
>>>> while the spinlock is still held ? as holding a spinlock raises the IRQL to
>>>> dispatch level and the documentation for RtlCopyMemory clearly states that
>>>> you can call it only when the caller’s IRQL <= APC Level.
>>>>
>>>> -rtshiva
>>>>
>>>> On Thu, Aug 6, 2009 at 10:02 AM, Karthik Gurumurthy
>>>> wrote:
>>>>>
>>>>> hi,
>>>>> ??? After fixing all the symbols the analyze result is
>>>>>
>>>>>
>>>>>
>>>>> DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1)
>>>>> An attempt was made to access a pageable (or completely invalid)
>>>>> address at an
>>>>> interrupt request level (IRQL) that is too high.? This is usually
>>>>> caused by drivers using improper addresses.
>>>>> If kernel debugger is available get stack backtrace.
>>>>> Arguments:
>>>>> Arg1: b531d508, memory referenced
>>>>> Arg2: 00000002, IRQL
>>>>> Arg3: b531d508, value 0 = read operation, 1 = write operation
>>>>> Arg4: 879cd664, address which referenced memory
>>>>>
>>>>> Debugging Details:
>>>>> ------------------
>>>>>
>>>>>
>>>>> WORKER_ROUTINE:
>>>>> ks!KsWorkSinkItemWorker+0
>>>>> b531d508 8bff??? mov??? edi,edi
>>>>>
>>>>> WORK_ITEM:? 879cd664
>>>>>
>>>>> CURRENT_IRQL:? 2
>>>>>
>>>>> CUSTOMER_CRASH_COUNT:? 2
>>>>>
>>>>> DEFAULT_BUCKET_ID:? DRIVER_FAULT
>>>>>
>>>>> BUGCHECK_STR:? 0xD1
>>>>>
>>>>> PROCESS_NAME:? System
>>>>>
>>>>> LAST_CONTROL_TRANSFER:? from b5306452 to 804f9f43
>>>>>
>>>>> STACK_TEXT:
>>>>> ba50bd54 b5306452 0000000a b531d508 00000002 nt!KeBugCheckEx+0x1b
>>>>> ba50bd7c 8053877d 87a3ed98 00000000 8a23fda8 ks!WorkerThread+0x70
>>>>> ba50bdac 805cff70 87a3ed98 00000000 00000000 nt!ExpWorkerThread+0xef
>>>>> ba50bddc 805460ee 8053868e 00000002 00000000
>>>>> nt!PspSystemThreadStartup+0x34
>>>>> 00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16
>>>>>
>>>>>
>>>>> STACK_COMMAND:? kb
>>>>>
>>>>> FOLLOWUP_IP:
>>>>> ks!WorkerThread+70
>>>>> b5306452 ff1520d030b5??? call??? dword ptr [ks!_imp_KfReleaseSpinLock
>>>>> (b530d020)]
>>>>>
>>>>> SYMBOL_STACK_INDEX:? 1
>>>>>
>>>>> SYMBOL_NAME:? ks!WorkerThread+70
>>>>>
>>>>> FOLLOWUP_NAME:? MachineOwner
>>>>>
>>>>> MODULE_NAME: ks
>>>>>
>>>>> IMAGE_NAME:? ks.sys
>>>>>
>>>>> DEBUG_FLR_IMAGE_TIMESTAMP:? 48025c12
>>>>>
>>>>> FAILURE_BUCKET_ID:? 0xD1_ks!WorkerThread+70
>>>>>
>>>>> BUCKET_ID:? 0xD1_ks!WorkerThread+70
>>>>>
>>>>> Followup: MachineOwner
>>>>> ---------
>>>>>
>>>>>
******************************
>>>>>
>>>>> Karthik SG
>>>>>
>>>>> On Thu, Aug 6, 2009 at 1:34 AM, Maxim S. Shatskih
>>>>> wrote:
>>>>>>
>>>>>> > ? ? ? ? as you said both memory are likely to be non-recsident (what
>>>>>> > is the best way to identify that???)
>>>>>> >and since IRQL is at DPC how can i do RtlCopyMemory here, do ?i need
>>>>>> > to reduce the IRQL then after
>>>>>>
>>>>>> No, you cannot call KeLowerIrql arbitrary, you can do this only if you
>>>>>> called KeRaiseIrql yourself before.
>>>>>>
>>>>>> You just cannot touch pageable memory at >= DISPATCH, redesign your
>>>>>> code to make this memory nonpaged.
>>>>>>
>>>>>> –
>>>>>> Maxim S. Shatskih
>>>>>> Windows DDK MVP
>>>>>> xxxxx@storagecraft.com
>>>>>> http://www.storagecraft.com
>>>>>>
>>>>>>
>>>>>> —
>>>>>> 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
>>>
>>> — 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

> True enough. I just use PAGED_CODE() though to annotate that the function

is in paged code, not that it has an entry/exit contract of PASSIVE_LEVEL.

…and I place nearly all < DISPATCH_LEVEL functions to code_seg(“PAGE”) and then use PAGED_CODE.

:slight_smile:

The subtle distinction of course is that an function with entry/exit
contract of PASSIVE_LEVEL might still raise IRQL but a PAGED_CODE() function
is less ‘clear’ on that point.

In this case, I would require the comment describing why the function is limited to < DISPATCH. Well, this is my personal style though.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com