Accessing a user-mode stack from the kernel

From: Hanson, Jonathan M
Date: Tue Oct 26 2004 - 12:40:03 EST


I've written a kernel module that is triggered by an IOCTL from
a user-space application. My kernel module needs to access the context
(x86, by the way) of the user process. So I have a call stack that looks
like this:

User application
|
V
IOCTL glibc wrapper
|
V
Kernel module

>From what I've been doing, I believe that I can get the context of the
IOCTL glibc wrapper without any problems. However, I need the next stack
frame up but have been unsuccessful in finding this stack frame from the
kernel's context (I stick 0xdeadcafe in EBX just before the IOCTL call
in the user application so I'll know when I see it).
I've lifted portions on the ptrace() code into my kernel module
but that seems to return the IOCTL context when I use the getreg()
calls.
Can anyone offer any advice? It would be much appreciated.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/