mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-02 15:25:21 +00:00
fowners: Add checkpoint/restore for sockets
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
df6d5cfb23
commit
a8840ba721
@@ -93,7 +93,7 @@ out:
|
|||||||
pr_img_tail(CR_FD_FDINFO);
|
pr_img_tail(CR_FD_FDINFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_fown_cont(fown_t *fown)
|
void show_fown_cont(fown_t *fown)
|
||||||
{
|
{
|
||||||
pr_msg("fown: uid: %x euid: %x signum: %x pid_type: %x pid: %u",
|
pr_msg("fown: uid: %x euid: %x signum: %x pid_type: %x pid: %u",
|
||||||
fown->uid, fown->euid, fown->signum, fown->pid_type, fown->pid);
|
fown->uid, fown->euid, fown->signum, fown->pid_type, fown->pid);
|
||||||
|
@@ -94,6 +94,7 @@ void show_sigacts(int fd_sigacts, struct cr_options *o);
|
|||||||
void show_itimers(int fd, struct cr_options *o);
|
void show_itimers(int fd, struct cr_options *o);
|
||||||
void show_creds(int fd, struct cr_options *o);
|
void show_creds(int fd, struct cr_options *o);
|
||||||
void show_fs(int fd, struct cr_options *o);
|
void show_fs(int fd, struct cr_options *o);
|
||||||
|
void show_fown_cont(fown_t *fown);
|
||||||
|
|
||||||
extern struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX];
|
extern struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX];
|
||||||
|
|
||||||
|
@@ -114,6 +114,7 @@ struct unix_sk_entry {
|
|||||||
u32 flags;
|
u32 flags;
|
||||||
u32 backlog;
|
u32 backlog;
|
||||||
u32 peer;
|
u32 peer;
|
||||||
|
fown_t fown;
|
||||||
u8 name[0];
|
u8 name[0];
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
@@ -127,6 +128,7 @@ struct inet_sk_entry {
|
|||||||
u16 dst_port;
|
u16 dst_port;
|
||||||
u32 flags;
|
u32 flags;
|
||||||
u32 backlog;
|
u32 backlog;
|
||||||
|
fown_t fown;
|
||||||
u32 src_addr[4];
|
u32 src_addr[4];
|
||||||
u32 dst_addr[4];
|
u32 dst_addr[4];
|
||||||
} __packed;
|
} __packed;
|
||||||
|
15
sockets.c
15
sockets.c
@@ -326,6 +326,7 @@ static int dump_one_inet(struct socket_desc *_sk, struct fd_parms *p,
|
|||||||
ie.dst_port = sk->dst_port;
|
ie.dst_port = sk->dst_port;
|
||||||
ie.backlog = sk->wqlen;
|
ie.backlog = sk->wqlen;
|
||||||
ie.flags = p->flags;
|
ie.flags = p->flags;
|
||||||
|
ie.fown = p->fown;
|
||||||
memcpy(ie.src_addr, sk->src_addr, sizeof(u32) * 4);
|
memcpy(ie.src_addr, sk->src_addr, sizeof(u32) * 4);
|
||||||
memcpy(ie.dst_addr, sk->dst_addr, sizeof(u32) * 4);
|
memcpy(ie.dst_addr, sk->dst_addr, sizeof(u32) * 4);
|
||||||
|
|
||||||
@@ -395,6 +396,7 @@ static int dump_one_unix(const struct socket_desc *_sk, struct fd_parms *p,
|
|||||||
ue.flags = p->flags;
|
ue.flags = p->flags;
|
||||||
ue.backlog = sk->wqlen;
|
ue.backlog = sk->wqlen;
|
||||||
ue.peer = sk->peer_ino;
|
ue.peer = sk->peer_ino;
|
||||||
|
ue.fown = p->fown;
|
||||||
|
|
||||||
if (ue.peer) {
|
if (ue.peer) {
|
||||||
struct unix_sk_desc *peer;
|
struct unix_sk_desc *peer;
|
||||||
@@ -957,6 +959,9 @@ static int open_inet_sk(struct file_desc *d)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (restore_fown(sk, &ii->ie.fown))
|
||||||
|
goto err;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Listen sockets are easiest ones -- simply
|
* Listen sockets are easiest ones -- simply
|
||||||
* bind() and listen(), and that's all.
|
* bind() and listen(), and that's all.
|
||||||
@@ -1087,6 +1092,7 @@ void show_inetsk(int fd, struct cr_options *o)
|
|||||||
pr_msg("id %x family %s type %s proto %s state %s %s:%d <-> %s:%d flags %2x\n",
|
pr_msg("id %x family %s type %s proto %s state %s %s:%d <-> %s:%d flags %2x\n",
|
||||||
ie.id, skfamily2s(ie.family), sktype2s(ie.type), skproto2s(ie.proto),
|
ie.id, skfamily2s(ie.family), sktype2s(ie.type), skproto2s(ie.proto),
|
||||||
skstate2s(ie.state), src_addr, ie.src_port, dst_addr, ie.dst_port, ie.flags);
|
skstate2s(ie.state), src_addr, ie.src_port, dst_addr, ie.dst_port, ie.flags);
|
||||||
|
pr_msg("\t"), show_fown_cont(&ie.fown), pr_msg("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
@@ -1123,6 +1129,7 @@ void show_unixsk(int fd, struct cr_options *o)
|
|||||||
pr_msg(" --> %s\n", buf);
|
pr_msg(" --> %s\n", buf);
|
||||||
} else
|
} else
|
||||||
pr_msg("\n");
|
pr_msg("\n");
|
||||||
|
pr_msg("\t"), show_fown_cont(&ue.fown), pr_msg("\n");
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
pr_img_tail(CR_FD_UNIXSK);
|
pr_img_tail(CR_FD_UNIXSK);
|
||||||
@@ -1282,6 +1289,11 @@ static int open_unixsk_pair_master(struct unix_sk_info *ui)
|
|||||||
if (set_fd_flags(sk[1], peer->ue.flags))
|
if (set_fd_flags(sk[1], peer->ue.flags))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (restore_fown(sk[0], &ui->ue.fown))
|
||||||
|
return -1;
|
||||||
|
if (restore_fown(sk[1], &peer->ue.fown))
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (bind_unix_sk(sk[0], ui))
|
if (bind_unix_sk(sk[0], ui))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@@ -1339,6 +1351,9 @@ static int open_unixsk_standalone(struct unix_sk_info *ui)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (restore_fown(sk, &ui->ue.fown))
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (bind_unix_sk(sk, ui))
|
if (bind_unix_sk(sk, ui))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user