ptrace-call-userspace | system call to call a userspace method
kandi X-RAY | ptrace-call-userspace Summary
kandi X-RAY | ptrace-call-userspace Summary
Example of how to use the ptrace(2) system call to call a userspace method.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ptrace-call-userspace
ptrace-call-userspace Key Features
ptrace-call-userspace Examples and Code Snippets
Community Discussions
Trending Discussions on ptrace-call-userspace
QUESTION
I'm working on a project where I need to make a running program execute a function on demand. For this I am using ptrace. I know that this is possible because GDB does it.
Right now I am using an adapted version of the the code found on: https://github.com/eklitzke/ptrace-call-userspace This program displays how to call fprintf in a target program.
The program I am facing appears when the called function uses nanosleep(). If nanosleep() is called while inside the function called by the tracer, the tracee crashes with a SIGSEGV, but only after the sleep is concluded. If the function is called normally by the tracee itself, everything works properly.
I concluded that the problem is related to how the function is called, probably something to do with the tracee's stack or it's register values. I already checked that the stack is 16 byte aligned when entering the function for example.
Code of the tracer is present in the github above (difference is the called function and I also removed the arguments)
Code for the tracee is simple a dummy process that prints it's PID every second.
Code for the function that is called:
...ANSWER
Answered 2019-Mar-19 at 00:20The issue is as follows:
Your call-hello program writes the two instructions
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ptrace-call-userspace
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page