On Memory Allocation routines

Hi All,
I have some doubts on the memory allocation routines, especially
ExAllocatePoolWithTag. Hope some one here could help me in getting an
anwswer for them.
Suppose that i have a structure with a size of 18 bytes. Documentation of
ExAllocatePoolWithTag says that it will align all the request at an 8 byte
boundary. And thru the debugger Iam able to see that all succesfull
allocations return an address that is divisible by 8. So What happens to the
remaining 7 bytes in this case? The next succesfull allocation would then be
aligned at a minimum differnce of 7 bytes from the end of my allocation,
right? What happens in case of a memory overrun of less than 7 bytes ? From
the documenation of Driver verifier i believe that, i wouldnt be able to
catch that becasue of the same isse ? Verifier special pool will try to
allocate the memory request from the lowest possible 8 byte aligned address
that will fit my request and then put an invalid page and then mark the
previous and next page inaccessible. And from what i understand, it still
wont be able to able to detect overrun less that 7 bytes in this specific
case, right ? Or is it that the remaining 7 bytes can also be counted to be
part of my allocation? But in that case why in this case sizeof operator
would give me 18 bytes and not 24 bytes? So though not recommended, would it
be okay to ignore overruns that comply with this ?

My second doubt is regarding Tags used along with? The four byte tag is
seens prior to the returned address, and the start of the tag doesnt seem to
be 8 byte aligned. Then how is this done? How do applications like poolmon
identify whether the allocations contains a valid tag or not?

Thanking you in advance
Anees


Hey there NRIs! Desi news, films, ‘n more! http://www.msn.co.in/nri/ Stay
in the loop!