Skip to content

Commit

Permalink
kerndat: Skip clone3(set_tid) when unprivileged.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
osctobe committed Nov 14, 2023
1 parent c474816 commit d8d18f7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions criu/kerndat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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;
}
Expand Down

0 comments on commit d8d18f7

Please sign in to comment.