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 C061B4431 for ; Wed, 15 Mar 2023 12:31:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4757DC433D2; Wed, 15 Mar 2023 12:31:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678883483; bh=oXu2jLP+O8FUZrM4yzU6JR3gso3nudiX27D0xM0OCLE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g3mKCoCxCLJk3ZBBIf9+igfjfU3BeiLGR5A2Ku/P5fmNG7aHys4NToJeJqp4SupTu 4Eaz9QRDVdtzhYrkSoq7lki1jHDzL7rTNP81yAg/tsNAYjXAJB8blyAllqngXJwqNc n1/+CUC4GtPZWnWoX7eK2txwk54kbnBpccMn6h88= 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.1 007/143] fork: allow CLONE_NEWTIME in clone3 flags Date: Wed, 15 Mar 2023 13:11:33 +0100 Message-Id: <20230315115740.680355103@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230315115740.429574234@linuxfoundation.org> References: <20230315115740.429574234@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 @@ -2928,7 +2928,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)) ==