Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp555052ybi; Fri, 21 Jun 2019 04:19:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0piEJMuG08KW6OprFxEgcdMJub2ctOIg3s9Ht+DBNfseBOKyrHrDRlNSJnQrzrOP1kO/F X-Received: by 2002:a17:902:7883:: with SMTP id q3mr129098792pll.89.1561115955903; Fri, 21 Jun 2019 04:19:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561115955; cv=none; d=google.com; s=arc-20160816; b=oC1R9DSbWVm08uLOJlgqDvmhnx2xR+pOY5lSJz/mi1jDZrvrQDfImsK/i2JYjVfEN/ OtUpoIe3JgOMMsqGkCRPRUPw0oAnzSiyxYIvy5vdiNR2bxMijHkXC2czuUiXolv9mqds jEjtYU0YYCUaLNSvdIYMcjPPaQWwQtDfAmgPx4FQhVRxiQ9ByJgLHlq4U6dp0ZK15NYC 8IK0R69EpgWvTL+rENQ340NEDOrDC71bHyok745pHc52lflbrdomIolnjAulWHap56C+ zQdjUtnLtWflyZD5vOkpIj++YC8kVOYVgmSfJL2ZtnE92XkB7VWbkNYXrSgauJXEzpv4 BISA== 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=NabQZDyF6ofZk8run8ReROPDDNPPhXEMVOy6Fc5LD2A=; b=ZBJ3orJE3a7R15SCTkWTZdMVq/zPZgtQ1FQfkBGK/lKKHNVRAst+/+Svwb2sFFgA4C QAP3uCi3VaClntGYDrQMDsyRJGgpEVlMIRWC6ebObQPEQ8m0H9e9683NwQYzwuyNW/r1 nJro4sJHfIVscGaw64NB8xPomL2UtpfqmJYZuQuCkNoPoQqSgLFoYuXtAdoyJIv5rDpC n5IZeJZirFcDb4eBt6WzynyD8vU7aGk6BqqGLmsRKUyNxmPlIipYrJ0k692mBjIwGljK TthbRiQtExqfZMbJ7TqBlMhoZUAl1vH8RDJIzNeMW7iS/VHC1/gURfO9taei2AL365Lz yRFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brauner.io header.s=google header.b=A0sR4TbA; 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 cj16si2506955plb.239.2019.06.21.04.19.00; Fri, 21 Jun 2019 04:19:15 -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; dkim=pass header.i=@brauner.io header.s=google header.b=A0sR4TbA; 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 S1726668AbfFULSq (ORCPT + 99 others); Fri, 21 Jun 2019 07:18:46 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:53729 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726571AbfFULSq (ORCPT ); Fri, 21 Jun 2019 07:18:46 -0400 Received: by mail-wm1-f65.google.com with SMTP id x15so5969140wmj.3 for ; Fri, 21 Jun 2019 04:18:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brauner.io; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=NabQZDyF6ofZk8run8ReROPDDNPPhXEMVOy6Fc5LD2A=; b=A0sR4TbA5sn9q6BPXeU1kL9L2rZYmfUq90m2Sf0mR6201SQWimJDCuq975mx4xdPMX NIoPXdOUBPw4EZ7mzDrd3p6sFLm6s9pSSW0e9mgtMc6rXQQeYIR2dgyZkoRof3qM35LP 5eRLvNwhvTbC4pcagAYYGBlOnLcU2RDd7TiNKmhSHyHAkTsmrA1crtabpPFcBBqxhzvV X/tnH8Qcgl8EZ6/5uaWL4eJKnqQ5xekFKeIMDSPucn3iqtUXmJC8cwg5FfZultGJuxFJ 3svqrNjQJA7RZodeSacxMWBKE99m5lY+xX5GPKzuGK4aii45lI+GSO4URvxn0IXqiwZm mw5A== 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=NabQZDyF6ofZk8run8ReROPDDNPPhXEMVOy6Fc5LD2A=; b=L/j+u2rKz+ux3COr+X6vCypO45iyq/kqc5pZNiUPohd44cPq3UzKSObtT47IKXP3T6 U4GIMOYetMAV3GxYbT+wJnJqqb+2B1sIr9sc9ztHtNRAEHLkNx78CAW1k5h6Vx4NeEB5 6LjHs7HdNoa0tZFq0DdFJt6bPVhq84YeG/WZUqyxVncgFT/tuFb7/hBpLp75gh2A0wHq 3dQrbn8lVS868aO8JD7xKxZE+iU0VHWFNGIqDXBQUtFm6IaP+WV7P4qYUE5quziH0Pxo WkujG+EwG3F+tk6x09W8MN0Ck3Wh+UKzkWbeCHoYjdEPCqhgQDwJNW4jGgStD1dhXROn x+xA== X-Gm-Message-State: APjAAAUTRoWxjuORyAhPyA8vAFzoHfj6ZSXvYrxbbvDMJPSca8BwENde dgprxipXkT+IczBQNy5J8vReSQ== X-Received: by 2002:a1c:a7ca:: with SMTP id q193mr4122227wme.150.1561115923826; Fri, 21 Jun 2019 04:18:43 -0700 (PDT) Received: from brauner.io ([212.91.227.56]) by smtp.gmail.com with ESMTPSA id a84sm2327897wmf.29.2019.06.21.04.18.42 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 21 Jun 2019 04:18:43 -0700 (PDT) Date: Fri, 21 Jun 2019 13:18:41 +0200 From: Christian Brauner To: Arnd Bergmann Cc: Guenter Roeck , Al Viro , Linux Kernel Mailing List , Linus Torvalds , Jann Horn , Kees Cook , Florian Weimer , Oleg Nesterov , David Howells , Andrew Morton , Adrian Reber , Linux API , linux-arch , the arch/x86 maintainers Subject: Re: [PATCH v3 2/2] arch: wire-up clone3() syscall Message-ID: <20190621111839.v5yqlws6iw7mx4aa@brauner.io> References: <20190604160944.4058-1-christian@brauner.io> <20190604160944.4058-2-christian@brauner.io> <20190620184451.GA28543@roeck-us.net> <20190620221003.ciuov5fzqxrcaykp@brauner.io> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 21, 2019 at 11:37:50AM +0200, Arnd Bergmann wrote: > On Fri, Jun 21, 2019 at 12:10 AM Christian Brauner wrote: > > On Thu, Jun 20, 2019 at 11:44:51AM -0700, Guenter Roeck wrote: > > > On Tue, Jun 04, 2019 at 06:09:44PM +0200, Christian Brauner wrote: > > > > clone3() was placed under __ARCH_WANT_SYS_CLONE. Most architectures > > simply define __ARCH_WANT_SYS_CLONE and are done with it. > > Some however, such as nios2 and h8300 don't define it but instead > > provide a sys_clone stub of their own because of architectural > > requirements (or tweaks) and they are mostly written in assembly. (That > > should be left to arch maintainers for sys_clone3.) > > > > The build failures were on my radar already. I hadn't yet replied > > since I haven't pushed the fixup below. > > The solution is to define __ARCH_WANT_SYS_CLONE3 and add a > > cond_syscall(clone3) so we catch all architectures that do not yet > > provide clone3 with a ENOSYS until maintainers have added it. > > > > diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h > > index 7a39e77984ef..aa35aa5d68dc 100644 > > --- a/arch/arm/include/asm/unistd.h > > +++ b/arch/arm/include/asm/unistd.h > > @@ -40,6 +40,7 @@ > > #define __ARCH_WANT_SYS_FORK > > #define __ARCH_WANT_SYS_VFORK > > #define __ARCH_WANT_SYS_CLONE > > +#define __ARCH_WANT_SYS_CLONE3 > > I never really liked having __ARCH_WANT_SYS_CLONE here > because it was the only one that a new architecture needed to > set: all the other __ARCH_WANT_* are for system calls that > are already superseded by newer ones, so a new architecture > would start out with an empty list. > > Since __ARCH_WANT_SYS_CLONE3 replaces > __ARCH_WANT_SYS_CLONE for new architectures, how about > leaving __ARCH_WANT_SYS_CLONE untouched but instead __ARCH_WANT_SYS_CLONE is left untouched. :) > coming up with the reverse for clone3 and mark the architectures > that specifically don't want it (if any)? Afaict, your suggestion is more or less the same thing what is done here. So I'm not sure it buys us anything apart from future architectures not needing to set __ARCH_WANT_SYS_CLONE3. I expect the macro above to be only here temporarily until all arches have caught up and we're sure that they don't require assembly stubs (cf. [1]). A decision I'd leave to the maintainers (since even for nios2 we were kind of on the fence what exactly the sys_clone stub was supposed to do). But I'm happy to take a patch from you if it's equally or more simple than this one right here. In any case, linux-next should be fine on all arches with this fixup now. Christian [1]: Architectures such as nios2 or h8300 simply take the asm-generic syscall definitions and generate their syscall table from it. But since they don't define __ARCH_WANT_SYS_CLONE the build would fail complaining about sys_clone3 missing. The reason this doesn't happen for legacy clone is that nios2 and h8300 provide assembly stubs for sys_clone but they don't for sys_clone3.