From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B10904431 for ; Wed, 15 Mar 2023 12:38:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38DBFC4339B; Wed, 15 Mar 2023 12:38:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678883915; bh=Knfqm61g8WyM5794wDVLrz+z6TXvHv91vD9Au2PUBvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fh3MazMCTRX9thSG2LvL8ROqMtuuwe+Kjr0fwZhW9OsZWSgpuepwF4KIMDjEIlavT zHPZz25aR5DT07aGGRoEmGcOO9Xij8QZkGn9Aw1ZCK/XRahkZ7mYEi4UQDgoM/h2En z2dG/ob8OK8oCfOeMqLu+lrA6A8+rG0uh4naogH4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andrey Vagin , Christian Brauner , Tobias Klauser Subject: [PATCH 6.2 008/141] fork: allow CLONE_NEWTIME in clone3 flags Date: Wed, 15 Mar 2023 13:11:51 +0100 Message-Id: <20230315115740.218293382@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230315115739.932786806@linuxfoundation.org> References: <20230315115739.932786806@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Tobias Klauser commit a402f1e35313fc7ce2ca60f543c4402c2c7c3544 upstream. 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 7f192e3cd316 ("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: 769071ac9f20 ("ns: Introduce Time Namespace") Cc: Andrey Vagin Cc: Christian Brauner Cc: stable@vger.kernel.org Signed-off-by: Tobias Klauser Reviewed-by: Christian Brauner Signed-off-by: Christian Brauner (Microsoft) Signed-off-by: Greg Kroah-Hartman --- kernel/fork.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/fork.c +++ b/kernel/fork.c @@ -2933,7 +2933,7 @@ static bool clone3_args_valid(struct ker * - make the CLONE_DETACHED bit reusable for clone3 * - make the CSIGNAL bits reusable for clone3 */ - if (kargs->flags & (CLONE_DETACHED | CSIGNAL)) + if (kargs->flags & (CLONE_DETACHED | (CSIGNAL & (~CLONE_NEWTIME)))) return false; if ((kargs->flags & (CLONE_SIGHAND | CLONE_CLEAR_SIGHAND)) ==