From patchwork Wed Jan 31 02:54:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Jinchao X-Patchwork-Id: 194474 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1642964dyb; Tue, 30 Jan 2024 19:13:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHeeHYigHFG+J2HFEZXLpIDBRw2HrwrZiOnKQzGVtMQR1QGWVb7ZwNa8tRSpD48hlDNpunp X-Received: by 2002:a05:6870:1583:b0:218:6694:64c7 with SMTP id j3-20020a056870158300b00218669464c7mr532405oab.22.1706670790313; Tue, 30 Jan 2024 19:13:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706670790; cv=pass; d=google.com; s=arc-20160816; b=Ic3r4Nrrs8le9z6jyDJ65XTVmc5Aowm91xai1gAZWmPuu/GJMvkT5ixdvapgX7azYY 0a1ZKYAHBL/76NmMTE9Y1A8iScMGthgvEpgUOpEItT9bL9+S+4LE6t9+Hh+pd6r4yyCQ uOIRBGlvCfQKuLtG1jBwyEa4aoCmX0ESkrLZqkxkHc2tyeocv/qvWU10tZM3w4P+Msoe dZYPBYbTTCjUlwPaazTHQ0hVD3f3WNzoK5pthiNMKLzxhkHDglie779HYKOjzfCWg5hW OaR+6UWypr/pOoWrT6jX+72HR9iqXuXQm7E6IvMIO2cSH9yxShT9CkTdBcSs8XvV+Att AscQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date; bh=XKPJBIcraTwb0DQvkzN3M8Yd+DnvBgMV441NAK3d0LA=; fh=UU7pKJFNenmYAeJ5xXyWouTzS94lLff2iVjPiFtQUiE=; b=Yop5WV4yB5sG2kVU+X0PND+lMxWyQWGrsTctr7clqwpMy7CG0izb2zIhnWW4My1zWu ra7A6GpQKHr9NA6qZ61Fl/I74aQK5vXIyu7OjMc90M5JVbwxzMwcQwE2lOJgB9IVoUO6 eM8LC005WEy2uDAJMAU4GQrpyBnTSH1ts527l8Wc+nE13qhaaU46IrK78x18M/t3ni5I OGbOfnWIKjyQ8SIkQ6UCsQib+Sq23xqOPk47xvWVCeEuz+tfZopBokmrnuD0y7mOdU/+ zXhBBdM6HDp5BmKi7gbbdzkNugaY4L4NKr2pLkoQJMQZu1PblbgzGjA2yi5A9hzoCoWb yyVA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=xfusion.com); spf=pass (google.com: domain of linux-kernel+bounces-45702-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45702-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCXazU5ZfLMpc/2Ial+QFZ3i+uofcwq9W0M6eea+VcUurhyZdRhyXsH71Sv3J0YWbsma1tg7K43IfOGGkwkG2eHFgv11vg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x68-20020a636347000000b005d9b919b966si2146917pgb.374.2024.01.30.19.13.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 19:13:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45702-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=xfusion.com); spf=pass (google.com: domain of linux-kernel+bounces-45702-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45702-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 790A028522A for ; Wed, 31 Jan 2024 03:12:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ECB8F20DE3; Wed, 31 Jan 2024 03:12:18 +0000 (UTC) Received: from wxsgout04.xfusion.com (wxsgout04.xfusion.com [36.139.87.180]) (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 DBACC1862D for ; Wed, 31 Jan 2024 03:12:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=36.139.87.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706670737; cv=none; b=bG5VqQ8YzGRc5mKe6oq+Lq//fWL21VjvNpMnVv7dAjCSToBaMEqVHsV0xBp3xUHqWz0oqqGROhdldH4qcrnDStakqmolHqyP5GrqFjFg6tubgHgNAEwyV9V9r/Hg+ASo0A4wLql/X/m0hMNSS2t1QICIH9FX5LdpoBUgc6QGfD4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706670737; c=relaxed/simple; bh=3vH+tDOzI1Onrb5XmrwRY3DlzQhSj0fHeVpIM7vywME=; h=Date:From:To:CC:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=ZZm8xIWgHJQP1WQ2v0QUtx0KBGueWorCGBWjIvaB1MEcIWPKK7U9eSJ/vIKfEreXyyR64muZtMN9BlABUXI8IDPxzbKgOuLVAaozzlC1JwQpw/2gRZGEUSBunhHj6nLAhi8uBh4Vyk72et711jg7v/oooG82VhlGeeKdqLNpVwY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=xfusion.com; spf=pass smtp.mailfrom=xfusion.com; arc=none smtp.client-ip=36.139.87.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=xfusion.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xfusion.com Received: from wuxshcsitd00600.xfusion.com (unknown [10.32.133.213]) by wxsgout04.xfusion.com (SkyGuard) with ESMTPS id 4TPmpJ1GZjzB2lnX; Wed, 31 Jan 2024 10:54:16 +0800 (CST) Received: from localhost (10.82.147.3) by wuxshcsitd00600.xfusion.com (10.32.133.213) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 31 Jan 2024 10:54:42 +0800 Date: Wed, 31 Jan 2024 10:54:41 +0800 From: Wang Jinchao To: , , CC: , Subject: [PATCH] fork: Using clone_flags for legacy clone check Message-ID: <202401311054+0800-wangjinchao@xfusion.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-ClientProxiedBy: wuxshcsitd00602.xfusion.com (10.32.132.250) To wuxshcsitd00600.xfusion.com (10.32.133.213) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789574030845898606 X-GMAIL-MSGID: 1789574030845898606 In the current implementation of clone(), there is a line that initializes `u64 clone_flags = args->flags` at the top. This means that there is no longer a need to use args->flags for the legacy clone check. Signed-off-by: Wang Jinchao --- kernel/fork.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/fork.c b/kernel/fork.c index 0d944e92a43f..a6c5383288c9 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -2876,8 +2876,8 @@ pid_t kernel_clone(struct kernel_clone_args *args) * here has the advantage that we don't need to have a separate helper * to check for legacy clone(). */ - if ((args->flags & CLONE_PIDFD) && - (args->flags & CLONE_PARENT_SETTID) && + if ((clone_flags & CLONE_PIDFD) && + (clone_flags & CLONE_PARENT_SETTID) && (args->pidfd == args->parent_tid)) return -EINVAL;