Accessing process stack pointer from kernel space

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Accessing process stack pointer from kernel space



I was able to get task_struct from current macro and am wondering if there is a way to get the process stack pointer from my custom sys_call to return to userspace(as readonly value)??





You have to tell what your custom sys_call does?
– LethalProgrammer
6 hours ago




1 Answer
1



It's easy to get it's value in assembly, so try using this:


#include <stdint.h>

uint64_t getsp(void)
{
uint64_t sp;
asm("mov %%rsp, %0" : "=rm" (sp));
return sp;
}






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

C++ virtual function: Base class function is called instead of derived