MDL use in a driver flagged as DO_DIRECT_IO.

Hi–

A few questions on MDL use in a driver flagged
as DO_DIRECT_IO.

I am making alternating write/read/DevIoctl calls
into my driver to test the buffer handling. The driver
does nothing but accept the data on user writes and serve
the data on user reads.

I am using MmGetSystemAddressForMdlSafe ()
on the pIrp->MdlAddress to get the buffer address
from the user for reads and writes.

Occasionally on one system, and rarely on another,
I am seeing the same code generate a C0000005 exception
within the try/exception block with a buffer address of zero.
It seems to occur at about equal frequency between
reads and writes. At the user level, each function (R & W)
use different buffers.

The read/write code paths (i.e., buffer updating) in the driver
are protected by mutexes.

Q:
0) Have I not included a protection I am required to?

  1. If using direct IO am I not guaranteed serialized access
    to the read/write routines in the driver?
  2. What could cause the occasional bad buffer address in the driver when
    the
    user passes down the same (good) address?

Thanks.

Bob Loewer

Are you checking for zero length I/O? Such I/O operations are legitimate
and may not include a buffer at all.

Tony

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

Hope to see you at the next OSR file systems class in San Jose, CA September
16, 2002!

-----Original Message-----
From: Bob Loewer [mailto:xxxxx@jamesbimen.com]
Sent: Tuesday, August 20, 2002 10:17 AM
To: File Systems Developers
Subject: [ntfsd] MDL use in a driver flagged as DO_DIRECT_IO.

Hi–

A few questions on MDL use in a driver flagged
as DO_DIRECT_IO.

I am making alternating write/read/DevIoctl calls
into my driver to test the buffer handling. The driver
does nothing but accept the data on user writes and serve
the data on user reads.

I am using MmGetSystemAddressForMdlSafe ()
on the pIrp->MdlAddress to get the buffer address
from the user for reads and writes.

Occasionally on one system, and rarely on another,
I am seeing the same code generate a C0000005 exception
within the try/exception block with a buffer address of zero.
It seems to occur at about equal frequency between
reads and writes. At the user level, each function (R & W)
use different buffers.

The read/write code paths (i.e., buffer updating) in the driver
are protected by mutexes.

Q:
0) Have I not included a protection I am required to?

  1. If using direct IO am I not guaranteed serialized access
    to the read/write routines in the driver?
  2. What could cause the occasional bad buffer address in the driver when
    the
    user passes down the same (good) address?

Thanks.

Bob Loewer


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

It’s look like that you do not check your input and output parameters.
You should check the size and the offset if they are valid. also after
calling
MmGetSystemAddressForMdlSafe you should check that you didn’t get
NULL.

----- Original Message -----
From: “Bob Loewer”
To: “File Systems Developers”
Sent: Tuesday, August 20, 2002 4:17 PM
Subject: [ntfsd] MDL use in a driver flagged as DO_DIRECT_IO.

>
> Hi–
>
> A few questions on MDL use in a driver flagged
> as DO_DIRECT_IO.
>
> I am making alternating write/read/DevIoctl calls
> into my driver to test the buffer handling. The driver
> does nothing but accept the data on user writes and serve
> the data on user reads.
>
> I am using MmGetSystemAddressForMdlSafe ()
> on the pIrp->MdlAddress to get the buffer address
> from the user for reads and writes.
>
> Occasionally on one system, and rarely on another,
> I am seeing the same code generate a C0000005 exception
> within the try/exception block with a buffer address of zero.
> It seems to occur at about equal frequency between
> reads and writes. At the user level, each function (R & W)
> use different buffers.
>
> The read/write code paths (i.e., buffer updating) in the driver
> are protected by mutexes.
>
> Q:
> 0) Have I not included a protection I am required to?
> 1) If using direct IO am I not guaranteed serialized access
> to the read/write routines in the driver?
> 2) What could cause the occasional bad buffer address in the driver when
> the
> user passes down the same (good) address?
>
> Thanks.
>
>
> Bob Loewer
>
>
>
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@hotmail.com
> To unsubscribe send a blank email to %%email.unsub%%
>

Give that man a Cheroot!

The check for zero was after the buffer address check–did not
grasp a buffer would never be allocated, regardless of request size.

Thanks, Tony (& osml).

–Bob Loewer

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tony Mason
Sent: Tuesday, August 20, 2002 10:50 AM
To: File Systems Developers
Subject: [ntfsd] RE: MDL use in a driver flagged as DO_DIRECT_IO.

Are you checking for zero length I/O? Such I/O operations are
legitimate
and may not include a buffer at all.

Tony

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

Hope to see you at the next OSR file systems class in San Jose, CA
September
16, 2002!

-----Original Message-----
From: Bob Loewer [mailto:xxxxx@jamesbimen.com]
Sent: Tuesday, August 20, 2002 10:17 AM
To: File Systems Developers
Subject: [ntfsd] MDL use in a driver flagged as DO_DIRECT_IO.

Hi–

A few questions on MDL use in a driver flagged
as DO_DIRECT_IO.

I am making alternating write/read/DevIoctl calls
into my driver to test the buffer handling. The driver
does nothing but accept the data on user writes and serve
the data on user reads.

I am using MmGetSystemAddressForMdlSafe ()
on the pIrp->MdlAddress to get the buffer address
from the user for reads and writes.

Occasionally on one system, and rarely on another,
I am seeing the same code generate a C0000005 exception
within the try/exception block with a buffer address of zero.
It seems to occur at about equal frequency between
reads and writes. At the user level, each function (R & W)
use different buffers.

The read/write code paths (i.e., buffer updating) in the driver
are protected by mutexes.

Q:
0) Have I not included a protection I am required to?

  1. If using direct IO am I not guaranteed serialized access
    to the read/write routines in the driver?
  2. What could cause the occasional bad buffer address in the driver when
    the
    user passes down the same (good) address?

Thanks.

Bob Loewer


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@jamesbimen.com
To unsubscribe send a blank email to %%email.unsub%%