mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 12:05:07 +00:00
ptrace: Add PT_POKE
PT_POKE writes a single word to the tracee's address space. Some caveats: - If the user requests to write to an address in a read-only region, we temporarily change the page's protections to allow it. - If the user requests to write to a region that's backed by a SharedInodeVMObject, we replace the vmobject with a PrivateIndoeVMObject.
This commit is contained in:
parent
924fda19b0
commit
b306ac9b2b
5 changed files with 52 additions and 3 deletions
|
@ -122,6 +122,8 @@ VirtualAddress get_entry_point(int pid)
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// TODO: pledge & unveil
|
||||
// TOOD: check that we didn't somehow hurt performance. boot seems slower? (or it's just laptop battey)
|
||||
if (argc == 1)
|
||||
return usage();
|
||||
|
||||
|
@ -157,7 +159,12 @@ int main(int argc, char** argv)
|
|||
printf("eip:0x%x\n", regs.eip);
|
||||
|
||||
uint32_t data = ptrace(PT_PEEK, g_pid, (void*)regs.eip, 0);
|
||||
printf("data: 0x%x\n", data);
|
||||
printf("peeked data: 0x%x\n", data);
|
||||
|
||||
if (ptrace(PT_POKE, g_pid, (void*)regs.eip, data) < 0) {
|
||||
perror("poke");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ptrace(PT_CONTINUE, g_pid, 0, 0) == -1) {
|
||||
perror("continue");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue