How to probe for validity of buffer from Paged or NOn-paged pool

How do you probe for validity of a memory buffer from Paged or Nonpaged
pool? Something like we have in Win32 API IsBadReadPtr, IsBadWritePtr?
Something like that.

Thanks,

Naveen K Kohli

you don’t. Other kernel components (the only things which can hand you
pool addresses) should be handing you correct values.

drivers shouldn’t waste much time protecting themselves from other
drivers.

-p


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Kohli, Naveen
Sent: Wednesday, June 11, 2003 1:26 PM
To: NT Developers Interest List
Cc: ‘xxxxx@lists.osr.com’
Subject: [ntdev] How to probe for validity of buffer from Paged
or NOn-paged pool

How do you probe for validity of a memory buffer from Paged or
Nonpaged pool? Something like we have in Win32 API IsBadReadPtr,
IsBadWritePtr? Something like that.

Thanks,

Naveen K Kohli


You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to
xxxxx@lists.osr.com

MmIsAddressValid for nonpaged.

__try { char c; c = *(volatile char*)Address; } __except(EXCEPTION_EXECUTE_HANDLER) { return GetExceptionCode() } - for paged.

----- Original Message -----
From: Kohli, Naveen
To: NT Developers Interest List
Cc: ‘xxxxx@lists.osr.com’
Sent: Thursday, June 12, 2003 12:25 AM
Subject: [ntdev] How to probe for validity of buffer from Paged or NOn-paged pool

How do you probe for validity of a memory buffer from Paged or Nonpaged pool? Something like we have in Win32 API IsBadReadPtr, IsBadWritePtr? Something like that.

Thanks,

Naveen K Kohli


You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

This should work:

__try {
__asm
{
xor eax, eax
mov [eax], 0x12345678
};
} __except(catcher()) {

// invalid ptr in eax

}

This is really all that IsBadReadPtr/IsBadWritePtr do. I know that NT has
structured exception handling, but I might be slightly off on the syntax.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Kohli, Naveen
Sent: Wednesday, June 11, 2003 3:26 PM
To: NT Developers Interest List
Cc: ‘xxxxx@lists.osr.com’
Subject: [ntdev] How to probe for validity of buffer from Paged or
NOn-paged pool

How do you probe for validity of a memory buffer from Paged or Nonpaged
pool? Something like we have in Win32 API IsBadReadPtr, IsBadWritePtr?
Something like that.

Thanks,

Naveen K Kohli


You are currently subscribed to ntdev as: xxxxx@positivenetworks.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

what do either of these things get you? You still don’t know that the
range the driver gave you doesn’t cross multiple pool allocations. You
don’t know that it’s even pool … it could be a set of device registers
mapped into kernel space.

-p


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Wednesday, June 11, 2003 1:36 PM
To: NT Developers Interest List
Subject: [ntdev] Re: How to probe for validity of buffer from
Paged or NOn-paged pool

MmIsAddressValid for nonpaged.

__try { char c; c = *(volatile char*)Address; }
__except(EXCEPTION_EXECUTE_HANDLER) { return GetExceptionCode() } - for
paged.

----- Original Message -----
From: Kohli, Naveen mailto:xxxxx
To: NT Developers Interest List
mailto:xxxxx
Cc: ‘xxxxx@lists.osr.com’
Sent: Thursday, June 12, 2003 12:25 AM
Subject: [ntdev] How to probe for validity of buffer
from Paged or NOn-paged pool

How do you probe for validity of a memory buffer from
Paged or Nonpaged pool? Something like we have in Win32 API
IsBadReadPtr, IsBadWritePtr? Something like that.

Thanks,

Naveen K Kohli


You are currently subscribed to ntdev as:
xxxxx@storagecraft.com
To unsubscribe send a blank email to
xxxxx@lists.osr.com
mailto:xxxxx


You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to
xxxxx@lists.osr.com</mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>

If C language is used, how to write the exception handler?
--------------- 2003-06-12 You wrote---------------

MmIsAddressValid for nonpaged.

__try { char c; c = *(volatile char*)Address; } __except(EXCEPTION_EXECUTE_HANDLER) { return GetExceptionCode() } - for paged.

----- Original Message -----
From: Kohli, Naveen
To: NT Developers Interest List
Cc: ‘xxxxx@lists.osr.com’
Sent: Thursday, June 12, 2003 12:25 AM
Subject: [ntdev] How to probe for validity of buffer from Paged or NOn-paged pool

How do you probe for validity of a memory buffer from Paged or Nonpaged pool? Something like we have in Win32 API IsBadReadPtr, IsBadWritePtr? Something like that.

Thanks,

Naveen K Kohli


You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntdev as: ldxlq@263.net
To unsubscribe send a blank email to xxxxx@lists.osr.com