[PATCH 0/2] linux: Keep time64 stat layout independent of feature macros

Matthias Goergens <[email protected]> Wed, 5 Aug 2026 16:03:02 +0800
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
Bug 32119 reports that feature-test macros change the public time64
struct stat layout on 32-bit targets. The series separates two causes.

Patch 1 includes the endian definitions used by the shared helper. Without
them, strict pre-POSIX.1-2008 modes select big-endian timestamp ordering on
little-endian targets. This is an unambiguous layout bug.

Patch 2 removes two trailing reserved words which the helper exposes only in
those strict modes. History shows that they were imported accidentally when
the public and internal time64 declarations were consolidated. The stat
implementation does not write them, and the default public and internal
layouts omit them.

Patch 2 nevertheless changes sizeof(struct stat) for 32-bit objects already
compiled with both 64-bit time and strict pre-POSIX.1-2008 feature macros.
Please advise whether preserving that niche accidental layout is required by
glibc ABI policy. Patch 1 is independent if the size correction is unsuitable.

An i386 build and the io tests pass. The regression compares timestamp
offsets and sizes across translation units built in default and POSIX.1-2001
modes. Compile-time layout models also pass for 32-bit Arm, PowerPC, and MIPS;
these models are supplementary and are not full cross builds.

I do not have an FSF copyright assignment on file. This series is offered
under the Developer Certificate of Origin 1.1, as certified by the
Signed-off-by line in each commit.

Matthias Goergens (2):
  linux: Fix time64 stat nanosecond layout in strict modes
  linux: Keep time64 stat size independent of feature macros [BZ #32119]

 io/Makefile                                   | 15 +++++++
 io/tst-stat-layout-time64-legacy.c            | 41 +++++++++++++++++++
 io/tst-stat-layout-time64.c                   | 38 +++++++++++++++++
 .../linux/bits/struct_stat_time64_helper.h    |  5 +--
 4 files changed, 96 insertions(+), 3 deletions(-)
 create mode 100644 io/tst-stat-layout-time64-legacy.c
 create mode 100644 io/tst-stat-layout-time64.c

-- 
2.55.0