-
Notifications
You must be signed in to change notification settings - Fork 5
[RFC] Ptrace Based RPC #46
Comments
if let Some(hello) = get_symbol_address(task.getpid(), "hello") {
unsafe {
let args: [u64; 6] = [1,2,3,4,5,6];
rpc_call(&task, hello.as_ptr() as u64, &args);
}
}; I've pushed a half baked solution into branch: https://github.com/iu-parfunc/systrace/blob/global-process-states/src/rpc_ptrace.rs I've managed to inject a function call (takes 6 arguments) without segfault the tracee |
@wangbj, eventually Global-only Reverie will work (#53), and you will start shifting things back down to in-guest execution. When that happens, do you think there will be a place for this ptrace-based calling from tracer->guest? Or will it be subsumed by some other RPC framework? It seems like there will be particular moments in time where control goes from tracer->guest. I'm thinking for instance of the point just after the "early" syscalls, when the tracer will probably migrate process/thread states to the guest... |
yes, even now we can call tracee function in the tracer, so we can do |
What are the challenges exactly? Doing RPC from inside the guest definitely seems like a big challenge (the same Chai is facing). For serialization can't we just require Serde instances? Maintaining a coherent view of global/process/thread states should be easy in the global-only version (i.e. a big hashmap of process/thread states), right? But, yes, I can see that it gets challenging when the state needs to migrate. You need to identify an atomic commit point at which a process state (and its thread states) migrate from tracer->guest. I guess the loader-shim code that you run via LD_PRELOAD could itself create a "Done" event that the tracer recognizes as the trigger for migration. The state is unavailable to new event callbacks while this migration is occurring. If the tool sitting on Reverie is executing the process sequentially, it shouldn't be too much of an imposition because blocking on one event handler is effectively blocking the whole process. However, Reverie ultimately can't assume sequential execution ... nevertheless, if the migration happens right after the tool is dynamically loaded, then that should be before |
These are my comments for the RFC: ptraced based RPC
While I agree this may be useful, after reading the entire RFC, it seems it has a high complexity and implementation cost. With that in mind, do we really need it? Or how useful RPC functionality actually be?
Some more specific comments:
Doesn't the function call ABI usually want the arguments passed through the registers? AMD64 System V ABI
If we restrict the number of arguments we might get away with avoiding passing through the stack. We could try avoiding pointers? It really depends what our use-case is...
Threads definitely make the page idea difficult to use...
The text was updated successfully, but these errors were encountered: