[CRIU] [PATCH 3/3] seccomp: Don't lookup for pidns in restore_seccomp

Cyrill Gorcunov gorcunov at gmail.com
Tue May 15 11:12:40 MSK 2018


Looking up for pid in nesting pidns supposed to be done
for non group leaders only, thus __export_restore_thread
do this check on its own and we don't have to make
a similar lookup especially on group leader where
pids in args never were valid.

Reported-by: Andrei Vagin <avagin at virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 criu/pie/restorer.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
index 8189da2efa50..5ea445cc7fb3 100644
--- a/criu/pie/restorer.c
+++ b/criu/pie/restorer.c
@@ -445,21 +445,8 @@ static int restore_seccomp_filter(pid_t tid, struct thread_restore_args *args)
 
 static int restore_seccomp(struct thread_restore_args *args)
 {
-	pid_t tid = 0;
-	int ret, i;
-
-	for (i = 0; i < MAX_NS_NESTING; i++) {
-		if (args->pid[i] == 0) {
-			tid = args->pid[i - 1];
-			break;
-		}
-	}
-
-	if (tid != sys_gettid()) {
-		pr_err("seccomp: Unexpected tid %d != %d\n",
-		       tid, (pid_t)sys_gettid());
-		return -1;
-	}
+	pid_t tid = sys_gettid();
+	int ret;
 
 	switch (args->seccomp_mode) {
 	case SECCOMP_MODE_DISABLED:
-- 
2.14.3



More information about the CRIU mailing list