2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00

mount: prevent dumping nested mount namespace without mnt_id in fdinfo

When we don't know mnt_id, we don't know to which namespace a file
belongs.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin 2014-04-21 18:23:49 +04:00 committed by Pavel Emelyanov
parent 8620912d22
commit 85569e8dd4
3 changed files with 11 additions and 2 deletions

View File

@ -249,7 +249,7 @@ static int check_one_sfd(union fdinfo_entries *e, void *arg)
return 0;
}
static int check_mnt_id(void)
int check_mnt_id(void)
{
struct fdinfo_common fdinfo = { .mnt_id = -1 };
int ret;

View File

@ -176,4 +176,6 @@ extern int parse_file_locks(void);
struct pid;
extern int parse_threads(int pid, struct pid **_t, int *_n);
extern int check_mnt_id(void);
#endif /* __CR_PROC_PARSE_H__ */

View File

@ -1902,7 +1902,7 @@ err:
int dump_mnt_namespaces(void)
{
struct ns_id *ns;
int ret = 0;
int ret = 0, n = 0;
for (ns = ns_ids; ns; ns = ns->next) {
/* Skip current namespaces, which are in the list too */
@ -1917,6 +1917,13 @@ int dump_mnt_namespaces(void)
if (!(ns->nd->cflag & CLONE_NEWNS))
continue;
n++;
if (n == 2 && check_mnt_id()) {
pr_err("Nested mount namespaces are not supported "
"without mnt_id in fdinfo\n");
return -1;
}
pr_info("Dump MNT namespace (mountpoints) %d via %d\n",
ns->id, ns->pid);
ret = dump_mnt_ns(ns);