From patchwork Tue Jul 16 22:41:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kir Kolyshkin X-Patchwork-Id: 1961345 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=FzDguTpf; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WNvFq0Xbnz1ySl for ; Wed, 17 Jul 2024 08:42:07 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 27C23384772B for ; Tue, 16 Jul 2024 22:42:05 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by sourceware.org (Postfix) with ESMTPS id 25D083858C56 for ; Tue, 16 Jul 2024 22:41:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 25D083858C56 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 25D083858C56 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::82a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721169708; cv=none; b=oAcAsl94X6xfs29vdPXehh3SbYNXh09eRdGao2wEm6yUKcFygfdbOnKuYNIWYYpmLeO+OGPr+ziazhOhyjf+RuOF6q/Vo2BzAfuV7Use0rihOGc3DPv67/OubmQcXu6Z4zgUUlmNfJoKhiHulpXy+CFSExFhw+mT9O1stYZKLp8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721169708; c=relaxed/simple; bh=HjZt3KbLxyt2FWnmlKB2hBPCntfhM+zDGOS6pnoN/QU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=O9hUgB9gWsfgXaohC0ClKKO1SslOol2nXkfCF9fPrcGven7BnVuc5TY1o4YSGOe/Xdi6O6SeAXl4dSxlbO3BfebtcOMC75Vdqtr98nYh+HNYpqb/ScSpMJI4EaChF4C1WKb09RxOxbkzgASGy/FgPqyAKrloDw4bEUkYcMjHrdU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-qt1-x82a.google.com with SMTP id d75a77b69052e-447e2d719afso2042871cf.0 for ; Tue, 16 Jul 2024 15:41:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721169705; x=1721774505; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=s7M9dMMyHXb1b+6FfrrKJ8uAnQkKyD2LxHKSi3ecF04=; b=FzDguTpfLh65IbHlQwfT0Hr57wzEDaXCF2uSH02qyV3YiPweqCsFooXxVVc5hDJeST M8GTsUaGfGxU66iU6daZ3+tRAfIl0YF6a5efMphs64OLq55Av7sTvzrL/ivjLsKIK9bg G7h8AXpwAWo7R2PTOukgd0+zS84BduW8fVRwpyPy5+bAN+3VzK22PJsBUKc2Rj/Y3XqU NRHvpL/Ewii8qC6tIc6xv81usVeISavl6JRDoLqIxCCNGxX5WWw8B4MBkYvyLe8FKRVl jc3mhb2FBNnDCv8DmsUKRFInlkx5kCZIBjtTwB9f4eAF1Jtuz/r4U/hH2sD9jdqAjOfH fHeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721169705; x=1721774505; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=s7M9dMMyHXb1b+6FfrrKJ8uAnQkKyD2LxHKSi3ecF04=; b=ebSTS+Fbz3RcwGuVU2i7cMERfDNcXGHH6W4NP5LGYn32E/vY4dfvAmt9pdh42wB/9z ng537DBqw6OEMTI6wo6ehfUP3/DRlSRGaT39tAvBTiT0aGLgHWriJYmUkHlLa9NjOj98 f02rPui1FLdWRZvFXOiboO+GV7EeB2+SzTLenWkNxoY2K+WPFIwD9Wp6dSHVKuX3tdYh Cx0fRXccbg+P9G1tWXKya5iCB2a3Av8uKQCt3iQI4BBxEz3Wl5KDTVqbck5faq1a+hu1 G0CicYcso69HvHpQVieshlQsF3uUqD7AbLaZT1p7/wIOiH25GXdR6JxsZJcNjqceVXit TTHg== X-Gm-Message-State: AOJu0YzEHoIaEOcH3U5czmhHJf/HOR8+W1CgwvIEKpR5c3vEt4apM/1P 0gl8xvNq5qlFgzwosy0b0SgEiA3ElHkAOlZTG6c0XN8yWBqWE2lRF+/Dyg== X-Google-Smtp-Source: AGHT+IGiuBoXRrGjGU7VffD3lxL27Uti5W7Zn2iRmtJ+4i/y5XetQIfSfNyeaAPCVV2BcNOwOmB83A== X-Received: by 2002:ac8:5e0a:0:b0:447:f657:8a38 with SMTP id d75a77b69052e-44f7ca8bbbamr45302281cf.32.1721169704861; Tue, 16 Jul 2024 15:41:44 -0700 (PDT) Received: from kir-tp1.redhat.com (c-67-160-124-188.hsd1.wa.comcast.net. [67.160.124.188]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-44f5b7c3fe7sm39716301cf.11.2024.07.16.15.41.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 15:41:44 -0700 (PDT) From: Kir Kolyshkin To: libc-alpha@sourceware.org Cc: Kir Kolyshkin Subject: [PATCH 1/2] linux: fix/improve clone_args description Date: Tue, 16 Jul 2024 15:41:35 -0700 Message-ID: <20240716224136.784105-1-kolyshkin@gmail.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org Fixes: - pidfd type is *int (as it's a file descriptor), not pid_t; - parent_tid type is *pid_t (as it's a TID), not int. While at it, describe which flags are needed to be set to use some of these fields. Fixes: d8ea0d0168 ("Add an internal wrapper for clone, clone2 and clone3") Signed-off-by: Kir Kolyshkin --- sysdeps/unix/sysv/linux/clone3.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sysdeps/unix/sysv/linux/clone3.h b/sysdeps/unix/sysv/linux/clone3.h index deff63da2a..d097ed7502 100644 --- a/sysdeps/unix/sysv/linux/clone3.h +++ b/sysdeps/unix/sysv/linux/clone3.h @@ -41,25 +41,28 @@ struct clone_args { /* Flags bit mask. */ __aligned_uint64_t flags; - /* Where to store PID file descriptor (pid_t *). */ + /* Where to store PID file descriptor (int *). Needs CLONE_PIDFD flag set. */ __aligned_uint64_t pidfd; - /* Where to store child TID, in child's memory (pid_t *). */ + /* Where to store child TID, in child's memory (pid_t *). + * Needs CLONE_CHILD_SETTID flag set. */ __aligned_uint64_t child_tid; - /* Where to store child TID, in parent's memory (int *). */ + /* Where to store child TID, in parent's memory (pid_t *). + * Needs CLONE_PARENT_SETTID flag set. */ __aligned_uint64_t parent_tid; - /* Signal to deliver to parent on child termination */ + /* Signal to deliver to parent on child termination. */ __aligned_uint64_t exit_signal; /* The lowest address of stack. */ __aligned_uint64_t stack; /* Size of stack. */ __aligned_uint64_t stack_size; - /* Location of new TLS. */ + /* Location of new TLS. Needs CLONE_SETTLS flag set. */ __aligned_uint64_t tls; /* Pointer to a pid_t array (since Linux 5.5). */ __aligned_uint64_t set_tid; /* Number of elements in set_tid (since Linux 5.5). */ __aligned_uint64_t set_tid_size; - /* File descriptor for target cgroup of child (since Linux 5.7). */ + /* File descriptor for target cgroup of child (since Linux 5.7). + * Needs CLONE_INTO_CGROUP flag set. */ __aligned_uint64_t cgroup; };