From nobody Tue Oct 7 08:35:49 2025 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 8CEAE2222A1; Sat, 12 Jul 2025 09:01:08 +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=1752310871; cv=none; b=rwjjCggGKz5lbfl0D2vlxf2rgCHY8fSekFHDaSSS75KcI87kPvylAUxKhrnlYgYsUutiTlIVOepj/dilIbA+E75waV0cBACzYVd4JwZLFc3uPzOFqz0DEEjTdUqadLrRMZV0/zNrTnAGKXNKs1Yyi9SHLBXbCnvHdaKzAapHcXs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752310871; c=relaxed/simple; bh=I0Za4MEKM7buIuLwCwH7lBjcRz9CuM5dT8TU7XLat0I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=De4dts15bRTZR6gkSbpOs4g7ar9JvFx90jdnTxx1Ry9Eye+6lgeLxtt+83BPGhyTK2+3Hadj1PzRSeY/4c69OfBdfGaMeown+909rTMDM6IdFkIoltRlGHy43twhxA8PeeoFebu38m6eTdp+oG8zAMVxOTGozoONTaxwDvKlpgA= 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=tqGnIweP; 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="tqGnIweP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1752310860; bh=I0Za4MEKM7buIuLwCwH7lBjcRz9CuM5dT8TU7XLat0I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tqGnIwePXLbsa0mw3yWZR7Xaepn2mEEzHVK1daQ41ehH9tsVhteHORrrxQrUD2HDX Xr0TrGkR9tvoLyMn7fT0mvbHNFhanfmnfZJCQQH7AQgHM2XdYwrdi+2wFOgFRVieiL 6eJMPyM70M2O/4fYC/sFRqyZZf8rkHtw8eGL+cvY= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sat, 12 Jul 2025 11:00:55 +0200 Subject: [PATCH 1/2] tools/nolibc: define time_t in terms of __kernel_old_time_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: <20250712-nolibc-x32-v1-1-6d81cb798710@weissschuh.net> References: <20250712-nolibc-x32-v1-0-6d81cb798710@weissschuh.net> In-Reply-To: <20250712-nolibc-x32-v1-0-6d81cb798710@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1752310859; l=1408; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=I0Za4MEKM7buIuLwCwH7lBjcRz9CuM5dT8TU7XLat0I=; b=UZN9QsKRiZ8w3QI2KQzkkXzaU+kAUvayrhE5jq+vw5OP8yYGgnpmuoQiF89gi0tzUK0bfqNhL oUmsGDrKwijAnzE87BhhDdqzikLGYMFSozz5AcTH/WDdbqbQ3Q1fYjM X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Nolibc assumes that the kernel ABI is using a time values that are as large as a long integer. For most ABIs this holds true. But for x32 this is not correct, as it uses 32bit longs but 64bit times. Also the 'struct stat' implementation of nolibc relies on timespec::tv_sec and time_t being the same type. While timespec::tv_sec comes from the kernel and is of type __kernel_old_time_t, time_t is defined within nolibc. Switch to the __kernel_old_time_t to always get the correct type. Signed-off-by: Thomas Wei=C3=9Fschuh Acked-by: Willy Tarreau --- tools/include/nolibc/std.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/include/nolibc/std.h b/tools/include/nolibc/std.h index adda7333d12e7d2c336938ede1aaf215b4b93165..ba950f0e7338438823b4ee8c68a= 067391c719823 100644 --- a/tools/include/nolibc/std.h +++ b/tools/include/nolibc/std.h @@ -16,6 +16,8 @@ #include "stdint.h" #include "stddef.h" =20 +#include + /* those are commonly provided by sys/types.h */ typedef unsigned int dev_t; typedef unsigned long ino_t; @@ -27,6 +29,6 @@ typedef unsigned long nlink_t; typedef signed long off_t; typedef signed long blksize_t; typedef signed long blkcnt_t; -typedef signed long time_t; +typedef __kernel_old_time_t time_t; =20 #endif /* _NOLIBC_STD_H */ --=20 2.50.1