Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4026230ybl; Mon, 12 Aug 2019 10:08:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFez/XP/Dz+8Kk7kV2nBzbj7gb2Zjy7pagD31mwLd++mrZNjEvHd5IHg2NlXgYzlch0nt6 X-Received: by 2002:a17:90a:206a:: with SMTP id n97mr303406pjc.10.1565629691094; Mon, 12 Aug 2019 10:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565629691; cv=none; d=google.com; s=arc-20160816; b=GSRoZ2aW6MlkeZnxXwoUo2AHAdL/z5EI0emuLBD10GKox8y+u64nyu3Nu6/AI56eP/ 5A4UKPiG9v+YQk4FG78yyzxTkqPQ8iqR1rRwuwDSXA3XjWLQwo/PjXJScEye9+fyYDgo uj72HSMMBZTd5M6cXYtYhob6ZzwvriExShmMWE22GRkmdj18jzUDJ+QFt2imTQuRStL2 80tOdNaLtuanOL7ryGLjayBr2B4K/9rXCrFV9m4pfNd0OY8oka4tIJbQxtZfY04rmZrB EBfBeu7Q9jFtGjuhNg5kqtHb4YO5WWz8Mpqsk03EACHaCEVUQdnBVXZHhZCReNswMg7R uoVw== 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=YVhYpcfeV/zUXABSDqPXL2RjUP0LuoEVXg2bBtYV244=; b=UGvtT0T546ZdNixVuEOBowr9FrglBMz/1YLJz3n1bR9E4jnW1mQtx5AeOniWYO5Bbi QMhmET9ImkomC8LQjtPZ4E9qz//7IELd1a7LVRJFOnqZAWhNhGAKgW6Lm+vvS8XA2UP8 ESv0nJX+rKQxcVEpSRdB4qHUyT+yElXaQalamNovrafaKInzp7a7a1ngFNCgsI6+rW+E rtnit9rtCADLFr+42jyp5TroGNJuopNejbwhkEPJkadWfhuKZJeSctDlO2OJM9CGSlzB eCdkNp8mdEIj5ATZU9pZaAprk7e4U0dQFW3U7k8+myRVr5M2sENEjc4JBfBvTL2JeEO6 7fOg== 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 186si63055051pgc.248.2019.08.12.10.07.55; Mon, 12 Aug 2019 10:08:11 -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 S1727102AbfHLRGh (ORCPT + 99 others); Mon, 12 Aug 2019 13:06:37 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:52383 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726881AbfHLRGg (ORCPT ); Mon, 12 Aug 2019 13:06:36 -0400 Received: from [213.220.153.21] (helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1hxDkk-0004XM-EI; Mon, 12 Aug 2019 17:05:02 +0000 Date: Mon, 12 Aug 2019 19:05:01 +0200 From: Christian Brauner To: Oleg Nesterov Cc: Adrian Reber , Eric Biederman , Pavel Emelianov , Jann Horn , Dmitry Safonov <0x7f454c46@gmail.com>, linux-kernel@vger.kernel.org, Andrei Vagin , Mike Rapoport , Radostin Stoyanov Subject: Re: [PATCH v5 1/2] fork: extend clone3() to support CLONE_SET_TID Message-ID: <20190812170500.37xhv6eute6xujcj@wittgenstein> References: <20190811203327.5385-1-areber@redhat.com> <20190812163710.GC31560@redhat.com> <20190812165130.d3b5smm45dpxk6m4@wittgenstein> <20190812165733.GD31560@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190812165733.GD31560@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 Mon, Aug 12, 2019 at 06:57:34PM +0200, Oleg Nesterov wrote: > On 08/12, Christian Brauner wrote: > > On Mon, Aug 12, 2019 at 06:37:10PM +0200, Oleg Nesterov wrote: > > > On 08/11, Adrian Reber wrote: > > > > > > > > include/linux/pid.h | 2 +- > > > > include/linux/sched/task.h | 1 + > > > > include/uapi/linux/sched.h | 1 + > > > > kernel/fork.c | 22 ++++++++++++++++++++-- > > > > kernel/pid.c | 36 +++++++++++++++++++++++++++++------- > > > > 5 files changed, 52 insertions(+), 10 deletions(-) > > > > > > Looks good to me... > > > > > > A couple of nits below, but I won't insist, feel free to ignore. > > > > > > > +/* > > > > + * Different sizes of struct clone_args > > > > + */ > > > > +#define CLONE3_ARGS_SIZE_V0 64 > > > > > > I don't really understand why do we want the "size < CLONE3_ARGS_SIZE_V0" > > > check in copy_clone_args_from_user(), but I won't argue. > > > > To make sure a user can't give us a garbage sized struct that is smaller > > than the initial version of the struct. > > But why do we want to detect this case? I have to admit I don't understand that question. Because it's a garbage sized struct that we can't do anything with. Why shouldn't we detect this case? > > And why CLONE3_ARGS_SIZE_V0 is special? Hm? Because that is the first-well known struct size. In fact this pattern is also used for perf and sched: if (!access_ok(uattr, PERF_ATTR_SIZE_VER0)) return -EFAULT;