Skip to content

Commit a402f1e

Browse files
tklauserbrauner
authored andcommitted
fork: allow CLONE_NEWTIME in clone3 flags
Currently, calling clone3() with CLONE_NEWTIME in clone_args->flags fails with -EINVAL. This is because CLONE_NEWTIME intersects with CSIGNAL. However, CSIGNAL was deprecated when clone3 was introduced in commit 7f192e3 ("fork: add clone3"), allowing re-use of that part of clone flags. Fix this by explicitly allowing CLONE_NEWTIME in clone3_args_valid. This is also in line with the respective check in check_unshare_flags which allow CLONE_NEWTIME for unshare(). Fixes: 769071a ("ns: Introduce Time Namespace") Cc: Andrey Vagin <avagin@openvz.org> Cc: Christian Brauner <brauner@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
1 parent fe15c26 commit a402f1e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/fork.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2936,7 +2936,7 @@ static bool clone3_args_valid(struct kernel_clone_args *kargs)
29362936
* - make the CLONE_DETACHED bit reusable for clone3
29372937
* - make the CSIGNAL bits reusable for clone3
29382938
*/
2939-
if (kargs->flags & (CLONE_DETACHED | CSIGNAL))
2939+
if (kargs->flags & (CLONE_DETACHED | (CSIGNAL & (~CLONE_NEWTIME))))
29402940
return false;
29412941

29422942
if ((kargs->flags & (CLONE_SIGHAND | CLONE_CLEAR_SIGHAND)) ==

0 commit comments

Comments
 (0)