[CRIU] [PATCH CRIU] rst: set mode on ghost-files after write

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Fri Dec 18 09:12:32 PST 2015


Do so as in user-namespace on mainstream kernel writing to file
with suid bit set always cleares these bit, regardless to CAP_FSETID.
(see in should_remove_suid plane capable() is used, and same in VZ7)

Also we have an alternative to wait while several patches will get
in MS kernel:

[PATCH v4 0/7] Initial support for user namespace owned mounts
https://lkml.org/lkml/2015/9/23/591
[PATCH v2 12/18] fs: Don't remove suid for CAP_FSETID in s_user_ns
http://www.spinics.net/lists/linux-fsdevel/msg92533.html

Got error while suspending/resuming file_attr test in VZ7CT:
CT-102 criu# cat test/zdtm/live/static/file_attr.out
13:11:01.952: 30635: FAIL: file_attr.c:96: permissions have changed
(errno = 11 (Resource temporarily unavailable))

https://jira.sw.ru/browse/PSBM-41401
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 files-reg.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/files-reg.c b/files-reg.c
index 425dc04..9c003bc 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -150,6 +150,11 @@ static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_im
 			goto err_c;
 	}
 
+	if (fchmod(gfd, gfe->mode)) {
+		pr_perror("Can't set perms %o on ghost %s", perms, filename);
+		goto err_c;
+	}
+
 	ret = 0;
 err_c:
 	close(gfd);
-- 
1.9.3



More information about the CRIU mailing list