From c8082ceb98dfbac8cedd4e4c5e362b0e8529af34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Date: Thu, 24 Aug 2023 21:19:48 +0200 Subject: [PATCH] kerndat: Skip clone3(set_tid) when unprivileged. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit clone3(set_tid) requires CAP_CHECKPOINT_RESTORE we might not have. Assume that if it errored out with EPERM it's there and might be usable from inside a user namespace. Change-Id: I3ef5ab98ba1baac1e0b0202b04518ad2b2fea2b1 Signed-off-by: Michał Mirosław --- criu/kerndat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/criu/kerndat.c b/criu/kerndat.c index fef5a46c19..04032e6290 100644 --- a/criu/kerndat.c +++ b/criu/kerndat.c @@ -1400,12 +1400,13 @@ static bool kerndat_has_clone3_set_tid(void) pid_t pid; struct _clone_args args = {}; + kdat.has_clone3_set_tid = false; + #if defined(CONFIG_MIPS) /* * Currently the CRIU PIE assembler clone3() wrapper is * not implemented for MIPS. */ - kdat.has_clone3_set_tid = false; return 0; #endif @@ -1427,7 +1428,7 @@ static bool kerndat_has_clone3_set_tid(void) if (errno == ENOSYS || errno == E2BIG) return 0; - if (errno != EINVAL) { + if (errno != EINVAL && errno != EPERM) { pr_pwarn("Unexpected error from clone3"); return 0; }