[v2] login: Use unsigned 32-bit types for seconds-since-epoch
Checks
Context |
Check |
Description |
redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
redhat-pt-bot/TryBot-32bit |
success
|
Build for i686
|
linaro-tcwg-bot/tcwg_glibc_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-arm |
success
|
Testing passed
|
Commit Message
These fields store timestamps when the system was running. No Linux
systems existed before 1970, so these values are unused. Switching
to unsigned types allows continued use of the existing struct layouts
beyond the year 2038.
This change is relevant to some 64-bit architectures which opted
to use 32-bit timestamps, for compatibility with co-installed
32-bit binaries (__WORDSIZE_TIME64_COMPAT32). For consistency,
if there is a 64-bit architecture that is coinstallable, define
__WORDSIZE_TIME64_COMPAT32 to 1 on the 32-bit architecture as well.
The intent is to give distributions more time to switch to improved
interfaces that also avoid locking/data corruption issues.
---
v2: Second NEWS entry added. Now built with build-many-glibcs.py.
NEWS | 19 ++++++++++++++++++-
bits/utmp.h | 4 ++--
sysdeps/gnu/bits/utmpx.h | 2 +-
sysdeps/mips/bits/wordsize.h | 6 +-----
sysdeps/powerpc/powerpc32/bits/wordsize.h | 3 +--
sysdeps/sparc/sparc32/bits/wordsize.h | 2 +-
sysdeps/sparc/sparc64/bits/wordsize.h | 3 +--
sysdeps/unix/sysv/linux/sparc/bits/wordsize.h | 3 +--
sysdeps/x86/bits/wordsize.h | 5 ++---
9 files changed, 28 insertions(+), 19 deletions(-)
base-commit: 1f94147a79fcb7211f1421b87383cad93986797f
Comments
On Apr 08 2024, Florian Weimer wrote:
> +* The functions enduten, endutxent, getutent, getutent_r, getutid,
endutent
* Andreas Schwab:
> On Apr 08 2024, Florian Weimer wrote:
>
>> +* The functions enduten, endutxent, getutent, getutent_r, getutid,
> endutent
Thanks, fixed locally.
Florian
@@ -28,7 +28,24 @@ Major new features:
Deprecated and removed features, and other changes affecting compatibility:
- [Add deprecations, removals and changes affecting compatibility here]
+* Architectures which use a 32-bit seconds-since-epoch field in struct
+ lastlog, struct utmp, struct utmpx (such as i386, powerpc64le, rv32,
+ rv64, x86-64) switched from a signed to an unsigned type for that
+ field. This allows these fields to store timestamps beyond the
+ year 2038.
+
+* The functions enduten, endutxent, getutent, getutent_r, getutid,
+ getutid_r, getutline, getutline_r, getutmp, getutmpx, getutxent,
+ getutxid, getutxline, login, logout, logwtmp, pututline, pututxline,
+ setutent, setutxent, updwtmp, updwtmpx, utmpname, utmpxname, the types
+ struct lastlog, struct utmp, struct utmpx, and the macros UTMP_FILE,
+ UTMP_FILENAME, WTMP_FILE, WTMP_FILENAME, UTMPX_FILE, UTMPX_FILENAME,
+ WTMPX_FILE, WTMPX_FILENAME are deprecated. A future version of the
+ library will replace the functions with no-operation stubs. These
+ interfaces have been designed for systems with a fixed set of terminal
+ lines; they do not reflect dynamic allocation of terminals. (This
+ deprecates all interfaces in <utmp.h> and <utmpx.h>, with the
+ exception of the login_tty function.)
Changes to build and runtime requirements:
@@ -36,7 +36,7 @@
struct lastlog
{
#if __WORDSIZE_TIME64_COMPAT32
- int32_t ll_time;
+ __uint32_t ll_time;
#else
__time_t ll_time;
#endif
@@ -76,7 +76,7 @@ struct utmp
int32_t ut_session; /* Session ID, used for windowing. */
struct
{
- int32_t tv_sec; /* Seconds. */
+ __uint32_t tv_sec; /* Seconds. */
int32_t tv_usec; /* Microseconds. */
} ut_tv; /* Time entry was made. */
#else
@@ -74,7 +74,7 @@ struct utmpx
__int32_t ut_session; /* Session ID, used for windowing. */
struct
{
- __int32_t tv_sec; /* Seconds. */
+ __uint32_t tv_sec; /* Seconds. */
__int32_t tv_usec; /* Microseconds. */
} ut_tv; /* Time entry was made. */
#else
@@ -19,11 +19,7 @@
#define __WORDSIZE _MIPS_SZPTR
-#if _MIPS_SIM == _ABI64
-# define __WORDSIZE_TIME64_COMPAT32 1
-#else
-# define __WORDSIZE_TIME64_COMPAT32 0
-#endif
+#define __WORDSIZE_TIME64_COMPAT32 1
#if __WORDSIZE == 32
#define __WORDSIZE32_SIZE_ULONG 0
@@ -2,10 +2,9 @@
#if defined __powerpc64__
# define __WORDSIZE 64
-# define __WORDSIZE_TIME64_COMPAT32 1
#else
# define __WORDSIZE 32
-# define __WORDSIZE_TIME64_COMPAT32 0
# define __WORDSIZE32_SIZE_ULONG 0
# define __WORDSIZE32_PTRDIFF_LONG 0
#endif
+#define __WORDSIZE_TIME64_COMPAT32 1
@@ -1,6 +1,6 @@
/* Determine the wordsize from the preprocessor defines. */
#define __WORDSIZE 32
-#define __WORDSIZE_TIME64_COMPAT32 0
+#define __WORDSIZE_TIME64_COMPAT32 1
#define __WORDSIZE32_SIZE_ULONG 0
#define __WORDSIZE32_PTRDIFF_LONG 0
@@ -2,10 +2,9 @@
#if defined __arch64__ || defined __sparcv9
# define __WORDSIZE 64
-# define __WORDSIZE_TIME64_COMPAT32 1
#else
# define __WORDSIZE 32
-# define __WORDSIZE_TIME64_COMPAT32 0
# define __WORDSIZE32_SIZE_ULONG 0
# define __WORDSIZE32_PTRDIFF_LONG 0
#endif
+#define __WORDSIZE_TIME64_COMPAT32 1
@@ -2,10 +2,9 @@
#if defined __arch64__ || defined __sparcv9
# define __WORDSIZE 64
-# define __WORDSIZE_TIME64_COMPAT32 1
#else
# define __WORDSIZE 32
# define __WORDSIZE32_SIZE_ULONG 0
# define __WORDSIZE32_PTRDIFF_LONG 0
-# define __WORDSIZE_TIME64_COMPAT32 0
#endif
+#define __WORDSIZE_TIME64_COMPAT32 1
@@ -8,10 +8,9 @@
#define __WORDSIZE32_PTRDIFF_LONG 0
#endif
+#define __WORDSIZE_TIME64_COMPAT32 1
+
#ifdef __x86_64__
-# define __WORDSIZE_TIME64_COMPAT32 1
/* Both x86-64 and x32 use the 64-bit system call interface. */
# define __SYSCALL_WORDSIZE 64
-#else
-# define __WORDSIZE_TIME64_COMPAT32 0
#endif