From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20CAFC5DF60 for ; Thu, 7 Nov 2019 16:11:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EB70B218AE for ; Thu, 7 Nov 2019 16:11:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="R/DXhK0x" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389041AbfKGQLH (ORCPT ); Thu, 7 Nov 2019 11:11:07 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:38144 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387470AbfKGQLG (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-man-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-man@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