mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 01:51:51 +00:00
rpc: Support setting images_dir by path.
Google's RPC client process is in a different pidns and has more privileges -- CRIU can't open its /proc/<pid>/fd/<fd>. For images_dir_fd to be useful here it would need to refer to a passed or CRIU's fd. From: Michał Cłapiński <mclapinski@google.com> Change-Id: Icbfb5af6844b21939a15f6fbb5b02264c12341b1 Signed-off-by: Michał Mirosław <emmir@google.com>
This commit is contained in:
parent
439b522433
commit
2aa9cb9333
@ -382,8 +382,14 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
|
||||
*/
|
||||
if (imgs_changed_by_rpc_conf)
|
||||
strncpy(images_dir_path, opts.imgs_dir, PATH_MAX - 1);
|
||||
else
|
||||
else if (req->images_dir_fd != -1)
|
||||
sprintf(images_dir_path, "/proc/%d/fd/%d", ids.pid, req->images_dir_fd);
|
||||
else if (req->images_dir)
|
||||
strncpy(images_dir_path, req->images_dir, PATH_MAX - 1);
|
||||
else {
|
||||
pr_err("Neither images_dir_fd nor images_dir was passed by RPC client.\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (req->parent_img)
|
||||
SET_CHAR_OPTS(img_parent, req->parent_img);
|
||||
|
@ -61,7 +61,8 @@ enum criu_pre_dump_mode {
|
||||
};
|
||||
|
||||
message criu_opts {
|
||||
required int32 images_dir_fd = 1;
|
||||
required int32 images_dir_fd = 1 [default = -1];
|
||||
optional string images_dir = 68; /* used only if images_dir_fd == -1 */
|
||||
optional int32 pid = 2; /* if not set on dump, will dump requesting process */
|
||||
|
||||
optional bool leave_running = 3;
|
||||
|
Loading…
x
Reference in New Issue
Block a user