[CRIU] [PATCH 02/15] namespaces: Make sure we're not getting stripped inode value

Cyrill Gorcunov gorcunov at openvz.org
Wed Oct 25 11:39:27 MSK 2017


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 criu/include/namespaces.h | 6 ++++++
 criu/namespaces.c         | 1 +
 2 files changed, 7 insertions(+)

diff --git a/criu/include/namespaces.h b/criu/include/namespaces.h
index ef6083c9a944..dab7c84e1a23 100644
--- a/criu/include/namespaces.h
+++ b/criu/include/namespaces.h
@@ -98,6 +98,12 @@ struct net_link {
 	struct list_head	node;
 };
 
+/*
+ * While kernel uses long numbers for ns
+ * enumeration, we don't plan to support
+ * that many namespaces, thus int numbers
+ * are used.
+ */
 struct ns_id {
 	unsigned int kid;
 	unsigned int id;
diff --git a/criu/namespaces.c b/criu/namespaces.c
index 5c46976410e4..d31983a32ed0 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -484,6 +484,7 @@ static unsigned int __get_ns_id(int pid, struct ns_desc *nd, bool alternative,
 		return 0;
 	}
 	kid = st.st_ino;
+	BUG_ON((unsigned long)st.st_ino > (unsigned long)(UINT_MAX));
 	BUG_ON(!kid);
 
 out:
-- 
2.7.5



More information about the CRIU mailing list