[CRIU] [PATCH 0/7] crtools: Remote syscalls execution

Pavel Emelyanov xemul at parallels.com
Mon Dec 17 15:29:37 EST 2012


Hi

This is a new out-of-order feature for crtools, that came to my
mind while reading feedback from people and working on iterative
migration.

The idea is -- make it possible to call arbitrary system call
from remote task context using crtools command line. The syntax
is simple (for now)

# crtools exec -t <pid> <syscall_name> [<arguments>]

Arguments are treated as

* numbers passed as is (after strtol) to the system call
* if started with '&' -- strings that are copied to the target
  task memory and the pointer to it is passed as syscall arg

The syscall return code is printed at the end. In plans -- add
the third type of argument, '@<size>' which means -- allocate
a buffer of <size> bytes in target task's address space, pass
pointer to it into syscall and dump the buffer contents at the
end.

With this you can do, for example, fd substitution like this

# kill -STOP <pid>
# crtools exec -t <pid> sys_close <fd>
# touch <file>
# crtools exec -t <pid> sys_open '&<file>' 2
# kill -CONT <pid>

Need the dup2 syscall in our syscall table definitions to make
it work reliably :)

Or enforce madvise bits on already created foreign mappings with

# crtools exec -t <pid> sys_madvise 0x12345 0x1000 <madv_flags>

Funny thing to play with, isn't it? Comments are welcome.

Thanks,
Pavel


More information about the CRIU mailing list