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=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 3C7F1C76188 for ; Tue, 16 Jul 2019 13:09:24 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8291120880 for ; Tue, 16 Jul 2019 13:09:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=brauner.io header.i=@brauner.io header.b="b8dhUBZS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8291120880 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=brauner.io Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 45p1286Ww3zDqVr for ; Tue, 16 Jul 2019 23:09:20 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=brauner.io (client-ip=2607:f8b0:4864:20::443; helo=mail-pf1-x443.google.com; envelope-from=christian@brauner.io; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=brauner.io Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=brauner.io header.i=@brauner.io header.b="b8dhUBZS"; dkim-atps=neutral Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 45p0zF721vzDqbv for ; Tue, 16 Jul 2019 23:06:49 +1000 (AEST) Received: by mail-pf1-x443.google.com with SMTP id f17so5109611pfn.6 for ; Tue, 16 Jul 2019 06:06:49 -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=HndzIrwk0eloZ/VKZJ3ivaH1s8315qlKpsro16xZw70=; b=b8dhUBZSz3RGMnHXa2eQUBcpb0Fr1c6vhDDwn4sy14RwoF3LeMqo4GwVei/eUCKLfN 2ysAKK0S6zo65plaT8Lmyu1cdKbX5vv5C3GPTJPIInad+mBHinkOAREnbCNuxmpL9VDG fvZUIwNFnzQNqEmzHkL0RRQ1MQkDpVZLaNNcaAVC/zAYUxremZf5+M3FMQbomiyN3wH4 zc2zC/xff3jM5dpplZUlTKdEFImIprhxsju27ez6MU1i0OsgFNq72UzfzJW9Togr4CqO YkkRxSa2wlAwsL/E0oFuYOap/7lvKcKnsDSBvmk5MITFO2BYwQSiCBv4/QcWtaXdxpFP 2++g== 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=HndzIrwk0eloZ/VKZJ3ivaH1s8315qlKpsro16xZw70=; b=RB3EBL36oVrvKw6FMMBJgYFHtIL+0320ur+IfbabkackG9EDOTsV1vP9BQS0MiUStV 2LitM/al947E9iNhNQCDq4fEn0pqgNUTNz6ftCKD2kItQOClqyUF9t0ubwqOzIqwWWlX PmErXihxq60MScJcJnPRf5Y0ADu9pHy6Qx5mERF+DKm9lI5RNeYGNNMdtLWnwbYWvWJL ospL/n9krXczXBoctmReoS0yITD4ZZAcn1+YnHznpZBpc8BRFVto7Mqt5GnI24bYCzy4 S65bxBchDYwW7ymsD92fStpTVenNrUSJsuHKcMTvz2CMJE+ZsmKllQjDAXF2msXrmZpg HBPQ== X-Gm-Message-State: APjAAAWJC0ZCJL4sSWoBm61jFnSXID2a1GDN0NRs+vK9mfrJADcbK/a6 CDxZEti/0vctspjWMk5Filk= X-Google-Smtp-Source: APXvYqxc7HGOD0D5gu8WnhNrsT1I3LmFfpI6lWg9smWBUfjHYlbiTNFFnqhLddSt9tTLEeru8OLm5Q== X-Received: by 2002:a63:b1d:: with SMTP id 29mr33615344pgl.103.1563282405436; Tue, 16 Jul 2019 06:06:45 -0700 (PDT) Received: from brauner.io ([172.58.30.188]) by smtp.gmail.com with ESMTPSA id a12sm42618252pje.3.2019.07.16.06.06.37 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 16 Jul 2019 06:06:44 -0700 (PDT) Date: Tue, 16 Jul 2019 15:06:33 +0200 From: Christian Brauner To: Christian Borntraeger Subject: Re: [PATCH 1/2] arch: mark syscall number 435 reserved for clone3 Message-ID: <20190716130631.tohj4ub54md25dys@brauner.io> References: <20190714192205.27190-1-christian@brauner.io> <20190714192205.27190-2-christian@brauner.io> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org, arnd@arndb.de, linux-sh@vger.kernel.org, Heiko Carstens , linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-alpha@vger.kernel.org, sparclinux@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Vasily Gorbik Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Mon, Jul 15, 2019 at 03:56:04PM +0200, Christian Borntraeger wrote: > I think Vasily already has a clone3 patch for s390x with 435. A quick follow-up on this. Helge and Michael have asked whether there are any tests for clone3. Yes, there will be and I try to have them ready by the end of the this or next week for review. In the meantime I hope the following minimalistic test program that just verifies very very basic functionality (It's not pretty.) will help you test: #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef CLONE_PIDFD #define CLONE_PIDFD 0x00001000 #endif #ifndef __NR_clone3 #define __NR_clone3 -1 #endif static pid_t sys_clone3(struct clone_args *args) { return syscall(__NR_clone3, args, sizeof(struct clone_args)); } static int wait_for_pid(pid_t pid) { int status, ret; again: ret = waitpid(pid, &status, 0); if (ret == -1) { if (errno == EINTR) goto again; return -1; } if (ret != pid) goto again; if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) return -1; return 0; } #define ptr_to_u64(ptr) ((__u64)((uintptr_t)(ptr))) int main(int argc, char *argv[]) { int pidfd = -1; pid_t parent_tid = -1, pid = -1; struct clone_args args = {0}; args.parent_tid = ptr_to_u64(&parent_tid); /* CLONE_PARENT_SETTID */ args.pidfd = ptr_to_u64(&pidfd); /* CLONE_PIDFD */ args.flags = CLONE_PIDFD | CLONE_PARENT_SETTID; args.exit_signal = SIGCHLD; pid = sys_clone3(&args); if (pid < 0) { fprintf(stderr, "%s - Failed to create new process\n", strerror(errno)); exit(EXIT_FAILURE); } if (pid == 0) { printf("Child process with pid %d\n", getpid()); exit(EXIT_SUCCESS); } printf("Parent process received child's pid %d as return value\n", pid); printf("Parent process received child's pidfd %d\n", *(int *)args.pidfd); printf("Parent process received child's pid %d as return argument\n", *(pid_t *)args.parent_tid); if (wait_for_pid(pid)) exit(EXIT_FAILURE); if (pid != *(pid_t *)args.parent_tid) exit(EXIT_FAILURE); close(pidfd); return 0; }