[CRIU] [PATCH v2 1/5] seize: Fix size error in creds_dumpable()

Kirill Tkhai ktkhai at virtuozzo.com
Tue Apr 18 08:56:29 PDT 2017


The goal of this function is to compare everything except caps,
but caps size is took to compare. It's wrong, there must be
used offsetof(struct proc_status_creds, cap_inh) instead.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/seize.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/criu/seize.c b/criu/seize.c
index d5079ca6c..eda4e8a27 100644
--- a/criu/seize.c
+++ b/criu/seize.c
@@ -629,8 +629,7 @@ static inline bool thread_collected(struct pstree_item *i, pid_t tid)
 static bool creds_dumpable(struct proc_status_creds *parent,
 				struct proc_status_creds *child)
 {
-	const size_t size = sizeof(struct proc_status_creds) -
-			offsetof(struct proc_status_creds, cap_inh);
+	const size_t size = offsetof(struct proc_status_creds, cap_inh);
 
 	/*
 	 * The comparison rules are the following



More information about the CRIU mailing list