From nobody Sun Feb 8 07:48:08 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 4BAA333A03A; Wed, 29 Oct 2025 16:04:50 +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=1761753891; cv=none; b=iTRisic9/nNo+gP4fikYBDXcpPDTqHX0DlUIsYDfmqOdliqQZRQdr1PJLmst+GsIhfXg5M3h+v2rndLYoAoVlIIIyXygPKoJnskahGtSkMJ1Dl1+iAu+Co4T0GaFE0EIAxVLEL9LhfAd+1v2L8xiN3EFP3e7E2vZzQQgRLmRPDM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761753891; c=relaxed/simple; bh=qoHkysGDKD9OEHMs63XhS35a1MFgD32k3DYU2BDI5W0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KVJVTTxORX+1515OBRWgXBlEUN6P7QJdXyLgAjODYgDTwy+te0iGlXSRjskXFZ69KVx2kcyD2p6C0mTcrA32Rsy/N/JL0qNrhORuBRRNFGK4UJnJYrWzRBEnl1V796UccBhQmsDSbDNBmDXQYbivK085vz1UwRdrchxDhBLsTAE= 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=GTTEROS3; 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="GTTEROS3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1761753882; bh=qoHkysGDKD9OEHMs63XhS35a1MFgD32k3DYU2BDI5W0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=GTTEROS3AkaLH6Hr1fVXMTjEwJe73kokdKJ65auyDN6PfUStwttLkHmVmkIduIQ8N 8x3IEEkx6hW/gkTBYKZDWfFnl8seypat+ByfYxy+jNVLLT1XiduoWQ9naFfJBu8gTg 6ZJWN75yMgjB/T0HpCMdkK+Ls5nwv+FJ8GOjKGXM= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 29 Oct 2025 17:02:51 +0100 Subject: [PATCH 01/12] tools/nolibc: use 64-bit ino_t 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: <20251029-nolibc-uapi-types-v1-1-e79de3b215d8@weissschuh.net> References: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> In-Reply-To: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@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=1761753881; l=1065; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=qoHkysGDKD9OEHMs63XhS35a1MFgD32k3DYU2BDI5W0=; b=5mOLkkb6xRER4W+yPG9V2o5W3KgxjU8UFPI52SML1Ysw9pxLw7AxfTLvso/vv6sA+3T51Qr4b GNwsixToGWyC1LoPrJKTZ03cNBgF9wcK4KDomjH6JVHWXHGAymKJswk X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The kernel uses 64-bit values for inode numbers. Currently these might be truncated to 32-bit when assigned to nolibc's ino_t values. Switch to 64-bit ino_t consistently. As ino_t is never used directly in kernel ABIs, no systemcall wrappers need to be adapted. Suggested-by: Arnd Bergmann Link: https://lore.kernel.org/lkml/cec27d94-c99d-4c57-9a12-275ea663dda8@app= .fastmail.com/ Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/include/nolibc/std.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/include/nolibc/std.h b/tools/include/nolibc/std.h index 2c1ad23b9b5c..eae457d60858 100644 --- a/tools/include/nolibc/std.h +++ b/tools/include/nolibc/std.h @@ -20,7 +20,7 @@ =20 /* those are commonly provided by sys/types.h */ typedef unsigned int dev_t; -typedef unsigned long ino_t; +typedef uint64_t ino_t; typedef unsigned int mode_t; typedef signed int pid_t; typedef unsigned int uid_t; --=20 2.51.1.dirty From nobody Sun Feb 8 07:48:08 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 48356272E6D; Wed, 29 Oct 2025 16:04:50 +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=1761753891; cv=none; b=W1CSeMMdNL1pa/U3VXcIrJiYyXB3fmacJNumNsOzTKJURuIDCvcfTaztFXSg1eaN6P/TqrIsBd6Hd6an89pg6ed1mHgPaVZJoUoQXrDpZDGA3mq00X1TAUfwbkCUMWO4B6S7Xed/dsxtjvZIwxmCOq+Aa85VWQncwRs/2R65G6Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761753891; c=relaxed/simple; bh=3TD82kCZR1eUnCRzxDHjKFGl3wY+LjKiHLo/qxVzWVM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pnZzl6Vgb3cB8hwHMTQFJh3lNq4sSPTWNEGdJmN2ItpHaa5abSzASxn+CPCsjXSeUbJGukdFyI4BgTXcg6DIKRanmVV6xeGwnfRQTdfM2ik5uFOfUIOmnr4FbAh7/cGu/s4CVFpXBh3oLCokKb1CBBUyt5iWzHbZ2zphHCWz4O8= 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=cbtP9S3t; 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="cbtP9S3t" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1761753882; bh=3TD82kCZR1eUnCRzxDHjKFGl3wY+LjKiHLo/qxVzWVM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=cbtP9S3tBLjXuoA0dZzHuRhzLQWD50b2tlCS2kydJsjGQ6zxCnf4Uoe615TXns+W5 0SZZ7v7UhyE/3WJXgiqIhJF5M3ISAEyhDa4l8Ec9IIxzRMjSnvx9egpI5ZaVuDKVHL 6vWS1055Lxsnqw1+ZUVASpuz4zpQJjP6BJpaTx3A= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 29 Oct 2025 17:02:52 +0100 Subject: [PATCH 02/12] tools/nolibc: handle 64-bit off_t for llseek 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: <20251029-nolibc-uapi-types-v1-2-e79de3b215d8@weissschuh.net> References: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> In-Reply-To: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@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=1761753881; l=832; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=3TD82kCZR1eUnCRzxDHjKFGl3wY+LjKiHLo/qxVzWVM=; b=RSO6RXiJE4EgEBbogH8rxXKocscQypP/Y+d+hwaU1fSNMYBs0qX8THyYS3AWz3ngtOVN3pGh8 9Y6T0UmoQCqBf71BrytykZnX1qd1AgEOWSOUsksMme1NM3dTIgDMPNk X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Correctly handle 64-bit off_t values in preparation for 64-bit off_t on 32-bit architectures. Signed-off-by: Thomas Wei=C3=9Fschuh Acked-by: Arnd Bergmann --- tools/include/nolibc/sys.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index 386ed80aead0..321a3bd16ff4 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -599,8 +599,7 @@ off_t sys_lseek(int fd, off_t offset, int whence) off_t result; int ret; =20 - /* Only exists on 32bit where nolibc off_t is also 32bit */ - ret =3D my_syscall5(__NR_llseek, fd, 0, offset, &loff, whence); + ret =3D my_syscall5(__NR_llseek, fd, offset >> 32, (uint32_t)offset, &lof= f, whence); if (ret < 0) result =3D ret; else if (loff !=3D (off_t)loff) --=20 2.51.1.dirty From nobody Sun Feb 8 07:48:08 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 4097033A02D; Wed, 29 Oct 2025 16:04:49 +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=1761753890; cv=none; b=sPqclafHBCcXha8SBLNqIbhnE9XZ+3oXCb/tie+2Kn4fjoNLbnZUF5oYM/7/h1aRrFW05S7g7J1Rk/um46Xs4CneNXOTUc6M+fBhyI/VfOH54iyIfFH/tuOLMU22TkOCIhX1WG7iFD9NmFdoIUz79LzOsO1kS5C7YsnuMHffYeU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761753890; c=relaxed/simple; bh=SI3TbuSQP75RVTmoH4id+zokk+4VkSRTlXS313nQyGs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e4k4SPlYfiwp97CxO/57ReK53nWdDWezKUnU/duG2e6t8PsmpbNZHlL3Sp4cerrChIdWvLSm/b3iVjxUKbTCS5lG1s7ChZMsZTihiXZJaNpK3QA5jiahTNXvS2xaydHESzLISJ59uekdkRcFetOLuVOMIbeDN3JsQGDXr2AX5gY= 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=KNZiG9sO; 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="KNZiG9sO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1761753882; bh=SI3TbuSQP75RVTmoH4id+zokk+4VkSRTlXS313nQyGs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KNZiG9sOMSgYMM2LezULBnkieo33xKgmmr7vMUhCcvaWGjrryGMDNpQI5UL8vEPAv S5wkcTGP0I+4oV/oXpiUUI5v2aDlD/kZiOZs7aprAlSlncrVDSnAnSjz/UbClp8VCG UZyL3acu5egkwxMU/AhkpOgqWNK1UFUGEq6Hgq2E= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 29 Oct 2025 17:02:53 +0100 Subject: [PATCH 03/12] tools/nolibc: prefer the llseek syscall 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: <20251029-nolibc-uapi-types-v1-3-e79de3b215d8@weissschuh.net> References: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> In-Reply-To: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@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=1761753881; l=984; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=SI3TbuSQP75RVTmoH4id+zokk+4VkSRTlXS313nQyGs=; b=iz4yzbcAdS4ljjBwCUIQhSAuwK7up126KF0F0B6noZ5SpVNfqAx5wQM9DDk4FnOtF+ErENeui CIx6nAc/CMiDpEeQnS4IZlirlujS25VnzPmZVuiUOMkasMBopjnMpuy X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Make sure to always use the 64-bit safe system call in preparation for 64-bit off_t on 32 bit architectures. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/include/nolibc/sys.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index 321a3bd16ff4..58cd2bb0f6ce 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -592,9 +592,7 @@ int link(const char *old, const char *new) static __attribute__((unused)) off_t sys_lseek(int fd, off_t offset, int whence) { -#if defined(__NR_lseek) - return my_syscall3(__NR_lseek, fd, offset, whence); -#else +#if defined(__NR_llseek) __kernel_loff_t loff =3D 0; off_t result; int ret; @@ -608,6 +606,8 @@ off_t sys_lseek(int fd, off_t offset, int whence) result =3D loff; =20 return result; +#else + return my_syscall3(__NR_lseek, fd, offset, whence); #endif } =20 --=20 2.51.1.dirty From nobody Sun Feb 8 07:48:08 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 408F23375C3; Wed, 29 Oct 2025 16:04:49 +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=1761753892; cv=none; b=S9ROQXvhfAtADK2jm/cBLUaqLDZMFawMYfDdvxRUExsrAeFtE9nA8CLoRanLp6RPuOfq84FJwCGVxmA407UvDuGGt3HLgQ0QTisuglrqtEHKbo1HG0lyDksTqtqZqy5/NY9H/AiDq+UT1jdQDBKoNcMzKyzxqsF5KalHaTxsBQE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761753892; c=relaxed/simple; bh=p8j6KI5U2HWyMls37DISJDXR7gsqGwKcS5o2esypx3E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UI0YRNCMh74spdwoI+gGZB54iOIsPdSZ7SeKduFHPoHVk3d/oXjIAO3S8NjIqdszn0imnBupCJ5VOc+gU3AAubqjMdHCUOYclhRJpVY3QN7oA1R4qjzaoEOrLOUkD+iy4Qvq4Ufn2hctXJddse0n+v8z0ut5abUJbbCQ18sbzYc= 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=VJ+bfWtS; 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="VJ+bfWtS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1761753882; bh=p8j6KI5U2HWyMls37DISJDXR7gsqGwKcS5o2esypx3E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=VJ+bfWtSmDxg7L5VLT5kMYe+vSl3kItv6MhK+AO4DIQudR/8DIYd/ZTB9HwYK9K3b NiEyzKk7YX5Sg9qC/ycRpayl0SjMXfHrWMvS1wPJCc4vRgXnzjT+oInDE7JH8ZF1OP 9BFL6A0NDKXjmykxwHs4Z13hjILq3yisdscZH+Ok= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 29 Oct 2025 17:02:54 +0100 Subject: [PATCH 04/12] tools/nolibc: use 64-bit off_t 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: <20251029-nolibc-uapi-types-v1-4-e79de3b215d8@weissschuh.net> References: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> In-Reply-To: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@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=1761753881; l=1030; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=p8j6KI5U2HWyMls37DISJDXR7gsqGwKcS5o2esypx3E=; b=b/w0aY84tvGY5qVbZlu9Qgoas141xbvuYg3ANiAFrcUxLKME3YjnNu2IKOhzv0WiALXXFlhm2 R3BCpM5UkZzAxnHCVbO2c1qM1tHIW9VMMUaXTlb7MUp6rqQQXovGq00 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The kernel uses 64-bit values for file offsets. Currently these might be truncated to 32-bit when assigned to nolibc's off_t values. Switch to 64-bit off_t consistently. Suggested-by: Arnd Bergmann Link: https://lore.kernel.org/lkml/cec27d94-c99d-4c57-9a12-275ea663dda8@app= .fastmail.com/ Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/include/nolibc/std.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/include/nolibc/std.h b/tools/include/nolibc/std.h index eae457d60858..392f4dd94158 100644 --- a/tools/include/nolibc/std.h +++ b/tools/include/nolibc/std.h @@ -26,7 +26,7 @@ typedef signed int pid_t; typedef unsigned int uid_t; typedef unsigned int gid_t; typedef unsigned long nlink_t; -typedef signed long off_t; +typedef int64_t off_t; typedef signed long blksize_t; typedef signed long blkcnt_t; typedef __kernel_time_t time_t; --=20 2.51.1.dirty From nobody Sun Feb 8 07:48:08 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 9F99A34C99D; Wed, 29 Oct 2025 16:04:52 +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=1761753894; cv=none; b=jhL8UMO3yVT9SZnHWv2IgnrRNuX/4dBg7536l8CwbPN55XjVqyG+4sf62EpOU/t84ba1qS3UVcQyGT/n7d2f3nGdX9nJTuiWwHDhlF+f1+DbfuPNzYTQU8nLIqDw2DS2W+MfZ2QXehAbmNxmeWmUWaPkoCc/UhmvkFity8hvOxI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761753894; c=relaxed/simple; bh=c0ffcg/Cy/iLaabPjYtIOeiQB2bz7Rfn8U/JmWPANak=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r6WMyUPjO4rfXaZ0QL72Bu5WbbbI6aZovEvCorWYF60T33SCOkeuZh9aJojlqFY4ygHbLCo+T7OaV2A9UIUPauJ7e+AGFvvl0cp7dXfQeA7rl0ymeoYb1EY3AJmvgfsOQwKsOiLsyoNLwCbhPqxtNE4qRsxR/3V6hFiIvRJELWY= 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=EmcQPV+e; 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="EmcQPV+e" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1761753883; bh=c0ffcg/Cy/iLaabPjYtIOeiQB2bz7Rfn8U/JmWPANak=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EmcQPV+eeFxIkFt/h+sh9JKBVN5wSQfvNs04PolfXg8wh6Nd8b4WjfYLFB6cWhtVg SBHC/yZV/7BRm/f+r+RyN31vETZzqJgdHnhhg/qOsjCkSb5H46ncB2PmrXNjycrrAX pi61BS1BHRPipDi1694n4NHWpAYn2qkhNhymcstY= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 29 Oct 2025 17:02:55 +0100 Subject: [PATCH 05/12] tools/nolibc: remove now superfluous overflow check in llseek 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: <20251029-nolibc-uapi-types-v1-5-e79de3b215d8@weissschuh.net> References: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> In-Reply-To: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@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=1761753881; l=707; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=c0ffcg/Cy/iLaabPjYtIOeiQB2bz7Rfn8U/JmWPANak=; b=MfyGuJFfsfRsdh+SnrGFzpaOjSFpGmTd22bSsUUYLm8gQy/6llbi8XBlHcekXGmroEzq4nfqh UgkNXDQyLSfBGFQH+1jKraRotAWQP7Y+pffsOmquYqFJZhAsHmFeccJ X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= As off_t is now always 64-bit wide this overflow can not happen anymore, remove the check. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Arnd Bergmann --- tools/include/nolibc/sys.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index 58cd2bb0f6ce..e91b7d947161 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -600,8 +600,6 @@ off_t sys_lseek(int fd, off_t offset, int whence) ret =3D my_syscall5(__NR_llseek, fd, offset >> 32, (uint32_t)offset, &lof= f, whence); if (ret < 0) result =3D ret; - else if (loff !=3D (off_t)loff) - result =3D -EOVERFLOW; else result =3D loff; =20 --=20 2.51.1.dirty From nobody Sun Feb 8 07:48:08 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 7F06334BA50; Wed, 29 Oct 2025 16:04:52 +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=1761753894; cv=none; b=jFxjBwjRMUiekzqsx0xhwZkW9gRBiVf4NUzDFbpXyyfJNR+JkHPd116Bw72tFLvcAJBAbGwCHYlhwESLx6bCVtA5XcnBz9v3qGfZ45WD/1Lf6rzhObFldKdvsj4Ppdd3YB3SOeJCRnAPrPH3vtd420pzyIk3xD01wNV8dSECJ3Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761753894; c=relaxed/simple; bh=uQ4VuDACIC74mOTa+M7TyhSvihH8rx+FoRO7JkSOWzY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IcbEz6EWXXRzxSgwaPSkPT3pAxZrXyWC0UcQl532eb98tUgqfIYM4OGspmxLgtRUxVCWMcC4vEhdz322skTO5S04Jqi0YCWrX6Cr1H9G/8828GOCNfsFGa+zdUkDoMuHGspoo7m9h/z2MkxgG2L7TUS8gI0i1X59w6qXNmU/IEU= 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=tqJA1+zd; 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="tqJA1+zd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1761753883; bh=uQ4VuDACIC74mOTa+M7TyhSvihH8rx+FoRO7JkSOWzY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tqJA1+zdmnET/tyP0kbhPl6XqZCljrQMaBmqZYKaBE66GLSRuqWkHFEE6QKH6XI3i gNxeuAcpP9pnp262UE+QDcugfjJpN91yfvBLW2l1UWuqAIn0TPrvSu2+QW9h1I+ufn 6D2t9e8ut4kri7Av8cFhFGYKARgxj0RAo/X8UfJM= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 29 Oct 2025 17:02:56 +0100 Subject: [PATCH 06/12] tools/nolibc: remove more __nolibc_enosys() fallbacks 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: <20251029-nolibc-uapi-types-v1-6-e79de3b215d8@weissschuh.net> References: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> In-Reply-To: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@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=1761753881; l=2817; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=uQ4VuDACIC74mOTa+M7TyhSvihH8rx+FoRO7JkSOWzY=; b=43abOEqlGvCcTyJLcCO0X0uULXfHvE1PisOLu5UJspT82sJgJj+JrxJjXwGU8Mtc1IBx6FCjs yF2o7FgPPhfCFAkCVB9B2BBSkeAiNOmDdSGF0qF1y+EGb4exxql0NPB X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Commit e6366101ce1f ("tools/nolibc: remove __nolibc_enosys() fallback from time64-related functions") removed many of these fallbacks but forgot a few. Finish the job. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/include/nolibc/time.h | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/tools/include/nolibc/time.h b/tools/include/nolibc/time.h index 6c276b8d646a..48e78f8becf9 100644 --- a/tools/include/nolibc/time.h +++ b/tools/include/nolibc/time.h @@ -89,13 +89,11 @@ int sys_clock_settime(clockid_t clockid, struct timespe= c *tp) { #if defined(__NR_clock_settime) return my_syscall2(__NR_clock_settime, clockid, tp); -#elif defined(__NR_clock_settime64) +#else struct __kernel_timespec ktp; =20 __nolibc_timespec_user_to_kernel(tp, &ktp); return my_syscall2(__NR_clock_settime64, clockid, &ktp); -#else - return __nolibc_enosys(__func__, clockid, tp); #endif } =20 @@ -111,7 +109,7 @@ int sys_clock_nanosleep(clockid_t clockid, int flags, c= onst struct timespec *rqt { #if defined(__NR_clock_nanosleep) return my_syscall4(__NR_clock_nanosleep, clockid, flags, rqtp, rmtp); -#elif defined(__NR_clock_nanosleep_time64) +#else struct __kernel_timespec krqtp, krmtp; int ret; =20 @@ -120,8 +118,6 @@ int sys_clock_nanosleep(clockid_t clockid, int flags, c= onst struct timespec *rqt if (rmtp) __nolibc_timespec_kernel_to_user(&krmtp, rmtp); return ret; -#else - return __nolibc_enosys(__func__, clockid, flags, rqtp, rmtp); #endif } =20 @@ -195,7 +191,7 @@ int sys_timer_gettime(timer_t timerid, struct itimerspe= c *curr_value) { #if defined(__NR_timer_gettime) return my_syscall2(__NR_timer_gettime, timerid, curr_value); -#elif defined(__NR_timer_gettime64) +#else struct __kernel_itimerspec kcurr_value; int ret; =20 @@ -203,8 +199,6 @@ int sys_timer_gettime(timer_t timerid, struct itimerspe= c *curr_value) __nolibc_timespec_kernel_to_user(&kcurr_value.it_interval, &curr_value->i= t_interval); __nolibc_timespec_kernel_to_user(&kcurr_value.it_value, &curr_value->it_v= alue); return ret; -#else - return __nolibc_enosys(__func__, timerid, curr_value); #endif } =20 @@ -220,7 +214,7 @@ int sys_timer_settime(timer_t timerid, int flags, { #if defined(__NR_timer_settime) return my_syscall4(__NR_timer_settime, timerid, flags, new_value, old_val= ue); -#elif defined(__NR_timer_settime64) +#else struct __kernel_itimerspec knew_value, kold_value; int ret; =20 @@ -232,8 +226,6 @@ int sys_timer_settime(timer_t timerid, int flags, __nolibc_timespec_kernel_to_user(&kold_value.it_value, &old_value->it_va= lue); } return ret; -#else - return __nolibc_enosys(__func__, timerid, flags, new_value, old_value); #endif } =20 --=20 2.51.1.dirty From nobody Sun Feb 8 07:48:08 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 A2EB534C9A1; Wed, 29 Oct 2025 16:04:52 +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=1761753894; cv=none; b=mCLf3vutKTygZ4YvRd2G3PFqpB/FahC2qy6UZh4z57fJHFlpVjLQmjIkKnRpbsGCYfMO0Qmp2aMpjNOgtulTYtvTZKkjLxxSkmyGp1cxB6obcrbI3GMyQYW7oHpvdwYINUIwHqpDZoe1uTWSdcQIeVDtmmd44clpsYAjBrRo9sM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761753894; c=relaxed/simple; bh=0A45xpzvKbPrrYaNpTs9c+STsYhlnTFgvULL8ObrQmo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dFLx5v1GRBj/D66amli3HfKasZxP9nyJdMSgTntnmQf/AqaeNRneIVT0tmeqpekv/afBa5WHmbfckIo00ff302PuI0RvXdgGzaa90KTvg31gXhqJeabfGzmvsvkb7vU6hLL9OCtz+MjbLU/GX3qDWcnN8yivpBuSUoz9CxpJYvg= 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=ofo3Zk1l; 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="ofo3Zk1l" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1761753884; bh=0A45xpzvKbPrrYaNpTs9c+STsYhlnTFgvULL8ObrQmo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ofo3Zk1l573oM8YFf2ZHQMwOlp5zozgvj5QegpaPP2FRz0w+mSagIxp4FbVQxD9Ve ujOmVZZv7PFFubWs4s/z1WtF7M0ju3cGgb9oVHnOV5SpCrn52/8M8jqEgsJ8deVD7w 8iOSeGGZ47pnkSAyk6x5JmFM7OGB13UkAIABcEGo= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 29 Oct 2025 17:02:57 +0100 Subject: [PATCH 07/12] tools/nolibc: prefer explicit 64-bit time-related system calls 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: <20251029-nolibc-uapi-types-v1-7-e79de3b215d8@weissschuh.net> References: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> In-Reply-To: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@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=1761753881; l=6960; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=0A45xpzvKbPrrYaNpTs9c+STsYhlnTFgvULL8ObrQmo=; b=0kjgPGjR/c2EwbyNZdIZZj4rDs0fAOgJT+Db5HT2tnpK9oIv296qxKwoRFyVkmj/tNwNO0ePt fmz2sAH8DBeBuTeWjsFznOVCUAxHF3RzsZYAPTE610+29XwtIPP7wH8 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Make sure to always use the 64-bit safe system calls in preparation for 64-bit time_t on 32-bit architectures. Also prevent issues on kernels which disable CONFIG_COMPAT_32BIT_TIME and therefore don't provide the 32-bit system calls anymore. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/include/nolibc/poll.h | 12 ++++++------ tools/include/nolibc/sys.h | 10 +++++----- tools/include/nolibc/time.h | 36 ++++++++++++++++++------------------ 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/tools/include/nolibc/poll.h b/tools/include/nolibc/poll.h index 0d053f93ea99..5ff911b73b34 100644 --- a/tools/include/nolibc/poll.h +++ b/tools/include/nolibc/poll.h @@ -23,22 +23,22 @@ static __attribute__((unused)) int sys_poll(struct pollfd *fds, int nfds, int timeout) { -#if defined(__NR_ppoll) - struct timespec t; +#if defined(__NR_ppoll_time64) + struct __kernel_timespec t; =20 if (timeout >=3D 0) { t.tv_sec =3D timeout / 1000; t.tv_nsec =3D (timeout % 1000) * 1000000; } - return my_syscall5(__NR_ppoll, fds, nfds, (timeout >=3D 0) ? &t : NULL, N= ULL, 0); -#elif defined(__NR_ppoll_time64) - struct __kernel_timespec t; + return my_syscall5(__NR_ppoll_time64, fds, nfds, (timeout >=3D 0) ? &t : = NULL, NULL, 0); +#elif defined(__NR_ppoll) + struct timespec t; =20 if (timeout >=3D 0) { t.tv_sec =3D timeout / 1000; t.tv_nsec =3D (timeout % 1000) * 1000000; } - return my_syscall5(__NR_ppoll_time64, fds, nfds, (timeout >=3D 0) ? &t : = NULL, NULL, 0); + return my_syscall5(__NR_ppoll, fds, nfds, (timeout >=3D 0) ? &t : NULL, N= ULL, 0); #else return my_syscall3(__NR_poll, fds, nfds, timeout); #endif diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index e91b7d947161..10c517a38f86 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -772,22 +772,22 @@ int sys_select(int nfds, fd_set *rfds, fd_set *wfds, = fd_set *efds, struct timeva return my_syscall5(__NR__newselect, nfds, rfds, wfds, efds, timeout); #elif defined(__NR_select) return my_syscall5(__NR_select, nfds, rfds, wfds, efds, timeout); -#elif defined(__NR_pselect6) - struct timespec t; +#elif defined(__NR_pselect6_time64) + struct __kernel_timespec t; =20 if (timeout) { t.tv_sec =3D timeout->tv_sec; t.tv_nsec =3D timeout->tv_usec * 1000; } - return my_syscall6(__NR_pselect6, nfds, rfds, wfds, efds, timeout ? &t : = NULL, NULL); + return my_syscall6(__NR_pselect6_time64, nfds, rfds, wfds, efds, timeout = ? &t : NULL, NULL); #else - struct __kernel_timespec t; + struct timespec t; =20 if (timeout) { t.tv_sec =3D timeout->tv_sec; t.tv_nsec =3D timeout->tv_usec * 1000; } - return my_syscall6(__NR_pselect6_time64, nfds, rfds, wfds, efds, timeout = ? &t : NULL, NULL); + return my_syscall6(__NR_pselect6, nfds, rfds, wfds, efds, timeout ? &t : = NULL, NULL); #endif } =20 diff --git a/tools/include/nolibc/time.h b/tools/include/nolibc/time.h index 48e78f8becf9..45df9b09d7b6 100644 --- a/tools/include/nolibc/time.h +++ b/tools/include/nolibc/time.h @@ -43,9 +43,7 @@ void __nolibc_timespec_kernel_to_user(const struct __kern= el_timespec *kts, struc static __attribute__((unused)) int sys_clock_getres(clockid_t clockid, struct timespec *res) { -#if defined(__NR_clock_getres) - return my_syscall2(__NR_clock_getres, clockid, res); -#else +#if defined(__NR_clock_getres_time64) struct __kernel_timespec kres; int ret; =20 @@ -53,6 +51,8 @@ int sys_clock_getres(clockid_t clockid, struct timespec *= res) if (res) __nolibc_timespec_kernel_to_user(&kres, res); return ret; +#else + return my_syscall2(__NR_clock_getres, clockid, res); #endif } =20 @@ -65,9 +65,7 @@ int clock_getres(clockid_t clockid, struct timespec *res) static __attribute__((unused)) int sys_clock_gettime(clockid_t clockid, struct timespec *tp) { -#if defined(__NR_clock_gettime) - return my_syscall2(__NR_clock_gettime, clockid, tp); -#else +#if defined(__NR_clock_gettime64) struct __kernel_timespec ktp; int ret; =20 @@ -75,6 +73,8 @@ int sys_clock_gettime(clockid_t clockid, struct timespec = *tp) if (tp) __nolibc_timespec_kernel_to_user(&ktp, tp); return ret; +#else + return my_syscall2(__NR_clock_gettime, clockid, tp); #endif } =20 @@ -87,13 +87,13 @@ int clock_gettime(clockid_t clockid, struct timespec *t= p) static __attribute__((unused)) int sys_clock_settime(clockid_t clockid, struct timespec *tp) { -#if defined(__NR_clock_settime) - return my_syscall2(__NR_clock_settime, clockid, tp); -#else +#if defined(__NR_clock_settime64) struct __kernel_timespec ktp; =20 __nolibc_timespec_user_to_kernel(tp, &ktp); return my_syscall2(__NR_clock_settime64, clockid, &ktp); +#else + return my_syscall2(__NR_clock_settime, clockid, tp); #endif } =20 @@ -107,9 +107,7 @@ static __attribute__((unused)) int sys_clock_nanosleep(clockid_t clockid, int flags, const struct timespe= c *rqtp, struct timespec *rmtp) { -#if defined(__NR_clock_nanosleep) - return my_syscall4(__NR_clock_nanosleep, clockid, flags, rqtp, rmtp); -#else +#if defined(__NR_clock_nanosleep_time64) struct __kernel_timespec krqtp, krmtp; int ret; =20 @@ -118,6 +116,8 @@ int sys_clock_nanosleep(clockid_t clockid, int flags, c= onst struct timespec *rqt if (rmtp) __nolibc_timespec_kernel_to_user(&krmtp, rmtp); return ret; +#else + return my_syscall4(__NR_clock_nanosleep, clockid, flags, rqtp, rmtp); #endif } =20 @@ -189,9 +189,7 @@ int timer_delete(timer_t timerid) static __attribute__((unused)) int sys_timer_gettime(timer_t timerid, struct itimerspec *curr_value) { -#if defined(__NR_timer_gettime) - return my_syscall2(__NR_timer_gettime, timerid, curr_value); -#else +#if defined(__NR_timer_gettime64) struct __kernel_itimerspec kcurr_value; int ret; =20 @@ -199,6 +197,8 @@ int sys_timer_gettime(timer_t timerid, struct itimerspe= c *curr_value) __nolibc_timespec_kernel_to_user(&kcurr_value.it_interval, &curr_value->i= t_interval); __nolibc_timespec_kernel_to_user(&kcurr_value.it_value, &curr_value->it_v= alue); return ret; +#else + return my_syscall2(__NR_timer_gettime, timerid, curr_value); #endif } =20 @@ -212,9 +212,7 @@ static __attribute__((unused)) int sys_timer_settime(timer_t timerid, int flags, const struct itimerspec *new_value, struct itimerspec *old_value) { -#if defined(__NR_timer_settime) - return my_syscall4(__NR_timer_settime, timerid, flags, new_value, old_val= ue); -#else +#if defined(__NR_timer_settime64) struct __kernel_itimerspec knew_value, kold_value; int ret; =20 @@ -226,6 +224,8 @@ int sys_timer_settime(timer_t timerid, int flags, __nolibc_timespec_kernel_to_user(&kold_value.it_value, &old_value->it_va= lue); } return ret; +#else + return my_syscall4(__NR_timer_settime, timerid, flags, new_value, old_val= ue); #endif } =20 --=20 2.51.1.dirty From nobody Sun Feb 8 07:48:08 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 65A7534DCE0; Wed, 29 Oct 2025 16:04:53 +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=1761753895; cv=none; b=TJRHuQXGhq84osw4yAgS2h+AM04nQw+GeKgVCiuzHzyD48rOMu/UE2/QuBctZofAj/qs+YFTZ7PxbzostaB6OE+i1ELtoIbwViSTsWA0yCycjdMKLTO8lNhmtRuMcB+ioEpCGhDuPm9wuOlAfEeotwIk6ozvE0tmVzDCERSR3gE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761753895; c=relaxed/simple; bh=+qwmC43SORwO1oCatMlbgPGu9VROVZZOikEDPBsvhCw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=O1rdAD18MViWEm5N0Ikm6zUqSOSC3x4PTsf8SrTOlBxgNGLKhZ4HKwrpuM1JAL1dpursMa5SdiUHA//6o7oSP6EYXAhZC8V6bGp40Q4h0kuNsvg9/VhSftEDEqSsTB4SLP9AdCJ3kNFUL8K7I14PFV1t/Q4KBFqABO/qkI8c9nY= 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=qsXEFgPW; 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="qsXEFgPW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1761753884; bh=+qwmC43SORwO1oCatMlbgPGu9VROVZZOikEDPBsvhCw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qsXEFgPWmbzkPvG0bBu4uLyA3w4NxPVeJCKoBcWVtg9FstsXh2yM5pQYOcS5BqBgX 0K2vE951E2TI35Z5r64LxFAO+A58rW7lAl24M5AIN48m5QKEqXikvrdQGWzmoTN84u r2pMZXq0K0QfLgYL/GdRAvwsdj7iAb3bvaf00p9E= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 29 Oct 2025 17:02:58 +0100 Subject: [PATCH 08/12] tools/nolibc: gettimeofday(): avoid libgcc 64-bit divisions 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: <20251029-nolibc-uapi-types-v1-8-e79de3b215d8@weissschuh.net> References: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> In-Reply-To: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@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=1761753881; l=993; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=+qwmC43SORwO1oCatMlbgPGu9VROVZZOikEDPBsvhCw=; b=WyBDzC+kNvpJKnBOyPI57pNu8KIRUEo+2qWq1qf2mP/AdZeWc3/eL+6rLTdw1C0/eKpo7A4Ep i7m+kyfAGaNDbbQ9FW414+WyJ4dH1LXOmcFokeyeXcSSi4JJVHK9u53 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= timespec::tv_nsec is going to be 64-bit wide even on 32-bit architectures. As not all architectures support 64-bit division instructions, calls to libgcc (__divdi3()) may be emitted by the compiler which are not provided by nolibc. As tv_nsec is guaranteed to always fit into an uint32_t, perform a 32-bit division instead. Signed-off-by: Thomas Wei=C3=9Fschuh Acked-by: Willy Tarreau Reviewed-by: Arnd Bergmann --- tools/include/nolibc/sys/time.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/include/nolibc/sys/time.h b/tools/include/nolibc/sys/tim= e.h index 33782a19aae9..6dd3705c6c9d 100644 --- a/tools/include/nolibc/sys/time.h +++ b/tools/include/nolibc/sys/time.h @@ -33,7 +33,7 @@ int sys_gettimeofday(struct timeval *tv, struct timezone = *tz) ret =3D sys_clock_gettime(CLOCK_REALTIME, &tp); if (!ret && tv) { tv->tv_sec =3D tp.tv_sec; - tv->tv_usec =3D tp.tv_nsec / 1000; + tv->tv_usec =3D (uint32_t)tp.tv_nsec / 1000; } =20 return ret; --=20 2.51.1.dirty From nobody Sun Feb 8 07:48:08 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 8FB2F34DCFE; Wed, 29 Oct 2025 16:04:53 +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=1761753895; cv=none; b=lo2/w+JMtW60m53AMYPLh7f/lxgHeWk6gWT3gTZTtTgoWALIL6uNHf2IxiuxvL56rK2VxkZe8PAsJVacX4nuNADdBRpZflLN0KKHlIZL6gINpBfAYcT8ZI/sXuapg6PElWS4EErdkvQIYMfATuI3FWK1RgRut40uTrH26b7hkNc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761753895; c=relaxed/simple; bh=AbQbaLL02m4q7n1RQ5l0qlfzrr5SAXjX10+R/1QVLKw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hBPwGpC7HUFzr5UN/PZzbvbDWFjEk9/KPE2y5WkfNlpiizm5NHErz4tUYpmhkFIBPvUPafaDz9Ly9RjxhD7Wx+WSzsNWm1vjMUpJBlQ68KYOy2AWwxt9WMf5RGn5ipPx1ak4aGi+8xVe65xsXhhFSI4PYPtu2ei0VZlljQB5FCI= 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=nNs7kBlK; 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="nNs7kBlK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1761753884; bh=AbQbaLL02m4q7n1RQ5l0qlfzrr5SAXjX10+R/1QVLKw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=nNs7kBlK0zX6EsyuvY5TFW5u3KdFEMK5pLUGnzQqPnPewzNFxMNekeckLMPBZtlLE +J+1oo/7nkY9Vxjl9AchG6Go31Moy8XHGOvandvSsM5P1Ufz7OZgBkvcjmjEkjfHoi utIfRb/LJwJaGSwQSMC3MI0I9iS8TiyTUyCPkg9I= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 29 Oct 2025 17:02:59 +0100 Subject: [PATCH 09/12] tools/nolibc: use a custom struct timespec 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: <20251029-nolibc-uapi-types-v1-9-e79de3b215d8@weissschuh.net> References: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> In-Reply-To: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@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=1761753881; l=1391; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=AbQbaLL02m4q7n1RQ5l0qlfzrr5SAXjX10+R/1QVLKw=; b=HmhPLCn3lnGdNx/D/+asK+nOBGjQ9BfJjj/EI1BBRCYDniMlxOGZUf3cbhp5CL4xbAoVeRKIP fOufAYOYL2yAosmunVs6TMuTTXy0gVhcmGfzeiRH6VjJ1hqBVr5jiWj X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= A custom 'struct timespec' will be necessary for 64-bit time types on 32-bit architectures. will define other time-related types in terms of the custom definition. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/include/nolibc/arch-s390.h | 3 +++ tools/include/nolibc/types.h | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/include/nolibc/arch-s390.h b/tools/include/nolibc/arch-s= 390.h index 6237211385c0..1e87ac42ab9c 100644 --- a/tools/include/nolibc/arch-s390.h +++ b/tools/include/nolibc/arch-s390.h @@ -5,6 +5,9 @@ =20 #ifndef _NOLIBC_ARCH_S390_H #define _NOLIBC_ARCH_S390_H + +#include "types.h" + #include #include =20 diff --git a/tools/include/nolibc/types.h b/tools/include/nolibc/types.h index 16c6e9ec9451..4f5a25567e5c 100644 --- a/tools/include/nolibc/types.h +++ b/tools/include/nolibc/types.h @@ -13,9 +13,16 @@ #include "std.h" #include #include -#include #include =20 +struct timespec { + time_t tv_sec; + long tv_nsec; +}; +#define _STRUCT_TIMESPEC + +#include + =20 /* Only the generic macros and types may be defined here. The arch-specific * ones such as the O_RDONLY and related macros used by fcntl() and open() --=20 2.51.1.dirty From nobody Sun Feb 8 07:48:08 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 BE3DB33F8BE; Wed, 29 Oct 2025 16:04:52 +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=1761753896; cv=none; b=dkcRrSIv2lt6L4YTDHbTJFSBMAb/jabIdQ9QJFH/w108LqAESQaitp7852QCT+FvNua/gHqEjU/J8Aos2fjP4gu8+IxYx1jlZmmqICmKzYxBMqKLC42lUevxihhhvfj333W2QSqN8kT3ycH0IZKAYyMTe1kifuJeRYgb9Cu3oIY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761753896; c=relaxed/simple; bh=FBBimS5ndn4H9cVjHfRa0/w3nWQHf6b6qw4nWJc1plI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g++1qxvKvzMwcndfuwS8YEhQQCFX+80/wL6kzK+2WuJv9q8Woskso7V2aPgviMW4QhNxE5gb56pqZLEUFwy6PSYp640AmkhnjIl8+1W8twMEIDZTc8VXYl8kUM48+fsGkBT4+l9f6T/FmgV8D7uCsojcz9EIZENptUXOB1rENLM= 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=nENLd4ND; 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="nENLd4ND" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1761753883; bh=FBBimS5ndn4H9cVjHfRa0/w3nWQHf6b6qw4nWJc1plI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=nENLd4NDu0Y12IGEu1H4QABzckiCO9uAL5tvcNidxFIZ6dvqzLkQXS2as0UvpTyLk qVJy6GvpAVeP0JHNu22tmw/CZZPfdK82eOVVsHMUvmkLz1dpjHuFs6d243G/QOMEFW en1LmNWp2tG76J32Mnuh8np4TdH66ZlQ+vgK7zQ4= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 29 Oct 2025 17:03:00 +0100 Subject: [PATCH 10/12] tools/nolibc: always use 64-bit time types 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: <20251029-nolibc-uapi-types-v1-10-e79de3b215d8@weissschuh.net> References: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> In-Reply-To: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@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=1761753881; l=1220; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=FBBimS5ndn4H9cVjHfRa0/w3nWQHf6b6qw4nWJc1plI=; b=1YKTaEqVChLSKVXey+vB2/QdCCbCiCgHRJLQ2h7WOykDiw2cSkRLMLCttjOpskh2W3R6HozcZ DA/zNXY2tBvCKm0zzPnupRMspDU9scSBe2PPQcPrZ1BakX9aa0spvku X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 32-bit time types will stop working in 2038. Switch to 64-bit time types everywhere. Suggested-by: Arnd Bergmann Link: https://lore.kernel.org/lkml/cec27d94-c99d-4c57-9a12-275ea663dda8@app= .fastmail.com/ Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/include/nolibc/std.h | 2 +- tools/include/nolibc/types.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/include/nolibc/std.h b/tools/include/nolibc/std.h index 392f4dd94158..b9a116123902 100644 --- a/tools/include/nolibc/std.h +++ b/tools/include/nolibc/std.h @@ -29,6 +29,6 @@ typedef unsigned long nlink_t; typedef int64_t off_t; typedef signed long blksize_t; typedef signed long blkcnt_t; -typedef __kernel_time_t time_t; +typedef __kernel_time64_t time_t; =20 #endif /* _NOLIBC_STD_H */ diff --git a/tools/include/nolibc/types.h b/tools/include/nolibc/types.h index 4f5a25567e5c..3b086f68b2be 100644 --- a/tools/include/nolibc/types.h +++ b/tools/include/nolibc/types.h @@ -17,7 +17,7 @@ =20 struct timespec { time_t tv_sec; - long tv_nsec; + int64_t tv_nsec; }; #define _STRUCT_TIMESPEC =20 --=20 2.51.1.dirty From nobody Sun Feb 8 07:48:08 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 906C634E75C; Wed, 29 Oct 2025 16:04:53 +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=1761753895; cv=none; b=APfOdJLxRTlPFdn2K3OnSe0eiDrGj736rruBgwBQxQyCL6hk1ImEMnjq8+SYGX0yhnLF4hhNRrVd6e8gR3E6+J3x5YDAKntEP3NyXpHqK3RUSvbWucTHPmMfvcemwihAk6Ks/JJemIAPXd4w0YPUCF2rm3upouyOc1LW5ZXk38U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761753895; c=relaxed/simple; bh=Xskionb2PcR414Z75FW3KOvbbP0TvJOyf6vfN5M92qk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=V1UurJb9vERHNS997AYvstqSOp9IlK23235Uedfc5o39aEXJJSqvltoMC0E/fyzxogRcKba1bbsG7Iut2nRdfnanIIWwtJ0xQuYRrUIZxrC1QEdxYrerQBAy2zOfOuDQGYccQse7LwB5AJDLwBGnbJBCXchdJE+C8PZU7sud0FQ= 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=J37vsX4r; 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="J37vsX4r" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1761753885; bh=Xskionb2PcR414Z75FW3KOvbbP0TvJOyf6vfN5M92qk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=J37vsX4rqOKuAZrq20/TRcWtG4lDWu4HMLVZ+Rr9/GDzKYLfBtZyYtjUbXwbI2nCA nZeGo2Ex4jMScNJFjuNBkyz0zBuM1Gnh4i2lIDJG9og1GSLtMl6/J1NXuzhanvGEZz LQavqCEh5ZzI+0Cq2rKAAOx6JleMgUxAZ+EZEpMk= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 29 Oct 2025 17:03:01 +0100 Subject: [PATCH 11/12] selftests/nolibc: test compatibility of timespec and __kernel_timespec 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: <20251029-nolibc-uapi-types-v1-11-e79de3b215d8@weissschuh.net> References: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> In-Reply-To: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@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=1761753881; l=1502; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=Xskionb2PcR414Z75FW3KOvbbP0TvJOyf6vfN5M92qk=; b=NsKeGqgYc4wRlQV5xW6JZhzqS5fq7123BjspZOc9wGeX9svq2mUPuCioos7AQQvxznGOO20N0 X6ys+MfvClCABMCh1KfcHNxiZ1V0LthJKruIsG9w3ecSD7yOSH7fZGy X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Keeping 'struct timespec' and 'struct __kernel_timespec' compatible allows the source code to stay simple. Validate that the types stay compatible. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/s= elftests/nolibc/nolibc-test.c index f1d6d6c766dd..938af8d6e2bf 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -1428,6 +1428,23 @@ int test_difftime(void) return 0; } =20 +int test_timespec(void) +{ + struct __kernel_timespec kts; + struct timespec ts; + + if (sizeof(ts) !=3D sizeof(kts)) + return 1; + + if (!__builtin_types_compatible_p(__typeof__(ts.tv_sec), __typeof__(kts.t= v_sec))) + return 1; + + if (!__builtin_types_compatible_p(__typeof__(ts.tv_nsec), __typeof__(kts.= tv_nsec))) + return 1; + + return 0; +} + int run_stdlib(int min, int max) { int test; @@ -1551,6 +1568,7 @@ int run_stdlib(int min, int max) CASE_TEST(abs); EXPECT_EQ(1, abs(-10), 10); break; CASE_TEST(abs_noop); EXPECT_EQ(1, abs(10), 10); break; CASE_TEST(difftime); EXPECT_ZR(1, test_difftime()); break; + CASE_TEST(test_timespec); EXPECT_ZR(1, test_timespec()); break; =20 case __LINE__: return ret; /* must be last */ --=20 2.51.1.dirty From nobody Sun Feb 8 07:48:08 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 9078D34E764; Wed, 29 Oct 2025 16:04:53 +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=1761753895; cv=none; b=oKFNBp7w1Hh3S9EUGsoXp0/W1lX2vYLE+SbWR4t8d9zl3+njp3Ibh1HeUwv/v6zO6h3EI81f8d4EWlOuDFMKjwVoKlFKRQ7Iv6NXX93oyLBtcKtuCC5qDSIPLIdWl0IS6/n+p9LMjW0lEwWGP9u498wXmgHlC8dPUB/cHkGSnN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761753895; c=relaxed/simple; bh=GtkjF7rfQn7TQm0crhYcfGtMpmzfYsF+k5h5qY8e3Co=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VT7h3vhW6S8KAJDzkF4LwJS+V1CUjLhDIAublPW8UwsGLrVoqL+MJ0x1HLwoAWTIpBytZgipSdglf45xQ086yzKECgcYmi7N1SMXYdQAjxCiiaHT3swco/HB80zFY9lrCEZbJivAVJCoo6i0tk3CyS4U8IxWlvfB8grbmFtkHzo= 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=Kkxox6cT; 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="Kkxox6cT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1761753884; bh=GtkjF7rfQn7TQm0crhYcfGtMpmzfYsF+k5h5qY8e3Co=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Kkxox6cTNzSSQ6rPmaegFAJ1n4+XfftClQ8criH4o2lvH3fRBlrMR0vbTIp8TGUEr xtjWQUd2e+9jWFA622muXj6/0Ik/o9eZucKqhB0xA1xXuWIbKc9iGbp7hmAnrY6V/g UIaNl5ESVwLP35C0vtAlv0DDaGPk4J1o9sGGiMBM= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 29 Oct 2025 17:03:02 +0100 Subject: [PATCH 12/12] tools/nolibc: remove time conversions 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: <20251029-nolibc-uapi-types-v1-12-e79de3b215d8@weissschuh.net> References: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> In-Reply-To: <20251029-nolibc-uapi-types-v1-0-e79de3b215d8@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kselftest@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=1761753881; l=6395; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=GtkjF7rfQn7TQm0crhYcfGtMpmzfYsF+k5h5qY8e3Co=; b=/PCU/C/63g9wiNu+eGhqLpwQAAEYVqDHCcw8Eup7UHr6uJdQjhW5dl+K/MRv2WgqqMKSake/a 5VwvTS4Q0tBAP5bMt2nnNPCiiG2u3NOXRuCCoaMTahOLt+wD+wtR0eQ X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Now that 'struct timespec' and 'struct __kernel_timespec' are compatible, the conversions are not necessary anymore. The same holds true for 'struct itimerspec' and 'struct __kernel_itimerspec'. Remove the conversions. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Arnd Bergmann --- tools/include/nolibc/sys/timerfd.h | 20 ++---------- tools/include/nolibc/time.h | 64 ++++------------------------------= ---- 2 files changed, 8 insertions(+), 76 deletions(-) diff --git a/tools/include/nolibc/sys/timerfd.h b/tools/include/nolibc/sys/= timerfd.h index 5dd61030c991..ae3153b7635d 100644 --- a/tools/include/nolibc/sys/timerfd.h +++ b/tools/include/nolibc/sys/timerfd.h @@ -35,13 +35,7 @@ int sys_timerfd_gettime(int fd, struct itimerspec *curr_= value) #if defined(__NR_timerfd_gettime) return my_syscall2(__NR_timerfd_gettime, fd, curr_value); #else - struct __kernel_itimerspec kcurr_value; - int ret; - - ret =3D my_syscall2(__NR_timerfd_gettime64, fd, &kcurr_value); - __nolibc_timespec_kernel_to_user(&kcurr_value.it_interval, &curr_value->i= t_interval); - __nolibc_timespec_kernel_to_user(&kcurr_value.it_value, &curr_value->it_v= alue); - return ret; + return my_syscall2(__NR_timerfd_gettime64, fd, curr_value); #endif } =20 @@ -59,17 +53,7 @@ int sys_timerfd_settime(int fd, int flags, #if defined(__NR_timerfd_settime) return my_syscall4(__NR_timerfd_settime, fd, flags, new_value, old_value); #else - struct __kernel_itimerspec knew_value, kold_value; - int ret; - - __nolibc_timespec_user_to_kernel(&new_value->it_value, &knew_value.it_val= ue); - __nolibc_timespec_user_to_kernel(&new_value->it_interval, &knew_value.it_= interval); - ret =3D my_syscall4(__NR_timerfd_settime64, fd, flags, &knew_value, &kold= _value); - if (old_value) { - __nolibc_timespec_kernel_to_user(&kold_value.it_interval, &old_value->it= _interval); - __nolibc_timespec_kernel_to_user(&kold_value.it_value, &old_value->it_va= lue); - } - return ret; + return my_syscall4(__NR_timerfd_settime64, fd, flags, new_value, old_valu= e); #endif } =20 diff --git a/tools/include/nolibc/time.h b/tools/include/nolibc/time.h index 45df9b09d7b6..ab67f209c99f 100644 --- a/tools/include/nolibc/time.h +++ b/tools/include/nolibc/time.h @@ -18,20 +18,6 @@ #include #include =20 -static __inline__ -void __nolibc_timespec_user_to_kernel(const struct timespec *ts, struct __= kernel_timespec *kts) -{ - kts->tv_sec =3D ts->tv_sec; - kts->tv_nsec =3D ts->tv_nsec; -} - -static __inline__ -void __nolibc_timespec_kernel_to_user(const struct __kernel_timespec *kts,= struct timespec *ts) -{ - ts->tv_sec =3D kts->tv_sec; - ts->tv_nsec =3D kts->tv_nsec; -} - /* * int clock_getres(clockid_t clockid, struct timespec *res); * int clock_gettime(clockid_t clockid, struct timespec *tp); @@ -44,13 +30,7 @@ static __attribute__((unused)) int sys_clock_getres(clockid_t clockid, struct timespec *res) { #if defined(__NR_clock_getres_time64) - struct __kernel_timespec kres; - int ret; - - ret =3D my_syscall2(__NR_clock_getres_time64, clockid, &kres); - if (res) - __nolibc_timespec_kernel_to_user(&kres, res); - return ret; + return my_syscall2(__NR_clock_getres_time64, clockid, res); #else return my_syscall2(__NR_clock_getres, clockid, res); #endif @@ -66,13 +46,7 @@ static __attribute__((unused)) int sys_clock_gettime(clockid_t clockid, struct timespec *tp) { #if defined(__NR_clock_gettime64) - struct __kernel_timespec ktp; - int ret; - - ret =3D my_syscall2(__NR_clock_gettime64, clockid, &ktp); - if (tp) - __nolibc_timespec_kernel_to_user(&ktp, tp); - return ret; + return my_syscall2(__NR_clock_gettime64, clockid, tp); #else return my_syscall2(__NR_clock_gettime, clockid, tp); #endif @@ -88,10 +62,7 @@ static __attribute__((unused)) int sys_clock_settime(clockid_t clockid, struct timespec *tp) { #if defined(__NR_clock_settime64) - struct __kernel_timespec ktp; - - __nolibc_timespec_user_to_kernel(tp, &ktp); - return my_syscall2(__NR_clock_settime64, clockid, &ktp); + return my_syscall2(__NR_clock_settime64, clockid, tp); #else return my_syscall2(__NR_clock_settime, clockid, tp); #endif @@ -108,14 +79,7 @@ int sys_clock_nanosleep(clockid_t clockid, int flags, c= onst struct timespec *rqt struct timespec *rmtp) { #if defined(__NR_clock_nanosleep_time64) - struct __kernel_timespec krqtp, krmtp; - int ret; - - __nolibc_timespec_user_to_kernel(rqtp, &krqtp); - ret =3D my_syscall4(__NR_clock_nanosleep_time64, clockid, flags, &krqtp, = &krmtp); - if (rmtp) - __nolibc_timespec_kernel_to_user(&krmtp, rmtp); - return ret; + return my_syscall4(__NR_clock_nanosleep_time64, clockid, flags, rqtp, rmt= p); #else return my_syscall4(__NR_clock_nanosleep, clockid, flags, rqtp, rmtp); #endif @@ -190,13 +154,7 @@ static __attribute__((unused)) int sys_timer_gettime(timer_t timerid, struct itimerspec *curr_value) { #if defined(__NR_timer_gettime64) - struct __kernel_itimerspec kcurr_value; - int ret; - - ret =3D my_syscall2(__NR_timer_gettime64, timerid, &kcurr_value); - __nolibc_timespec_kernel_to_user(&kcurr_value.it_interval, &curr_value->i= t_interval); - __nolibc_timespec_kernel_to_user(&kcurr_value.it_value, &curr_value->it_v= alue); - return ret; + return my_syscall2(__NR_timer_gettime64, timerid, curr_value); #else return my_syscall2(__NR_timer_gettime, timerid, curr_value); #endif @@ -213,17 +171,7 @@ int sys_timer_settime(timer_t timerid, int flags, const struct itimerspec *new_value, struct itimerspec *old_value) { #if defined(__NR_timer_settime64) - struct __kernel_itimerspec knew_value, kold_value; - int ret; - - __nolibc_timespec_user_to_kernel(&new_value->it_value, &knew_value.it_val= ue); - __nolibc_timespec_user_to_kernel(&new_value->it_interval, &knew_value.it_= interval); - ret =3D my_syscall4(__NR_timer_settime64, timerid, flags, &knew_value, &k= old_value); - if (old_value) { - __nolibc_timespec_kernel_to_user(&kold_value.it_interval, &old_value->it= _interval); - __nolibc_timespec_kernel_to_user(&kold_value.it_value, &old_value->it_va= lue); - } - return ret; + return my_syscall4(__NR_timer_settime64, timerid, flags, new_value, old_v= alue); #else return my_syscall4(__NR_timer_settime, timerid, flags, new_value, old_val= ue); #endif --=20 2.51.1.dirty