8000 Isolated Processes 17: Implement executor to run syscalls in remote process by marti4d · Pull Request #217 · rust-minidump/minidump-writer · GitHub
[go: up one dir, main page]

Skip to content

Isolated Processes 17: Implement executor to run syscalls in remote process - #217

Merged
marti4d merged 2 commits into
mainfrom
isolated_process/17-remote-executor
Sep 2, 2026
Merged

marti4d merged 2 commits into
mainfrom
isolated_process/17-remote-executor

Conversation

@marti4d
@marti4d marti4d commented Aug 24, 2026 •
Copy link
Copy Markdown
Collaborator

@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.

@marti4d
marti4d force-pushed the isolated_process/17-remote-executor branch from 5d1df25 to 0824ec1 Compare August 24, 2026 14:06
@marti4d marti4d changed the title Isolated Processes 17: Implement executor to run syscalls in remote p… Isolated Processes 17: Implement executor to run syscalls in remote process Aug 24, 2026
@marti4d
marti4d force-pushed the isolated_process/16-remote-io-and-wire-format branch from f091f6f to bea4a95 Compare August 26, 2026 22:08
@marti4d
marti4d force-pushed the isolated_process/17-remote-executor branch from 0824ec1 to cdbfa4b Compare August 26, 2026 22:08
@marti4d
marti4d force-pushed the isolated_process/16-remote-io-and-wire-format branch from bea4a95 to 34fe884 Compare August 27, 2026 19:53
@marti4d
marti4d force-pushed the isolated_process/17-remote-executor branch from cdbfa4b to 5d53a51 Compare August 27, 2026 19:53
@marti4d
marti4d force-pushed the isolated_process/16-remote-io-and-wire-format branch from 34fe884 to b362d07 Compare September 1, 2026 20:12
Base automatically changed from isolated_process/16-remote-io-and-wire-format to main September 1, 2026 20:18
@marti4d
marti4d force-pushed the isolated_process/17-remote-executor branch from 5d53a51 to 99f7fa2 Compare September 1, 2026 20:19
@gabrielesvelto gabrielesvelto left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(())
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Add a blank line between each function

@marti4d
marti4d merged commit 3019c10 into main Sep 2, 2026
15 of 16 checks passed
@marti4d
marti4d deleted the isolated_process/17-remote-executor branch September 2, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0