1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:58:11 +00:00

Kernel: Add 'ptrace' syscall

This commit adds a basic implementation of
the ptrace syscall, which allows one process
(the tracer) to control another process (the tracee).

While a process is being traced, it is stopped whenever a signal is
received (other than SIGCONT).

The tracer can start tracing another thread with PT_ATTACH,
which causes the tracee to stop.

From there, the tracer can use PT_CONTINUE
to continue the execution of the tracee,
or use other request codes (which haven't been implemented yet)
to modify the state of the tracee.

Additional request codes are PT_SYSCALL, which causes the tracee to
continue exection but stop at the next entry or exit from a syscall,
and PT_GETREGS which fethces the last saved register set of the tracee
(can be used to inspect syscall arguments and return value).

A special request code is PT_TRACE_ME, which is issued by the tracee
and causes it to stop when it calls execve and wait for the
tracer to attach.
This commit is contained in:
Itamar 2020-03-28 11:47:16 +03:00 committed by Andreas Kling
parent c9396be83f
commit 6b74d38aab
13 changed files with 300 additions and 102 deletions

View file

@ -50,7 +50,7 @@ class PhysicalPage;
class PhysicalRegion;
class Process;
class ProcessInspectionHandle;
class ProcessTracer;
class ThreadTracer;
class Range;
class RangeAllocator;
class Region;