Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp5760841ybh; Wed, 7 Aug 2019 10:58:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfF5fXBer9MCuvnmdMawllPDi8Kwxbw+KwG6DULEhKwJg5h4U7vxAUkoXCAbYNURSjsCqM X-Received: by 2002:a63:d210:: with SMTP id a16mr8600566pgg.77.1565200711228; Wed, 07 Aug 2019 10:58:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565200711; cv=none; d=google.com; s=arc-20160816; b=c2gtVKZtF5Bf1nhzqrtk6OfsxJyHaPGJZj+ziDEJfdItSeDHzb0qirD9/8WTaqe5is /4RuzJwGxwn70JKz0crxCZA+PVVyvBAN4rppJUB3tRF+hbp2htcL0VxpHXOet6VagWGn N7SyfVyZ1oelxstWaIZhdQ16Mw1NCsknRMCxkEpLu2uYneoK8qS01FuxbSlZBpXPdN7N PQa4xEVDkwkmXzrtKKYgfdMBSNldFUEfoAwPv9rPXcY6ZTAVvaLWHRwKMtwlxGgH9cDA FeWaWGOT1O83TPIw6evHIwG5xCZWwjiOvGFKEYP66pbDc5GuXhFMhAQKlUWLtOsJoH56 hDIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=OqW1NSJmSrJe6LdEQDP3AgLWIpYolmVgSKYzMbtPP9A=; b=HWcw5zZFttdWWCsTkFiO9Rgijshwpjcz3MQQ1uRYy0XDkTEtJ75l9zDQeFx7ZtNhig Btwxn4RUXYYtmedinLh1ZBWkO2y/3XVELHP6tkl/JkKWPcoXSzzCy19NSTyx5oQF2BrF 3XHbwp6pqfZRQdBPY6qd1WReYnxz49XEJ7xZuztv5O6PN/H2ZYSHbOZUrehhhl37KA62 Fw3YgeiyFba12Ml3pX5fKjYwI7WzCW2M//+L4CATEev7gN0AfC8CXrUqCdauvUHHTl3m WBVZpF9tkyKSQgWxljQhI30Ywz4e8E7STrfNLqqvE6nskBt1YV9orT4lKTnssOaa1Zrn ch9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s15si50637653pgm.413.2019.08.07.10.58.15; Wed, 07 Aug 2019 10:58:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388669AbfHGRzg (ORCPT + 99 others); Wed, 7 Aug 2019 13:55:36 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:58391 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387952AbfHGRzg (ORCPT ); Wed, 7 Aug 2019 13:55:36 -0400 Received: from c-67-180-61-213.hsd1.ca.comcast.net ([67.180.61.213] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1hvQ9f-0007M4-6W; Wed, 07 Aug 2019 17:55:19 +0000 Date: Wed, 7 Aug 2019 19:55:12 +0200 From: Christian Brauner To: Adrian Reber Cc: Eric Biederman , Pavel Emelianov , Jann Horn , Oleg Nesterov , Dmitry Safonov <0x7f454c46@gmail.com>, linux-kernel@vger.kernel.org, Andrei Vagin , Mike Rapoport , Radostin Stoyanov Subject: Re: [PATCH v3 1/2] fork: extend clone3() to support CLONE_SET_TID Message-ID: <20190807175511.xchtx764hkkervu3@wittgenstein> References: <20190806191551.22192-1-areber@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190806191551.22192-1-areber@redhat.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 06, 2019 at 09:15:50PM +0200, Adrian Reber wrote: > The main motivation to add set_tid to clone3() is CRIU. > > To restore a process with the same PID/TID CRIU currently uses > /proc/sys/kernel/ns_last_pid. It writes the desired (PID - 1) to > ns_last_pid and then (quickly) does a clone(). This works most of the > time, but it is racy. It is also slow as it requires multiple syscalls. > > Extending clone3() to support set_tid makes it possible restore a > process using CRIU without accessing /proc/sys/kernel/ns_last_pid and > race free (as long as the desired PID/TID is available). > > This clone3() extension places the same restrictions (CAP_SYS_ADMIN) > on clone3() with set_tid as they are currently in place for ns_last_pid. > > Signed-off-by: Adrian Reber I'm currently on vacation until 12 August so I'm going to be a little slow in responding. Sorry about that! Christian