Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3580601ybc; Thu, 14 Nov 2019 11:16:50 -0800 (PST) X-Google-Smtp-Source: APXvYqy+2x0xzOjdGlP6eVWa6k1Ty3O8fGAqvDG2egCoP751BMX5uKxWV0Zwq14k3fQKcvOndnmY X-Received: by 2002:a05:600c:2945:: with SMTP id n5mr10409385wmd.80.1573759010519; Thu, 14 Nov 2019 11:16:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573759010; cv=none; d=google.com; s=arc-20160816; b=Wt89Ls3XAjJ2u7KhA7uzKSVUm/xL6V9U7hSrVYA02OlPuYqeqhaUOnZx44lkTcw8G3 DZ1FbnGaqSkRC9aHxe7JJ66eJ+9QlS1J13ZiqHdB6w/yijIjKVE397338Kt+8rMPMeWh LtUCBVCY9kxgvSk6BOtUtLpRoR8eNLLe0+13ysYAz5Wum1NHKOnt9/zzMBW2BrGUGrQG 1WfFwFiYrv6C+bO66f0ITPMOOwrmDItkUER8GD5XqfPIv5z579U7I8iCpgpxPyb1Eosz tcyGzFiw70jm9oR9r0TMLprCTongLeRsB02AO2IzoT441mvzHTkkRuvmR1a/mJ8/xsdo oBEQ== 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:dkim-signature; bh=Zv6LI4Ql+HVAW1nYni4FKAmqM6usFkERBI/Nwxr+Lyo=; b=nmjAxAugIjQbxM9sqFCGCI7wDz1awZsiRPZOyLHPNSuIKU9d2VTeX/m8NcOhIH87Z0 IUahBE8LAY+9I0h09YZtIOWQke9IOSu5j/9QH9EV0Xln7/UmtELT8FcDEFWNyvk8/Q8g QwjC5N8XZ+4PiLeRmZ+/8GMQvpWbCIn2pzSPr5ssJT//nUTlmmZBS+F+8TGCrsR/mnFn LIndsnzwrZCLZeV3hwhApeYqckLI1Nyz4p5QnGgJTE9E6F2FxpEW3sAzDan2WeTdDety jEcyXSwM+xZtstVcIn8uuqX5+YrPXbrQr0uziPxHlPondpRHn2aZleIFUxafAEY0OLca Ut+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ee9rXHdw; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d18si3996188ejr.423.2019.11.14.11.16.25; Thu, 14 Nov 2019 11:16:50 -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=@gmail.com header.s=20161025 header.b=ee9rXHdw; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726953AbfKNTPn (ORCPT + 99 others); Thu, 14 Nov 2019 14:15:43 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:43698 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726098AbfKNTPn (ORCPT ); Thu, 14 Nov 2019 14:15:43 -0500 Received: by mail-pf1-f196.google.com with SMTP id 3so4927867pfb.10 for ; Thu, 14 Nov 2019 11:15:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Zv6LI4Ql+HVAW1nYni4FKAmqM6usFkERBI/Nwxr+Lyo=; b=ee9rXHdwZkxyKubw3Nz8skuM+eO29Dk7Dwksgi3qRZj8ilBGcnMw8xknr2JMhJf9OM D6htLDkdgE/jruqmBzdpqMAyMXpL6pdJnciQF8vEYJTcmrqIfdWTBnOi7OY52gNsyRcQ OyfQ/m/AQf1H2oJgR8J1egT1rz517JBdTvPLgFaejhS046NuCki8n6cucxgWXoPaebCh XqvSLpoEgB62uhuW+djoS/It4IKiRHFWC9gQjkRrJTGhzbOusQ3Tx9M6QqO/BFlVP9Kc DI+1HvO6UXW2kgm0dms5UFMwf3G454nfrY45aPHhWr4k+ekc3uhSswjsngZWH3Hky6/n YUwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Zv6LI4Ql+HVAW1nYni4FKAmqM6usFkERBI/Nwxr+Lyo=; b=aUKRFF7WENeaJmY5yAnR5XqkWR+OFu5HErp/IlMmpZm3PqfQOlsi9hIQhNM0HvlCPF xQuam61Lu7oyz54x0iGfNf3ASq0He+gkIQe6ucBbx/Rlhnz8GxjbdV6cOhesfnPDNM+W M6Eqa7rkiN0hq7u6K1LlW8pxSCAud2+Flg4o9aPGS5WyV9/qaDpXVVRHrjDvs9amM1YW XEcjS5L6tZ8xJIKGB7YrEchcQWiYJUNMv/HDwxDTRhOJsY1TKtE0yX5jxP4P/iPKHXcj zeWhVpOjehX+9Ebc09NsYkbdhHMQ4UMW9CUJVpbTVu6CANchE2duBtOv8b7yCasStBiS M62A== X-Gm-Message-State: APjAAAVWKXmqFc9vWqCHwlGODAl9jhBaKvhFdPITiE5DsWBemyhx2q/T bc1S4UeCDH0Gc8N88s9mBJE= X-Received: by 2002:a62:174b:: with SMTP id 72mr100747pfx.179.1573758941922; Thu, 14 Nov 2019 11:15:41 -0800 (PST) Received: from gmail.com ([2620:0:1008:fd00:25a6:3140:768c:a64d]) by smtp.gmail.com with ESMTPSA id a25sm7222499pff.50.2019.11.14.11.15.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 11:15:41 -0800 (PST) Date: Thu, 14 Nov 2019 11:15:38 -0800 From: Andrei Vagin To: Adrian Reber Cc: Christian Brauner , Eric Biederman , Pavel Emelyanov , Jann Horn , Oleg Nesterov , Dmitry Safonov <0x7f454c46@gmail.com>, Rasmus Villemoes , linux-kernel@vger.kernel.org, Mike Rapoport , Radostin Stoyanov Subject: Re: [PATCH v10 1/2] fork: extend clone3() to support setting a PID Message-ID: <20191114191538.GC171963@gmail.com> References: <20191114142707.1608679-1-areber@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20191114142707.1608679-1-areber@redhat.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 14, 2019 at 03:27:06PM +0100, Adrian Reber wrote: ... > diff --git a/include/uapi/linux/sched.h b/include/uapi/linux/sched.h > index 1d500ed03c63..2e649cfa07f4 100644 > --- a/include/uapi/linux/sched.h > +++ b/include/uapi/linux/sched.h ... > @@ -174,24 +186,51 @@ struct pid *alloc_pid(struct pid_namespace *ns) > pid->level = ns->level; > > for (i = ns->level; i >= 0; i--) { > - int pid_min = 1; > + int tid = 0; > + > + if (set_tid_size) { > + tid = set_tid[ns->level - i]; > + if (tid < 1 || tid >= pid_max) > + return ERR_PTR(-EINVAL); do we need to release pids what have been allocated on previous levels? nr = -EINVAL; goto out_free; Could you add a test for this case?