Repository navigation
Isolated Processes 17: Implement executor to run syscalls in remote process - #217
Merged
Merged
Conversation
marti4d
force-pushed
the
isolated_process/17-remote-executor
branch
from
August 24, 2026 14:06
5d1df25 to
0824ec1
Compare
marti4d
force-pushed
the
isolated_process/16-remote-io-and-wire-format
branch
from
August 26, 2026 22:08
f091f6f to
bea4a95
Compare
marti4d
force-pushed
the
isolated_process/17-remote-executor
branch
from
August 26, 2026 22:08
0824ec1 to
cdbfa4b
Compare
marti4d
force-pushed
the
isolated_process/16-remote-io-and-wire-format
branch
from
August 27, 2026 19:53
bea4a95 to
34fe884
Compare
marti4d
force-pushed
the
isolated_process/17-remote-executor
branch
from
August 27, 2026 19:53
cdbfa4b to
5d53a51
Compare
marti4d
force-pushed
the
isolated_process/16-remote-io-and-wire-format
branch
from
September 1, 2026 20:12
34fe884 to
b362d07
Compare
Base automatically changed from
isolated_process/16-remote-io-and-wire-format
to
main
September 1, 2026 20:18
marti4d
force-pushed
the
isolated_process/17-remote-executor
branch
from
September 1, 2026 20:19
5d53a51 to
99f7fa2
Compare
gabrielesvelto
approved these changes
Sep 2, 2026
Contributor
There was a problem hiding this comment.
LGTM, just one formatting nit
Comment on lines
+9
to
+240
| fn GetPid<'args, 'output>(self, _args: ()) -> Result<libc::pid_t> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| Ok(self.local_backend.pid()) | ||
| } | ||
| fn ProcessReaderReadAt<'args, 'output>( | ||
| self, | ||
| args: wire::ProcessReaderReadAtArgs, | ||
| ) -> Result<&'output [u8]> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| let scratch_buf = borrow_with_limit(self.scratch_buf, args.requested_len); | ||
|
|
||
| let bytes_read = self | ||
| .local_backend | ||
| .process_reader() | ||
| .read_at(args.address, scratch_buf) | ||
| .map_err(Error::Local)?; | ||
|
|
||
| Ok(&scratch_buf[0..bytes_read]) | ||
| } | ||
| fn StopProcess<'args, 'output>(self, _args: ()) -> Result<()> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| self.local_backend.stop_process().map_err(Error::Local) | ||
| } | ||
| fn ContinueProcess<'args, 'output>(self, _args: ()) -> Result<()> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| self.local_backend.continue_process().map_err(Error::Local) | ||
| } | ||
| fn SuspendThread<'args, 'output>(self, tid: libc::pid_t) -> Result<()> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| self.local_backend.suspend_thread(tid).map_err(Error::Local) | ||
| } | ||
| fn ResumeThread<'args, 'output>(self, tid: libc::pid_t) -> Result<()> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| self.local_backend.resume_thread(tid).map_err(Error::Local) | ||
| } | ||
| fn MappedModuleMemoryReaderOpen<'args, 'output>( | ||
| self, | ||
| args: wire::MappedModuleMemoryReaderOpenArgs, | ||
| ) -> Result<usize> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| let reader = self | ||
| .local_backend | ||
| .map_module_into_memory(&args.path, args.offset) | ||
| .map_err(Error::Local)?; | ||
| self.mapped_module_memory_readers | ||
| .assign_slot(reader) | ||
| .ok_or(Error::MappedModuleMemoryReaderSlotsExhausted) | ||
| } | ||
| fn MappedModuleMemoryReaderReadAt<'args, 'output>( | ||
| self, | ||
| args: wire::MappedModuleMemoryReaderReadAtArgs, | ||
| ) -> Result<&'output [u8]> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| let reader = self | ||
| .mapped_module_memory_readers | ||
| .get_slot_mut(args.handle) | ||
| .ok_or(Error::EmptyMappedModuleMemoryReaderSlotRequested)?; | ||
| reader | ||
| .read_at(args.offset, args.requested_len) | ||
| .map_err(Error::Local) | ||
| } | ||
| fn MappedModuleMemoryReaderLen<'args, 'output>(self, handle: usize) -> Result<usize> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| let reader = self | ||
| .mapped_module_memory_readers | ||
| .get_slot_mut(handle) | ||
| .ok_or(Error::EmptyMappedModuleMemoryReaderSlotRequested)?; | ||
| Ok(reader.len()) | ||
| } | ||
| fn MappedModuleMemoryReaderClose<'args, 'output>(self, handle: usize) -> Result<()> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| let _reader = self | ||
| .mapped_module_memory_readers | ||
| .free_slot(handle) | ||
| .ok_or(Error::EmptyMappedModuleMemoryReaderSlotRequested)?; | ||
| Ok(()) | ||
| } | ||
| fn StatFile<'args, 'output>(self, path: CStrWithNull<'_>) -> Result<Stat> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| self.local_backend.stat_file(&path).map_err(Error::Local) | ||
| } | ||
| fn FileReaderOpen<'args, 'output>(self, path: CStrWithNull<'_>) -> Result<usize> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| let reader = self.local_backend.read_file(&path).map_err(Error::Local)?; | ||
| self.file_readers | ||
| .assign_slot(reader) | ||
| .ok_or(Error::FileReaderSlotsExhausted) | ||
| } | ||
| fn FileReaderRead<'args, 'output>(self, args: wire::FileReaderArgs) -> Result<&'output [u8]> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| let scratch_buf = borrow_with_limit(self.scratch_buf, args.requested_len); 8000 | ||
|
|
||
| let reader = self | ||
| .file_readers | ||
| .get_slot_mut(args.handle) | ||
| .ok_or(Error::EmptyFileSlotRequested)?; | ||
|
|
||
| let bytes_read = reader.read(scratch_buf).map_err(Error::Local)?; | ||
|
|
||
| Ok(&scratch_buf[0..bytes_read]) | ||
| } | ||
| fn FileReaderClose<'args, 'output>(self, handle: usize) -> Result<()> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| let _reader = self | ||
| .file_readers | ||
| .free_slot(handle) | ||
| .ok_or(Error::EmptyFileSlotRequested)?; | ||
| Ok(()) | ||
| } | ||
| fn DirReaderOpen<'args, 'output>(self, path: CStrWithNull<'_>) -> Result<usize> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| let reader = self.local_backend.read_dir(&path).map_err(Error::Local)?; | ||
| self.dir_readers | ||
| .assign_slot(reader) | ||
| .ok_or(Error::DirReaderSlotsExhausted) | ||
| } | ||
| fn DirReaderRead<'args, 'output>(self, handle: usize) -> Result<Option<&'output [u8]>> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| let reader = self | ||
| .dir_readers | ||
| .get_slot_mut(handle) | ||
| .ok_or(Error::EmptyDirSlotRequested)?; | ||
|
|
||
| reader.read_next_name().map_err(Error::Local) | ||
| } | ||
| fn DirReaderClose<'args, 'output>(self, handle: usize) -> Result<()> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| let _reader = self | ||
| .dir_readers | ||
| .free_slot(handle) | ||
| .ok_or(Error::EmptyDirSlotRequested)?; | ||
| Ok(()) | ||
| } | ||
| fn ReadLink<'args, 'output>(self, args: wire::ReadLinkArgs<'_>) -> Result<&'output [u8]> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| let scratch_buf = borrow_with_limit(self.scratch_buf, args.requested_len); | ||
|
|
||
| let bytes_read = self | ||
| .local_backend | ||
| .read_link(&args.path, scratch_buf) | ||
| .map_err(Error::Local)?; | ||
|
|
||
| Ok(&scratch_buf[0..bytes_read]) | ||
| } | ||
| fn GetGenRegs<'args, 'output>(self, tid: libc::pid_t) -> Result<GenRegs> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| self.local_backend.get_gen_regs(tid).map_err(Error::Local) | ||
| } | ||
| fn GetFpRegs<'args, 'output>(self, tid: libc::pid_t) -> Result<FpRegs> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| self.local_backend.get_fp_regs(tid).map_err(Error::Local) | ||
| } | ||
| #[cfg(target_arch = "x86")] | ||
| fn GetFpxRegs<'args, 'output>(self, tid: libc::pid_t) -> Result<FpxRegs> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| self.local_backend.get_fpx_regs(tid).map_err(Error::Local) | ||
| } | ||
|
|
||
| #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] | ||
| fn PtracePeekUser<'args, 'output>(self, addr: usize) -> Result<[u8; crate::PTRACE_DATA_LEN]> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| < 8000 /td> | self.local_backend | |
| .ptrace_peekuser(addr) | ||
| .map_err(Error::Local) | ||
| } | ||
| fn ForceProcessReaderKind<'args, 'output>(self, kind: ProcessReaderKind) -> Result<()> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| self.local_backend | ||
| .force_process_reader_kind(kind) | ||
| .map_err(Error::Local) | ||
| } | ||
| #[cfg(feature = "testing")] | ||
| fn FailOneSyscallWith<'args, 'output>(self, errno: core::ffi::c_int) -> Result<()> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| self.local_backend.fail_one_syscall_with(errno); | ||
| Ok(()) | ||
| } | ||
| fn Quit<'args, 'output>(self, _args: ()) -> Result<()> | ||
| where | ||
| Self: 'output, | ||
| { | ||
| self.quit = true; | ||
| Ok(()) | ||
| } |
Contributor
There was a problem hiding this comment.
nit: Add a blank line between each function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@gabrielesvelto I broke the original Isolated Processes 16 into 16,17,18, 19 to make it easier to review in chunks.
Each chunk compiles, but a lot of it is dead code until it's finally assembled in the last chunk.