Skip to content

[SUBISSUE #2] Implement Process Inspection Syscalls (process_vm_readv/writev and Minimal ptrace) #299

Todo

Description

@marcobuschini

Parent Issue / Epic

#284 (Epic #265)

Prerequisite Sub-Issue

#293

Atomic Deliverable & Implementation Details

Add cross-process memory inspection and minimal ptrace debugging support:

  • kernel/uapi/sys.hpp: Define PTRACE_TRACEME, PTRACE_PEEKDATA, PTRACE_POKEDATA, PTRACE_CONT, PTRACE_SINGLESTEP, PTRACE_GETREGSET, PTRACE_SETREGSET, PTRACE_DETACH, and NT_PRSTATUS (1).
  • kernel/syscalls/ProcessSyscalls.cpp & SyscallDispatcher.cpp:
    • Implement sys_process_vm_readv (270) and sys_process_vm_writev (271) copying between local and remote AddressSpaces via validated linux_iovec arrays.
    • Implement minimal sys_ptrace (117) supporting PTRACE_TRACEME, tracer stop notification via wait4/waitid, PTRACE_PEEKDATA/POKEDATA, PTRACE_GETREGSET/SETREGSET, PTRACE_CONT, PTRACE_SINGLESTEP (via HAL::CpuControl AArch64 MDSCR_EL1.SS / SPSR_EL1.SS hook — keeping arch code strictly inside arch/aarch64-linux-gnu/!), and PTRACE_DETACH.
  • tests/host/ & kernel/shell/tests/: Add host ASan/UBSan tests for process_vm_readv/writev and QEMU EL0 ptrace tracee test.

Out of scope: hardware watchpoints, PTRACE_SYSEMU, multi-process debugger UI.

Acceptance Criteria & Edge Cases

  • process_vm_readv/writev return total bytes transferred, enforce -ESRCH/-EINVAL/-EFAULT, and never leak temporary mappings
  • ptrace keeps all AArch64 debug-register / SPSR_EL1.SS logic isolated in arch/aarch64-linux-gnu/ behind HAL::CpuControl (zero inline asm in kernel/)
  • Tracer exit automatically detaches/resumes or terminates traced children cleanly with zero zombie/PFA leaks
  • make format && make clean-tests && make -j"$(nproc)" all && make -j"$(nproc)" quality passes with zero warnings

Metadata

Metadata

Assignees

Labels

subissue

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions