Accessing process stack pointer from kernel space

Clash Royale CLAN TAG#URR8PPPAccessing 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)??
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.
You have to tell what your custom sys_call does?
– LethalProgrammer
6 hours ago