Osman TOKER wrote:
Hi Tim,
Thanks for reply, it is the most complicated error i ever seen for this job(cause i didnt write the codes) Ý want to post u the log and codes. I guess that the error is about ExAllocBuffer but i’m not sure…
Did you take a look at the dump? The issue was this instruction:
movzx eax, word ptr [rax+r8*2]
which is fetching a word from a table, and the address in rax is
00000000_07afb000. Your thread’s stack is at fffff880_07a678b0. That’s
suspicious. If I were a gambling man, I’d say you passed a pointer in a
DWORD somewhere and lost the upper 32 bits.
And, since you sent me the source code, I can even see where that is
happening. You are passing “struct driver_in_buff_s” and “struct
driver_out_buff_s” through your ioctls (although you hide that fact in
the way you implement those functions). The first element in each case is:
unsigned long int translated_base_address;
An “unsigned long int” is 32 bits. That is not large enough to hold an
address in a 64-bit system.
This means you have some work to do. The simplest solution is to change
the “unsigned long int” to an “unsigned __int64”. That means you will
have to recompile your application as well.
However, stepping back a bit, it is extremely dangerous to have your
driver pass a kernel address up to user mode, and to have your driver
TRUST that the address it was handed is valid. You should seriously
consider a safer design. There is no reason to pass the
“translated_base_address” up to user mode to begin with. Just let the
kernel driver keep the base address. If you need the user-mode app to
pass an offset into that space, that’s fine. An offset can be
validated. A raw pointer cannot.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.