lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250918010833.2760723-1-zhouzhouyi@gmail.com>
Date: Thu, 18 Sep 2025 01:08:33 +0000
From: Zhouyi Zhou <zhouzhouyi@...il.com>
To: w@....eu,
	linux@...ssschuh.net,
	rcu@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	lance@...osl.org
Cc: Zhouyi Zhou <zhouzhouyi@...il.com>
Subject: [PATCH] tools/nolibc: make time_t robust if __kernel_old_time_t is missing in host headers

Commit 
d5094bcb5bfd ("tools/nolibc: define time_t in terms of __kernel_old_time_t")
made nolibc use the kernel's time type so that `time_t` matches
`timespec::tv_sec` on all ABIs (notably x32).    

Some distributions (e.g. Ubuntu 20.04 on ppc64le with older
exported headers under /usr/include) do not expose
`__kernel_old_time_t`, causing nolibc builds that rely on host
headers to fail (I discovered this when doing RCU torture test in
PPC VM of Open Source Lab of Oregon State University).
        
Keep the new behavior, but add a small compatibility shim:
if `__kernel_old_time_t` is not available, fall back to
 `signed long`

This preserves the intent of d5094bcb5bfd while letting nolibc
build on systems with older exported headers.

Fixes: d5094bcb5bfd ("tools/nolibc: define time_t in terms of __kernel_old_time_t")
Signed-off-by: Zhouyi Zhou <zhouzhouyi@...il.com>    
---
 tools/include/nolibc/std.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/include/nolibc/std.h b/tools/include/nolibc/std.h
index ba950f0e7338..ea225a0b16e9 100644
--- a/tools/include/nolibc/std.h
+++ b/tools/include/nolibc/std.h
@@ -29,6 +29,10 @@ typedef unsigned long       nlink_t;
 typedef   signed long         off_t;
 typedef   signed long     blksize_t;
 typedef   signed long      blkcnt_t;
+#ifndef __kernel_old_time_t
+typedef   signed long        time_t;
+#else
 typedef __kernel_old_time_t  time_t;
+#endif
 
 #endif /* _NOLIBC_STD_H */
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ