libc6: broken utmp handling in 32-bit programs with 64-bit time_t
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
glibc (Debian) |
Fix Released
|
Unknown
|
||||
glibc (Ubuntu) | Status tracked in Oracular | |||||
Noble |
New
|
Medium
|
Simon Chopin | |||
Oracular |
New
|
Undecided
|
Simon Chopin |
Bug Description
Imported from Debian bug http://
Package: libc6
Version: 2.37-6
Tags: upstream
The utmp(5) interface has broken its compatibility in 32-bit programs
built with -D_TIME_BITS=64. In bits/utmpx.h we see this:
,----
| /* The fields ut_session and ut_tv must be the same size when compiled
| 32- and 64-bit. This allows files and shared memory to be shared
| between 32- and 64-bit applications. */
| #if __WORDSIZE_
| __int32_t ut_session; /* Session ID, used for windowing. */
| struct
| {
| __int32_t tv_sec; /* Seconds. */
| __int32_t tv_usec; /* Microseconds. */
| } ut_tv; /* Time entry was made. */
| #else
| long int ut_session; /* Session ID, used for windowing. */
| struct timeval ut_tv; /* Time entry was made. */
| #endif
`----
The definition of __WORDSIZE_
,----
| #ifdef __x86_64__
| # define __WORDSIZE_
| /* Both x86-64 and x32 use the 64-bit system call interface. */
| # define __SYSCALL_WORDSIZE 64
| #else
| # define __WORDSIZE_
| #endif
`----
So on i386 (and I suppose on other 32-bit architectures except x32)
ut_tv is of struct timeval, and ut_tv.tv_sec is of time_t, which is
actually a 64-bit integer in programs built with -D_TIME_BITS=64.
One example where this already has caused problems is the who(1) program
which has opted in for -D_TIME_BITS=64, see #1027135. Once programs
start to _write_ utmp entries with a 64-bit ut_tv.tv_sec rather than
merely reading them, things could become more interesting. :-(
-- System Information:
Debian Release: trixie/sid
APT prefers unstable
APT policy: (500, 'unstable'), (101, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Changed in glibc (Ubuntu Noble): | |
importance: | Undecided → Medium |
Changed in glibc (Debian): | |
importance: | Undecided → Unknown |
status: | New → Fix Released |
tags: |
added: foundations-todo removed: rls-nn-incoming |
Changed in glibc (Ubuntu Noble): | |
assignee: | nobody → Simon Chopin (schopin) |
Changed in glibc (Ubuntu Oracular): | |
assignee: | nobody → Simon Chopin (schopin) |
Marking this as Normal (or maybe Low?) severity on Noble since it's only relevant for armhf users that upgrade from a previous system *and* still use utmp/wtmp. We have drop utmp support in pam in Noble, leaving us with last(1) /lastb( 1)/lastlog( 1)/faillog( 1) as the main consumers of those files in the archive (w(1) now queries logind by default).
The plan will be to move the "corrupted" files generated by the Noble versions out in utmp.old files in the libc6 postinst and just start from fresh.