I have a driver that needs to reformat user-supplied data before sending
it on to the device. The data comprise one or more structures, each of
which may need to be internally padded, depending on content. The
userland buffer is allocated to allow plenty of room for the resulting
expansion of data.
I’m running into a IRQL_NOT_LESS_OR_EQUAL bugcheck when handling some
larger buffer sizes. User-side tests confirm successful allocation of
the buffer (around 18,700 bytes for this case). But the driver is
bugchecking inside of RtlMoveMemory. I’ve collected debugger data on a
bunch (10+) of crashes, and on every one of them the Arg1 ‘memory
referenced’ address is xxxxy000, where the destination address for
RtlMoveMemory was xxxx(y-1)fb0. It’s always crashing on a write and
never anywhere close to the end of the allocated buffer length.
(allocations have been consistent today, with a base address of
xxxxx250. yesterday, the base was xxxxx230 and one occurrance showed
xxxxy001 for Arg1)
Am I trying to write around the corner of a segment? (I didn’t think
P4s had segment issues) Do I need to avoid rewriting within the
user-supplied buffer?
Clues appreciated.