Skip to content

Implement SYS_process_vm_readv and SYS_process_vm_writev #197

Description

@doanbaotrung

Feature: Implement SYS_process_vm_readv and SYS_process_vm_writev

1. Summary of Changes

  • Mapped SYS_process_vm_readv (syscall 270) and SYS_process_vm_writev (syscall 271) in the guest system call dispatch table (dispatch.tbl and abi.h).
  • Implemented sc_process_vm_readv and sc_process_vm_writev in the syscall translation layer (syscall.c).
  • The system calls handle intra-process ("self") transfers by checking if the target process ID matches the caller's process ID.
  • If target is self, it runs process_vm_copy_self(), which loops through the local and remote guest iovec vectors and copies data directly between the guest virtual memory addresses via safe guest read/write accessors.
  • If the target process ID does not match the caller, it returns -ESRCH (No such process), as cross-process address space copies are not supported under the single guest runtime process model.

2. Why it is Needed

  • Self-Diagnostics and Memory Dumping: Many advanced user-space utilities (such as garbage collectors, custom memory managers, tracing/profiling agents, and crash-reporting runtimes) use process_vm_readv/process_vm_writev to safely inspect process memory regions or serialize memory state.
  • Compatibility: When these diagnostics/tracing tools query self-memory and receive an ENOSYS (Function not implemented) error, they abort or disable critical crash-logging and monitoring capabilities.
  • Safe Memory Transfer: Implementing intra-process copying via process_vm_copy_self allows guest applications to successfully query their own virtual memory layout using standard POSIX address-space APIs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions