How to access the user space stack pointer, the stack contents and the values of registers inside the kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am trying to collect the user state of the process inside a new system call which I am trying to implement. I need to collect the following values inside the kernel.

1. The user stack pointer.
2. The values of the registers before the system call was attempted.

I am a kernel newbie and have read across various posts that the user stack pointer can be accessed by using the following logic.

(current_thread_info + THREAD_SIZE) returns the pointer to the pt_regs structure that holds these values. Unfortunately I am getting the value of the stack as 0.

I need to use the user space stack pointer to copy the values of the stack from the user to the kernel structures and then analyze the user stack. ( I would be using the copy_from_user() method to copy the contents of the stack to the kernel data structures which I am using inside my new system call)

Any code snippet would be greatly appreciated.  Thanks a ton in advance for giving your time on this issue of mine.


Kalyan Chakravarthy

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux