Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTFSD
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


page fault when send queued irp to a lower level driver

OSR_Community_UserOSR_Community_User Member Posts: 110,217
Hi all,

In the filter driver, I queue file system requests in a queue maintained by
the driver.

My problem is that at a later time that after I move the IRP from the queue
and send it down to lower level driver, sometime it lead to page fault.
Before IoCallDriver, I have setup an IoCompletion routine. The page fault
happen before that routine is called.

My question is "Does Process Context matter?" when I send the IRP down. Or
are there other possible causes. I always allocate memory in NonPaged
pool.
Right now, I am using SoftIce with one computer setup, page fault message
is all I got. Will other setup give me more information ?

Apparently a newbie question, but I am really clueless right now !

Thanx,

Jack Cheng
(Curriculum Corp.)

Comments

  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    Sorry and allow me to rephrase my question again because I feel the
    generous response I got misinterpret my question.

    In a file system filter driver, I intercept IRP_MJ_CREATE requests and
    queue it in an driver maintained queue, then
    Irp->IoStatus.Status = STATUS_PENDING;
    IoMarkIrpPending(Irp);

    Then I de-queue an service IRP setup by an User mode service, send the
    necessary information to it to process.

    After the service finished its task, it send the result back to the filter
    driver. It is at this point I dequeue the original IRP_MJ_CREATE request
    and do the following as in what in Rajeev Nagar's sfilter sample,

    IoCopyCurrentIrpStackLocationToNext(Irp);
    ..get pointer to extension
    ..set a completion routine
    ..find target object from extension

    then

    IoCallDriver(pTargetDeviceObject, Irp);

    If the call return back from IoCallDriver, then everything is fine.
    Otherwise, I got page fault in SoftIce and this happen before the
    completion routine get called.

    My understanding is that Irp is allocated in NonPage space, I also do all
    my allocation in NonPage space. So my question is what caused this page
    fault in lower level driver. Is it because I handle the above in different
    process context ? If yes, is there a way to switch to that context ?

    Or is there other thing I miss that the lower level driver is expecting me
    to comply ?

    I would appreciate any help that I can get and hopefully it is more clear
    in regard to the problem than my previous post !

    Thanx,

    Jack Cheng
    (Curriculum Corp.)
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    I suspect that you can not queue the IPR_MJ_CREATE IRP to a worker thread
    because the create call MUST be processed by the FSD in the context of the
    calling process.

    Just a thought, I have not verified this.

    Jamey



    > -----Original Message-----
    > From: [email protected]
    > [mailto:[email protected]]On Behalf Of [email protected]
    > Sent: Wednesday, April 26, 2000 12:15 PM
    > To: File Systems Developers
    > Subject: [ntfsd] Re: page fault when send queued irp to a lower level
    > driver
    >
    >
    > Sorry and allow me to rephrase my question again because I feel the
    > generous response I got misinterpret my question.
    >
    > In a file system filter driver, I intercept IRP_MJ_CREATE requests and
    > queue it in an driver maintained queue, then
    > Irp->IoStatus.Status = STATUS_PENDING;
    > IoMarkIrpPending(Irp);
    >
    > Then I de-queue an service IRP setup by an User mode service, send the
    > necessary information to it to process.
    >
    > After the service finished its task, it send the result back to
    > the filter
    > driver. It is at this point I dequeue the original IRP_MJ_CREATE request
    > and do the following as in what in Rajeev Nagar's sfilter sample,
    >
    > IoCopyCurrentIrpStackLocationToNext(Irp);
    > ..get pointer to extension
    > ..set a completion routine
    > ..find target object from extension
    >
    > then
    >
    > IoCallDriver(pTargetDeviceObject, Irp);
    >
    > If the call return back from IoCallDriver, then everything is fine.
    > Otherwise, I got page fault in SoftIce and this happen before the
    > completion routine get called.
    >
    > My understanding is that Irp is allocated in NonPage space, I also do all
    > my allocation in NonPage space. So my question is what caused this page
    > fault in lower level driver. Is it because I handle the above in
    > different
    > process context ? If yes, is there a way to switch to that context ?
    >
    > Or is there other thing I miss that the lower level driver is
    > expecting me
    > to comply ?
    >
    > I would appreciate any help that I can get and hopefully it is more clear
    > in regard to the problem than my previous post !
    >
    > Thanx,
    >
    > Jack Cheng
    > (Curriculum Corp.)
    >
    >
    > ---
    > You are currently subscribed to ntfsd as: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
    >
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Internals & Software Drivers 25 Jan 2021 LIVE ONLINE
Developing Minifilters 8 March 2021 LIVE ONLINE