Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1827167ybn; Thu, 26 Sep 2019 02:50:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfr3y60C1gnbU+9TciIqvr2inkvVZaZmbsDN047P4SM5Gj67bxeN7WtXxBvxMN6uaW7n6h X-Received: by 2002:a17:906:938b:: with SMTP id l11mr2233921ejx.67.1569491444406; Thu, 26 Sep 2019 02:50:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569491444; cv=none; d=google.com; s=arc-20160816; b=OwczAgvC0seKQwtoqAbStzrP1nmwG3byVjJO0fj64hoMyhxsSQq1yi2H8dg57UIKUn hgKAbtPqE8tdybO7wkp1YbVVnx5Y6JrBASDEWbxRuWi4vrlJ710jSpUjIwaKtwc8zbAj CtBvhz+nNY/cq49qmmKzBoN2M7c5ZlXuoDlISZZDUpalDb5cdRYGbLWXGifs3QRil0kW y3Wc+UmoGQHzNLWG5vLD6Ri9AC0NHkF9cArwQ1W1KIJ8Wvx/+XnetcfXHIB07K24XVr/ spmocCgXqjTllG1d7iImdIN6kXnRItf0m8BVoau3tEnT33XMRt+CtKLzwA7oDE5wePEv /AYw== 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=bVoYeYxYrE5KEQV0JGXcflkyCQsjkoitX6lGHmlRjuI=; b=w5lkvEk5TRhb6iopfWLHvz8WCZ8wzAQAcmM6icgEWZNqT1fFWszqrEBIfHOVRKM8lB GHHHsaNdh2cV5SaEqRtKh1JFVI5O5M4r71CghHtc1h9aqf2mcMaNcjftaeHAKRU4vvdS xbWmrN9mEo8Ig1sQaRDvERPc+pqACah4p1d6u/eB9ckFMAKcFZuewJvoLxFnaXY0NxEe Xnbz5P7IfWc3wnGusxxCCrGaVE9wkoTJkW+mRCjBXf8srvNdX/42ozzwUqlN9s9bmCNF SRoGHdutcDU3+tDQGFhVmiiZfxj623ABGB5YJEMI+C5dadK86oaY1zueZVwo1t17HHiw fbbg== 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 u16si710853ejx.179.2019.09.26.02.50.21; Thu, 26 Sep 2019 02:50:44 -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 S2505145AbfIYRWf (ORCPT + 99 others); Wed, 25 Sep 2019 13:22:35 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:50989 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732997AbfIYRWf (ORCPT ); Wed, 25 Sep 2019 13:22:35 -0400 Received: from [185.81.138.21] (helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iDAzf-0007mF-IL; Wed, 25 Sep 2019 17:22:23 +0000 Date: Wed, 25 Sep 2019 19:22:21 +0200 From: Christian Brauner To: Aleksa Sarai Cc: Ingo Molnar , Peter Zijlstra , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Rasmus Villemoes , Al Viro , Linus Torvalds , libc-alpha@sourceware.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 2/4] clone3: switch to copy_struct_from_user() Message-ID: <20190925172221.ss6lmncog23uohep@wittgenstein> References: <20190925165915.8135-1-cyphar@cyphar.com> <20190925165915.8135-3-cyphar@cyphar.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190925165915.8135-3-cyphar@cyphar.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 Wed, Sep 25, 2019 at 06:59:13PM +0200, Aleksa Sarai wrote: > The change is very straightforward, and helps unify the syscall > interface for struct-from-userspace syscalls. Additionally, explicitly > define CLONE_ARGS_SIZE_VER0 to match the other users of the > struct-extension pattern. > > Signed-off-by: Aleksa Sarai > --- > include/uapi/linux/sched.h | 2 ++ > kernel/fork.c | 34 +++++++--------------------------- > 2 files changed, 9 insertions(+), 27 deletions(-) > > diff --git a/include/uapi/linux/sched.h b/include/uapi/linux/sched.h > index b3105ac1381a..0945805982b4 100644 > --- a/include/uapi/linux/sched.h > +++ b/include/uapi/linux/sched.h > @@ -47,6 +47,8 @@ struct clone_args { > __aligned_u64 tls; > }; > > +#define CLONE_ARGS_SIZE_VER0 64 /* sizeof first published struct */ > + > /* > * Scheduling policies > */ > diff --git a/kernel/fork.c b/kernel/fork.c > index 541fd805fb88..a86e3841ee4e 100644 > --- a/kernel/fork.c > +++ b/kernel/fork.c > @@ -2530,39 +2530,19 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, > #ifdef __ARCH_WANT_SYS_CLONE3 > noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs, > struct clone_args __user *uargs, > - size_t size) > + size_t usize) > { > + int err; > struct clone_args args; > > - if (unlikely(size > PAGE_SIZE)) > + if (unlikely(usize > PAGE_SIZE)) > return -E2BIG; > - > - if (unlikely(size < sizeof(struct clone_args))) > + if (unlikely(usize < CLONE_ARGS_SIZE_VER0)) > return -EINVAL; You might want to rebase this patchset after the merge window closes on rc1 since that code has changed right before the 5.3 release. But if you can't don't worry I can also fix it up. Christian