From nobody Wed Jan 7 23:10:32 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E99D835979 for ; Sun, 4 Jan 2026 22:43:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767566633; cv=none; b=gSwGWQkUbD5e2qoAWU0Dr4SGYVnr3k6V56gme9hxg0YwJM6DkQv3YOXwOZ1rLQsV2TTliAIK9gKVJnJ9RPmOoqVZ0VqRXaOogEKnzoAAbeWUHAGXBHbG3Z7x1PTcRgfp2LvES8qFSbrdH9f7051BU7vlOUR3vW1stpzVFPY8ghY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767566633; c=relaxed/simple; bh=uBQFBM74JZL9ajdg8IZMGnuHYnK5VApUZXvyYdDrMAY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=MAzQOtGouFbdBOgMyONp+d1d4+S60Y6UHt050V/oxu34ASIJa2AoXbAX9ihB9uWnaX1gDHGD3PUbiFBswh9I2h7TSHGxUbNgvQpuj3Y6g0xdvVE+OQTRK8+MCpsSvFBZX14xJkggxyKLG9lZYRwpVxkVVOWbrgGiMJDx8YUGGSg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=jMxHlntu; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="jMxHlntu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1767566629; bh=uBQFBM74JZL9ajdg8IZMGnuHYnK5VApUZXvyYdDrMAY=; h=From:Date:Subject:To:Cc:From; b=jMxHlntum804IFFR5LorlZeUkqE8USqP50xo+uy3Ae5Ms9Ylbb0sa/rEZhD7TQIAD lBHkSee+0Y/Y4X8WBjfvJvQuWCZl+hJJzt6jl8aLcwRhbISPH4dNQpO7gJu06HgHhk WYRn7ffhvbnS4vgxS41laytxFyDvyxtqdCi32SFc= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 04 Jan 2026 23:43:13 +0100 Subject: [PATCH] tools/nolibc: align sys_vfork() with sys_fork() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260104-nolibc-vfork-v1-1-a63464b9e4e6@weissschuh.net> X-B4-Tracking: v=1; b=H4sIAADtWmkC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIzMDQwMT3bz8nMykZN2ytPyibN3UxFQLy9Q0AzML01QloJaCotS0zAqwcdG xtbUAFj4AoF4AAAA= X-Change-ID: 20260104-nolibc-vfork-eae89ef0685e To: Willy Tarreau Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1767566629; l=2647; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=uBQFBM74JZL9ajdg8IZMGnuHYnK5VApUZXvyYdDrMAY=; b=9pYPIMYT1M9svZe4aN72vmEsXEWEygw175cfEeKa7cdpsFwfuhije1K3Kltc8Gok8jt0ru/wi XZE+N2ESejeA9ObM6ACttKA/m3mAL9paGfnUuCpyt+YU4P2UvE2Q8rW X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Currently the generic variants of sys_fork() and sys_vfork() differ in both they precedence of used system calls and the usage of sys_clone() vs sys_clone3(). While the interface of clone3() in sys_vfork() is more consistent over different architectures, qemu-user does not support it, making testing harder. We already handle the different clone() interfaces for sys_fork() in the architecture-specific headers, and can do so also for sys_vfork(). In fact SPARC already has such handling and only s390 is currently missing. Signed-off-by: Thomas Wei=C3=9Fschuh Acked-by: Willy Tarreau --- tools/include/nolibc/arch-s390.h | 8 ++++++++ tools/include/nolibc/sys.h | 18 +++++------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/include/nolibc/arch-s390.h b/tools/include/nolibc/arch-s= 390.h index 5bee6ecbde0a..904281e95f99 100644 --- a/tools/include/nolibc/arch-s390.h +++ b/tools/include/nolibc/arch-s390.h @@ -8,6 +8,7 @@ =20 #include "types.h" =20 +#include #include #include =20 @@ -189,4 +190,11 @@ pid_t sys_fork(void) } #define sys_fork sys_fork =20 +static __attribute__((unused)) +pid_t sys_vfork(void) +{ + return my_syscall5(__NR_clone, 0, CLONE_VM | CLONE_VFORK | SIGCHLD, 0, 0,= 0); +} +#define sys_vfork sys_vfork + #endif /* _NOLIBC_ARCH_S390_H */ diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index 847af1ccbdc9..403ee9ce8389 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -22,7 +22,7 @@ #include #include #include /* for O_* and AT_* */ -#include /* for clone_args */ +#include /* for CLONE_* */ #include /* for statx() */ =20 #include "errno.h" @@ -363,19 +363,11 @@ pid_t fork(void) static __attribute__((unused)) pid_t sys_vfork(void) { -#if defined(__NR_vfork) +#if defined(__NR_clone) + /* See the note in sys_fork(). */ + return my_syscall5(__NR_clone, CLONE_VM | CLONE_VFORK | SIGCHLD, 0, 0, 0,= 0); +#elif defined(__NR_vfork) return my_syscall0(__NR_vfork); -#else - /* - * clone() could be used but has different argument orders per - * architecture. - */ - struct clone_args args =3D { - .flags =3D CLONE_VM | CLONE_VFORK, - .exit_signal =3D SIGCHLD, - }; - - return my_syscall2(__NR_clone3, &args, sizeof(args)); #endif } #endif --- base-commit: 6f882963bd535af05fbed02a299d5d40d15f80a5 change-id: 20260104-nolibc-vfork-eae89ef0685e Best regards, --=20 Thomas Wei=C3=9Fschuh