Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3352944ybc; Thu, 14 Nov 2019 07:52:46 -0800 (PST) X-Google-Smtp-Source: APXvYqzaLa5NhMrTGkXoyZFqnZpQfLoRislESc964Og2Tzilq9bE3RAw73ZpLdnjmm8mE4eQIzJ+ X-Received: by 2002:aa7:c048:: with SMTP id k8mr2024267edo.254.1573746766560; Thu, 14 Nov 2019 07:52:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573746766; cv=none; d=google.com; s=arc-20160816; b=HN8UiRl9gO9uSUJNQ9Onf1BDOZz6O7Map6DgFOJ+U76cIl7wTSQqDvTpQbkUfQtwYz CYt35EjojiCiZaPeNIYAMiSnMLg/O7RovuNPV03qMx33jMuvalBMtRZpRjNZPijwydUt m18hjT5uSUU63C9yxrPFkYAwzEeAHNozeBTvK2TUR/POgOYulLfWOv0kBwY431lpxPgb qwUKLsRcAER5rSmtq4p1wTv7+m8Fhp6NbJwFEgYnyeKl/B2otmOuqOl+a0jBEWlOvxo/ fFbjmfEyuKZmZZJecreeOIos8YhM8U6MQwT8gHUTEcokxmttLEKuW2xyQzAk42Qk2Sau s9aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:user-agent:in-reply-to:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Z8E5cXowWr1O13DnEmVkHrlVMAGQPuBVPxrFRLhWJ1k=; b=hbp/EzSdby8ksP7LNFljlWOKNwQefJrcDRwKDqY3x084/yOFPL61QTf3YxUAkCe/UW LMU9+1kgH9PEqYX+8EFXgTWzVAAcjR9Cbkda6/Be6WDNPDUkV9XTLgjOxs4mxP6optRR ZCcYiOM3cjXEVIKfoCFK6toOAjwxcNBf5WQDFk3nDvQJg2/p3vqzT0CpgPGVWgLAj+Zd WkXiCR2+bAGX3e1l+DiKj5R+o6CpGTvjzI8Fuqwb4432vCDRgcXxDzLTyRoZScqLmo6k 1ZrEK7LYFRDgf9rsICQW9CqP6vewNkg+/eHXn/JXKKOKIzRPtSFhpwWN5aYVAyCb2dUt Vlkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Tv9DlHVk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f17si3778735edx.113.2019.11.14.07.52.20; Thu, 14 Nov 2019 07:52:46 -0800 (PST) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Tv9DlHVk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726923AbfKNPvC (ORCPT + 99 others); Thu, 14 Nov 2019 10:51:02 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:55092 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726852AbfKNPvC (ORCPT ); Thu, 14 Nov 2019 10:51:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573746661; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z8E5cXowWr1O13DnEmVkHrlVMAGQPuBVPxrFRLhWJ1k=; b=Tv9DlHVkBehsR3KbbSZGChG7rtzju4ahFnjwEZIoup7UmftsF18/WY1ZVVr+eJxybx1xW8 sL46Agu9xsy1TUaqKxvXaLb3CCqyEKcU6avm6cIDxxmx6s6Qm+Cy8pLJPXjqhXsgIoGI8K 6KkZdzOa0FHB6p/TF9wz0hSbn3MASIk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-301-1-d2r7wZMWmKVJxEHzlvuA-1; Thu, 14 Nov 2019 10:50:58 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E5C218CA4D6; Thu, 14 Nov 2019 15:50:55 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.44]) by smtp.corp.redhat.com (Postfix) with SMTP id BD6406117F; Thu, 14 Nov 2019 15:50:53 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 14 Nov 2019 16:50:55 +0100 (CET) Date: Thu, 14 Nov 2019 16:50:52 +0100 From: Oleg Nesterov To: Adrian Reber Cc: Christian Brauner , Eric Biederman , Pavel Emelyanov , Jann Horn , Dmitry Safonov <0x7f454c46@gmail.com>, Rasmus Villemoes , linux-kernel@vger.kernel.org, Andrei Vagin , Mike Rapoport , Radostin Stoyanov Subject: Re: [PATCH v10 1/2] fork: extend clone3() to support setting a PID Message-ID: <20191114155052.GA13149@redhat.com> References: <20191114142707.1608679-1-areber@redhat.com> MIME-Version: 1.0 In-Reply-To: <20191114142707.1608679-1-areber@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: 1-d2r7wZMWmKVJxEHzlvuA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/14, Adrian Reber wrote: > > @@ -2600,6 +2602,15 @@ noinline static int copy_clone_args_from_user(stru= ct kernel_clone_args *kargs, > =09if (err) > =09=09return err; > > +=09if (unlikely(args.set_tid_size > MAX_PID_NS_LEVEL)) > +=09=09return -EINVAL; so we need this to because copy_from_user() below writes into the set_tid[MAX_PID_NS_LEVEL] on the caller's stack, then later alloc_pid() does another "correct" check... We could simply shift that check here, but probably this would be less clear, so I won't argue. > @@ -2617,8 +2628,16 @@ noinline static int copy_clone_args_from_user(stru= ct kernel_clone_args *kargs, > =09=09.stack=09=09=3D args.stack, > =09=09.stack_size=09=3D args.stack_size, > =09=09.tls=09=09=3D args.tls, > +=09=09.set_tid_size=09=3D args.set_tid_size, > =09}; ... > +=09kargs->set_tid =3D kset_tid; this looks a bit strange, you could simply do =09=09.set_tid_size =3D args.set_tid_size, =09=09.set_tid=09=3D kset_tid, but this is really minor. Looks good to me, Reviewed-by: Oleg Nesterov