Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3566126ybg; Mon, 28 Oct 2019 15:05:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwtoEbsXBsmi+nP+kohWcZEFhZtRTl1/t+9bK16sF/VqKO00PqSCDDAJV6Uq9MXzTechcki X-Received: by 2002:a50:9fc1:: with SMTP id c59mr22643775edf.305.1572300308252; Mon, 28 Oct 2019 15:05:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572300308; cv=none; d=google.com; s=arc-20160816; b=pMKQdZE+cVTrVMRtQaav6r8NHE7+4U34io9++Xc4rEfmkXSiUQ/E+jV4kJh7npQGD1 /6V/B4Er/7ddIo0zvZwyNfu66eYTxaYtiVwMwJO7bwVXSGyyr2XU4QWl9Jd6ZBoHVFrt CnrPfIw4imqoc4P22qPwihFfQrHTCGVF81adWg8psa/yX9/eQX/PV80jQjhbNFmwFHh7 Gs95DOaum9NxItkTu+ydWyWeCvlLHxNqSnmMdE3DgrCrdclnQFeeZGhXywm4wKRg7i/o fFJp5MJ4H/Ez/v+Y3QsIAQ43Zl4rfJjLKdq+NvkrwGV7RJA1Xpv1kk4OMxQEJKVpKShG u5Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=L9fhhJYJix/9oZ9QAhDpmrJfpL3vm/qAXK8NaYNkeO4=; b=plGY6rfKNhC3oF+BlXo7Xwpek+cEobuMQWtDYS2ez/3jT4DcTL4yhPa6WrYgWynFxF XK+lf7CZwyvWFVp09v+omdFMr4aH4Du9w8XeV/9ldLassJ0j8hLWUmrpjxkkJthvAtha Jwt27lbpCZg5V9oTUcBV1U7GUxQ3nWrPBacdLnet0Fp6fvi/1MhHCoA57jJx5GxWzKZ7 VqwTLFT1AZ/CFfiCH0UPJoDE8lVAd6XAgwxeFLwC6fI5AHmPNblZ15Ry8L8iuAUCRHzh VRhF/7eytFGnJR3pNUO6Mfw/99j17TwqNVMczOzW7/ZNl+2MM2+FfIm5bRNeVy1X58Lc /kww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SSO1abYX; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z33si8482481edb.183.2019.10.28.15.04.44; Mon, 28 Oct 2019 15:05:08 -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=@google.com header.s=20161025 header.b=SSO1abYX; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729718AbfJ1TJl (ORCPT + 99 others); Mon, 28 Oct 2019 15:09:41 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:39019 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729634AbfJ1TJl (ORCPT ); Mon, 28 Oct 2019 15:09:41 -0400 Received: by mail-ot1-f67.google.com with SMTP id t8so1495399otl.6 for ; Mon, 28 Oct 2019 12:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=L9fhhJYJix/9oZ9QAhDpmrJfpL3vm/qAXK8NaYNkeO4=; b=SSO1abYXQmcrUQLxLxUHnQswc1h1eK2cNuHq/UkJMxHVKezK9iRzKFRMwcn0pUt7ap /lx1bXQoLgKBjgh1n2lMzVMKf2z+JjVEpw1NmucNCdMuA+JZZlFbhEa57UO1HA2yrkR+ EDUN2GlgnjT3TlhpXKwsw/rqk3z/9ztSCWHOsextqp/bEYymmCuj/SETil0juFNTCCV+ lDpIcndd/pmo6SphvZd5MUzV7lUMe8/cf33hDsU0GaO9aDXe132NaR7OVpQF9hb35kbK Wap25ib1M/ngsKDlT4IuK/AgaihMVmE4hp7tCPuHrl1edmEYiK3Dl9fZINRml1Onw2iy cExg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=L9fhhJYJix/9oZ9QAhDpmrJfpL3vm/qAXK8NaYNkeO4=; b=MnqqDGisupLQNu5p/nIs/E4rdi+6Qs4egXSaN93ti6CMM6VIffEO+PhhcBEnFJXbwW pwBIRNcaV7UDykwwjgiF6eqy7LqSthL0aCRW+6rHh98Rr2xzq/o6UgCE1G+2wlhJlkvS FWrV5pape02ViQskXV1kVKOFvwAIO/A7amhc6MJ4NwwYR2NN/K7dzPheKJ5fdqDc41K6 iJd4IjPAw6aAwl9OLF1ACN29N3kFQhMnTi4I8ZDVSGeIIfPta/OqgRuLuNmJJwrMOxmn Kx1J4Jn7rr8FSlFkjhtDLJ7ZjfP9VZgGkCrAcKONXIXAlY7BzyFWmB4EC9Rd9xd/6J6c Q0Ug== X-Gm-Message-State: APjAAAXeOSoQHhcptG5oCzZJPTdyf5JrGzqnot8dNGvOv1rAYgiQsr3n qvSQhV6Xc0zI3CEnPSa3i3sbGQvJ8RIqQBE92cNXoA== X-Received: by 2002:a9d:37e6:: with SMTP id x93mr2695000otb.183.1572289779979; Mon, 28 Oct 2019 12:09:39 -0700 (PDT) MIME-Version: 1.0 References: <20191028172143.4vnnjpdljfnexaq5@wittgenstein> In-Reply-To: <20191028172143.4vnnjpdljfnexaq5@wittgenstein> From: Jann Horn Date: Mon, 28 Oct 2019 20:09:13 +0100 Message-ID: Subject: Re: For review: documentation of clone3() system call To: Christian Brauner Cc: Michael Kerrisk-manpages , lkml , linux-man , Kees Cook , Florian Weimer , Oleg Nesterov , Arnd Bergmann , David Howells , Pavel Emelyanov , Andrew Morton , Adrian Reber , Andrei Vagin , Linux API Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 28, 2019 at 6:21 PM Christian Brauner wrote: > On Mon, Oct 28, 2019 at 04:12:09PM +0100, Jann Horn wrote: > > On Fri, Oct 25, 2019 at 6:59 PM Michael Kerrisk (man-pages) > > wrote: > > > I've made a first shot at adding documentation for clone3(). You can > > > see the diff here: > > > https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=faa0e55ae9e490d71c826546bbdef954a1800969 [...] > > You might want to note somewhere that its flags can't be > > seccomp-filtered because they're stored in memory, making it > > inappropriate to use in heavily sandboxed processes. > > Hm, I don't think that belongs on the clone manpage. Granted that > process creation is an important syscall but so are a bunch of others > that aren't filterable because of pointer arguments. > We can probably mention on the seccomp manpage that seccomp can't filter > on pointer arguments and then provide a list of examples. If you setup a > seccomp filter and don't know that you can't filter syscalls with > pointer args that seems pretty bad to begin with. Fair enough. [...] > One thing I never liked about clone() was that userspace had to know > about stack direction. And there is a lot of ugly code in userspace that > has nasty clone() wrappers like: [...] > where stack + stack_size is addition on a void pointer which usually > clang and gcc are not very happy about. > I wanted to bring this up on the mailing list soon: If possible, I don't > want userspace to need to know about stack direction and just have stack > point to the beginning and then have the kernel do the + stack_size > after the copy_clone_args_from_user() if the arch needs it. For example, > by having a dumb helder similar to copy_thread_tls()/coyp_thread() that > either does the + stack_size or not. Right now, clone3() is supported on > parisc and afaict, the stack grows upwards for it. I'm not sure if there > are obvious reasons why that won't work or it would be a bad idea... That would mean adding a new clone flag that redefines how those parameters work and describing the current behavior in the manpage as the behavior without the flag (which doesn't exist on 5.3), right?