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

Home NTDEV

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/


Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

ExAllocatePoolWithTag working at a high IRQL?

AvalonAvalon Member Posts: 35
edited May 13 in NTDEV

I accidently placed a ExAllocatePoolWithTag(NonPagedPoolNx) when IRQL was set too IPI_LEVEL and it succeeded? I confirmed IRQL in WinDbg, and the ExAllocatePoolWithTag() succeeded and gave me a valid buffer.

The MSDN states ExAllocatePoolWithTag only operates at <= DISPATCH_LEVEL, but it seems to work at higher IRQLs too. Even the SAL notation for the ExAllocatePoolWithTag shows _When_((PoolType & PagedPool) == 0, _IRQL_requires_max_(DISPATCH_LEVEL))

I understand paging is disabled by the MemoryManager as it only operates at <= APC_LEVEL, but MemoryManager seems to allocate kernel pages from non paged pool fine.

Has it always been like this? Is MSDN incorrect?

Comments

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,958

    Many things that are prohibited at raised IRQL will work sometimes, and some things even work most of the time. That doesn't mean the documentation is wrong. It means you got lucky, this time.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • AvalonAvalon Member Posts: 35
    edited May 18

    Thanks. Yeah I've adjusted my driver now to simply allocate the memory before the IRQL is raised.

    As MSDN states ExAllocatePoolWithTag (NonPagedPoolNx) requires <= DISPATCH_LEVEL
    But to read/write to NonPagedPool - MSDN states "Nonpaged pool can be accessed from any IRQL".

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!
Developing Minifilters 24 May 2021 Live, Online
Writing WDF Drivers 14 June 2021 Live, Online
Internals & Software Drivers 27 September 2021 Live, Online
Kernel Debugging 15 November 2021 Live, Online