Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1169257ybx; Thu, 7 Nov 2019 08:14:23 -0800 (PST) X-Google-Smtp-Source: APXvYqzyXIMq4xRU5pErHQYsPYbVuofStK/UhytNM5YLCDz04sJY+KF/6btIBg5xslz8I/faHON9 X-Received: by 2002:a05:6402:883:: with SMTP id e3mr4504946edy.32.1573143263516; Thu, 07 Nov 2019 08:14:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573143263; cv=none; d=google.com; s=arc-20160816; b=OJeyA6z3M5oFMnp1XbkKJ5fovwDNVf5kRVTJA0MXY3eXVM0W7KS0/ZsH2QmRDIwzpZ Q8yXoncSru9Cq1NOgtVTIbe92jLrz8y1eFX7UMAIx9zkaNBqnY7fVtVwYJcZglVy54BX eQHxzFJj3CAZxfnz3ohNcJcTjNj5w2roZ0eKoIiYqxcpQhEKH43cjWOSktidR8t/ouBi ejTLfSNbJz3PFd1NxFHzLAzf5Rvqtuq1lp8l49bUTF0cUCLasKW0RIsfw+KTtjMcMlKB mHWUNilinrWh0OLILR7UO11nvejtobO3mrXs9TJttcOV7/vN7Zr2hfVcnr2oj06lyXvU Ojig== 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:mime-version :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from:dkim-signature; bh=j9Yv2ADBEuYgu7K06bm3FCwi5kL7EfkBgwC6m+V6GpE=; b=JHtxF8lijiBSeVYAPkmIJFvyZU2/i3Tc4P+XyZne67LPvqN7zzUqJQLNAG7RcZDDGc Vyz6MR3dzwH62dXLtjHcccPFkZXQOybZNSzubUdAvxeTN8zbqptWbXOp6JIFTBaLq1+M Rp7AOfsDVk63aqg3dNeQb6jZ0t0LkhfbQl/ogwSxmtb+5rPiair3QYPmg+HTaxKh1kt2 QNXcRer3uKo8WEmKl+/i09T+RFmF1v9EZYccO3aeRBGVYh6IWpogicGMTUlVb2eG4NNJ 9P3s4UylKRB7JBYGCAGtJs+QE4T+hWhlRDOkhIN1QFF98zoppDFINfwkCjwB6WJJB4We 04uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="R/DXhK0x"; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11si1722836ejx.212.2019.11.07.08.13.59; Thu, 07 Nov 2019 08:14:23 -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=@redhat.com header.s=mimecast20190719 header.b="R/DXhK0x"; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387470AbfKGQLH (ORCPT + 99 others); Thu, 7 Nov 2019 11:11:07 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:36124 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388454AbfKGQLG (ORCPT ); Thu, 7 Nov 2019 11:11:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573143065; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j9Yv2ADBEuYgu7K06bm3FCwi5kL7EfkBgwC6m+V6GpE=; b=R/DXhK0xFWcwMuS7U1Kq0qkTX5Sz0mPlxlphtTW0RecuVyHrQHmGsyv0/iwbZC9rhmKV1r 3Q6woV75MjFUmg4fc8DPT5K6+PYuU4N6hHRnAA7omLr+ajNnBMmjQLPo2DKsc4NkVctKjx qzipNouenVOzNEgRl2E1uNURgy6ifrI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-383-7T61eBXcOASiyFVjHgEPgA-1; Thu, 07 Nov 2019 11:11:02 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 21EB41800D6B; Thu, 7 Nov 2019 16:11:00 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-117-20.ams2.redhat.com [10.36.117.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 22B5B5D9E5; Thu, 7 Nov 2019 16:10:52 +0000 (UTC) From: Florian Weimer To: Christian Brauner 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 , Jann Horn Subject: Re: For review: documentation of clone3() system call References: <20191107151941.dw4gtul5lrtax4se@wittgenstein> Date: Thu, 07 Nov 2019 17:10:51 +0100 In-Reply-To: <20191107151941.dw4gtul5lrtax4se@wittgenstein> (Christian Brauner's message of "Thu, 7 Nov 2019 16:19:43 +0100") Message-ID: <87y2wrbras.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: 7T61eBXcOASiyFVjHgEPgA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Christian Brauner: > I've always been confused by the "..." for the glibc wrapper. The glibc > prototype in bits/sched.h also looks like this: > > extern int clone (int (*__fn) (void *__arg), void *__child_stack, int __f= lags, void *__arg, ...) __THROW; > > The additionl args parent_tid, tls, and child_tid are present in _all_ > clone version in the same order. In fact the glibc wrapper here give the > illusion that it's parent_tid, tls, child_tid. The underlying syscall > has a different order parent_tidptr, child_tidptr, tls. > > Florian, can you advise what prototype we should mention for the glibc > clone() wrapper here. I'd like it to be as simple as possible and get > rid of the ... > Architectural differences are explained in detail below anyway. Our header has: /* Clone current process. */ extern int clone (int (*__fn) (void *__arg), void *__child_stack, int __flags, void *__arg, ...) __THROW; I have not checked all assembler implementations. In theory there could be one that relies on the different calling convention for variadic functions (e.g., the existence of a parameter save area on POWER). Or that swaps arguments in some architecure-specific way. 8-( I don't have much guidance on this matter, sorry. I expect that for clone3, we'll provide a same-stack variant as well (for fork/vfork-like usage), which will be much closer to the kernel interface. clone/clone2 doesn't seem very fixable to me at this point. Thanks, Florian