Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6316826ybx; Mon, 11 Nov 2019 07:19:50 -0800 (PST) X-Google-Smtp-Source: APXvYqxr6BO+Ml+UFA+QkDfNROhn2s23rvs2NiKMJVBviEhutMyRWY1rZIK+JGjCxVz5IKKsGXTi X-Received: by 2002:a50:9fc1:: with SMTP id c59mr27481292edf.305.1573485590744; Mon, 11 Nov 2019 07:19:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573485590; cv=none; d=google.com; s=arc-20160816; b=GgwJN0jPeapx/pj7HM7cVGu9+XdgNoGa8fhglvf4tj20dWI8bORFIe2MN8XQbtwP8W s8avF/QAkdtdxfXp8/G1VnyxB/jmZAy+jom6o+372MJyiMAo2ZQT3Mjry7l/ZjCVf/CR LjrXpwh6GBvqhPiqK2O0sg56XIsvybogiUdeoZHtwb9UBXsog4y15wrt/1mjlYHRvEbv uEtFC31gHexHH4eXbZ030ATL7EPVpX22+TKClosqYBnZVlF7l9Js2PvplDX8gMqkkqBy CZuerB/T/SxQusqiDmpCcopisqv5kZbXBmZ7aT2J9mwmjUdtuJtVfKwcqFjGwSOx6sWD Ir5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=leQP7w6Wd8/nHQ8w8DwldOm2MjClO/82CYqD+qmowYg=; b=X3aq9Qh1e7QVD+zI3PwDGKDbfQ5/Wx6F8EtTARZpdUqJm60pdQxbpiARQnxDY5I0p0 SMmP2Oo5zvo+juR2PYXecr6Q+RjQGfnA/KCsjByp7NX2Ww697G3uRCr4eHMGHxoFjn5H N8AjabU2VpSnflITjOcvbZpf0VygOdW/ARbFRCyEqOzkzO12KgUh9kulN6QKbeZnMHhB VdK7gOCdW/HEpu2du670XhaqduOVgcEwQ/9immDqdZPeWdaMPgrAtwgpQEIQsljRA5Jb 7u7z+gXL5zpcQCuvuMwF0tvPO27FaSk4db6Rzhke3CG1Re5Jbs2jyYgpngZiqoyBX5Fd zxxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=JsQskc9U; 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 d13si8930991ejr.23.2019.11.11.07.19.26; Mon, 11 Nov 2019 07:19: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=@google.com header.s=20161025 header.b=JsQskc9U; 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 S1726924AbfKKPQ0 (ORCPT + 99 others); Mon, 11 Nov 2019 10:16:26 -0500 Received: from mail-ot1-f67.google.com ([209.85.210.67]:37388 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726877AbfKKPQ0 (ORCPT ); Mon, 11 Nov 2019 10:16:26 -0500 Received: by mail-ot1-f67.google.com with SMTP id d5so11535509otp.4 for ; Mon, 11 Nov 2019 07:16:25 -0800 (PST) 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:content-transfer-encoding; bh=leQP7w6Wd8/nHQ8w8DwldOm2MjClO/82CYqD+qmowYg=; b=JsQskc9U6qWQPqhpsIpTIYY5TrCAee8ZhIkjRkRg71HFWa6n6t7/3VNRCRT2ljanm1 Xpcpy319ZXaKl4BZJD2TY17PxCEvb2+4TnU2/cEvChEeB4S5nnMWuRz+EoqGxLLa3769 g2hzp29p+NPHE9p9xbaRT65sXJb3h4uagGoxMUghDVuRl0UZ+76I6se6593aRbqixGOi 6QRRt+IxQMdhOwDOMcsKVxo5bzg9cPXxeqJXIJnoed5WCsD6uQ7fQK1SPylHGSKZgtSv SS0o0eWEwg92MBbcZccHVkzrpdgrkhAPY5nHVFt9kH1G7EQfAtyX8/KGGP/w/BWwm5/G w3og== 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:content-transfer-encoding; bh=leQP7w6Wd8/nHQ8w8DwldOm2MjClO/82CYqD+qmowYg=; b=i0z3BV3iTYYhb6EzqaNqyje79SGIq/LM2H7q87phFElJyWQUg64bRqMw96OwIUcvnD HtYxBX56HMzqM/OfEW/JoJaEqGbWR5JfykixBBOXlxq0vHu7N1Y+q1tlFefMW4zy29Bv W8FG3dTHkLLSAiup0G4P7Gc8tTvEkhbPvKiX8UWBFAcwkfhjyqyI1hRhrZ0cKIcreo1v Cigceu7VWx504qGbyTtPiRMuy+eDjFTk1gpFYE+loY6xHDMeJk69FrhzN1qq019H1XBj 0OQqzBHBJnhAX+AfK6lhV0rDevOduBmk/HqOTLNB1mzrXENlkKYiCKAKcDzAF9z+3eg5 Yt2w== X-Gm-Message-State: APjAAAUZTAGz6zf8GXxX9XHCFDqsMfgvpVE+H3KVrivsZboniNi/kxpr 33akydmyzHShReCM0YKh6KLcGB80GGb5P1IKCX7HJr+bymg= X-Received: by 2002:a9d:37e6:: with SMTP id x93mr12701581otb.183.1573485384956; Mon, 11 Nov 2019 07:16:24 -0800 (PST) MIME-Version: 1.0 References: <87tv7awj4g.fsf@oldenburg2.str.redhat.com> In-Reply-To: <87tv7awj4g.fsf@oldenburg2.str.redhat.com> From: Jann Horn Date: Mon, 11 Nov 2019 16:15:58 +0100 Message-ID: Subject: Re: For review: documentation of clone3() system call To: Florian Weimer Cc: "Michael Kerrisk (man-pages)" , Christian Brauner , lkml , linux-man , Kees Cook , Oleg Nesterov , Arnd Bergmann , David Howells , Pavel Emelyanov , Andrew Morton , Adrian Reber , Andrei Vagin , Linux API Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 11, 2019 at 4:03 PM Florian Weimer wrote: > > * Michael Kerrisk: > > > Another difference for the raw clone() system call is that t= he > > stack argument may be NULL, in which case the child uses a dupl= i=E2=80=90 > > cate of the parent's stack. (Copy-on-write semantics ensure th= at > > the child gets separate copies of stack pages when either proce= ss > > modifies the stack.) In this case, for correct operation, t= he > > CLONE_VM option should not be specified. (If the child shares t= he > > parent's memory because of the use of the CLONE_VM flag, then = no > > copy-on-write duplication occurs and chaos is likely to result.) > > I think sharing the stack also works with CLONE_VFORK with CLONE_VM, as > long as measures are taken to preserve the return address in a register. That basically just requires that the userspace function declaration for clone3 includes __attribute__((returns_twice)), right?