Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1413071rdb; Tue, 30 Jan 2024 19:12:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQPq9yll5LG+LIo4aXEmRSN93vvTjiLh6S8yq3lbpb+y0/V/IgCdKdcXeHyKSFJ92eX49r X-Received: by 2002:ac2:5e7b:0:b0:510:fdd:37d3 with SMTP id a27-20020ac25e7b000000b005100fdd37d3mr264941lfr.65.1706670745095; Tue, 30 Jan 2024 19:12:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706670745; cv=pass; d=google.com; s=arc-20160816; b=yw/Dxp7oqlkBWNpBhEt17WmKD1MVOMjOzj3xSWkobnOrMibeP+emIOelVAVj1hCxXQ pinbfyrwEVep5kwI7HGdSHOTzFqpkhZZFa+EbBNUHJH6XsoUD9vbbvkakzhjLtsF4KDH D1Y2BOQsmSRVeBJujwYs8pEU0yFXBTXCNAAX07gYXXN6ewLJDOySUZUWB4Qsjo3gaByJ xcQEJBJiMI8f3WWd8IRIPaSfc2DjrwtJgAIL7Nk4XDGbA+ORmbUP+ED5IcllF9fmnjLD k3ycdz25Be8ndS+vArc4M7J0zHcYZdadLeRxZ4csnWZqsNGG0tbBr7cKETXHhrczUYPM Bgvw== 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=sqEJtujLi5DUsBOSAcP2H1HS5FzGeTrHTIvxCwz3yB4=; b=lT9MQZI9XY8O0Cg9/loWQVCrJsFW6+a4H+gjvi7YO0Lot+x7GyjRjfLrGhLSMfSk5Z qmVlZL2GuE/6Z/bWIZ3ZZEO8pwVl+FrahtXlspJABbSb9Is2k413lnmaovJBVknEQI8N 1jm69BXJX5Je0NodkTK0vWgm1rEZZiituNTqRfuXZQLbaI0iE6SLIAIcAk1RSFDPq6cO zdY2n55p2Dhw3SthWqJNC6hd/DaAnvgWpcLmaXlubox+GaVrexu8M8pztipNbNd6LqCo Y6RO5EoQa/DXmJ+L/SGfMWPBdszJq3vapvQRHkTaSK323mJSP++wn1nE6UhdLsI5FY9n KEAQ==; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45702-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCX6IUKmVdloT88H9DnE8EIqbggfqbiGg017wRT0CCRHIH4JPuRBP/BcQPYI/MGF0dwTPwhSgGniQLGjkPwGXSp8N27Izb/Nw8mlIMiRWg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id eh3-20020a0564020f8300b0055f0014e1b2si2517836edb.387.2024.01.30.19.12.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 19:12:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45702-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=xfusion.com); spf=pass (google.com: domain of linux-kernel+bounces-45702-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45702-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id D145E1F256A7 for ; Wed, 31 Jan 2024 03:12:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA72D1BC49; Wed, 31 Jan 2024 03:12:17 +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-Type: text/plain; charset="us-ascii" Content-Disposition: inline X-ClientProxiedBy: wuxshcsitd00602.xfusion.com (10.32.132.250) To wuxshcsitd00600.xfusion.com (10.32.133.213) 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; -- 2.40.0