[22/28] files: Declare structures of fake masters

Submitted by Kirill Tkhai on June 5, 2017, 5:26 p.m.

Details

Message ID 149668360231.25229.7747564014899571951.stgit@localhost.localdomain
State New
Series "Support sockets leaked to child user_ns task"
Headers show

Commit Message

Kirill Tkhai June 5, 2017, 5:26 p.m.
Fake masters are files, which are not owned by
a process, that is able to open them.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 criu/files.c         |    3 +++
 criu/include/files.h |    2 ++
 2 files changed, 5 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/files.c b/criu/files.c
index eaa41d3a6..fbf809641 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -53,6 +53,8 @@ 
 
 #define FDESC_HASH_SIZE	64
 static struct hlist_head file_desc_hash[FDESC_HASH_SIZE];
+/* file_desc's, which fle is not owned by a process, that is able to open them */
+static LIST_HEAD(fake_master_head);
 
 int prepare_shared_fdinfo(void)
 {
@@ -67,6 +69,7 @@  int prepare_shared_fdinfo(void)
 void file_desc_init(struct file_desc *d, u32 id, struct file_desc_ops *ops)
 {
 	INIT_LIST_HEAD(&d->fd_info_head);
+	INIT_LIST_HEAD(&d->fake_master_list);
 	INIT_HLIST_NODE(&d->hash);
 
 	d->id	= id;
diff --git a/criu/include/files.h b/criu/include/files.h
index 520abf668..fd2d20761 100644
--- a/criu/include/files.h
+++ b/criu/include/files.h
@@ -118,6 +118,8 @@  struct file_desc {
 	struct list_head	fd_info_head;	/* Chain of fdinfo_list_entry-s with same ID and type but different pids */
 	struct file_desc_ops	*ops;		/* Associated operations */
 	struct ns_id		*setns_userns;	/* Minimal user_ns to be able to restore this file */
+	struct list_head	fake_master_list;/* To chain in the list of file_desc, which don't
+						    have a fle in a task, that having permissions */
 };
 
 struct fdtype_ops {