[PATCH] Rename STAT_HAS_TIME32 to KERNEL_STAT64_HAS_TIME32

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Mon Nov 7 18:45:40 GMT 2022



On 07/11/22 15:24, Arnd Bergmann wrote:
> On Mon, Nov 7, 2022, at 19:08, Adhemerval Zanella Netto wrote:
>> On 04/11/22 07:02, Arnd Bergmann wrote:
> 
>> In fact it was reported as an y2106 problem some time ago [1] and we
>> fixed on 2.34 [2].  And I give that STAT_HAS_TIME32 is not entirely
>> clear, since for glibc perspective is has multiple stat definitions.
> 
> I think we need to coordinate this when we change the kernel to
> add truncation of the 64-bit time values. It sounds like glibc
> does an 'unsigned int' to 'long long' conversion for the legacy
> stat syscall, rather than a conversion from a signed value, and
> it would be helpful to have a matching interpretation between
> kernel and glibc.
> 
> What is the glibc behavior for i386 with 64-bit time_t on a
> kernel without statx? Does that also intepret a time value
> of -1u as a 2106 timestamp, or does it convert that into a
> 1969 timestamp like the other (not mips/pa-risc) 64-bit
> architectures do?
> 
>       Arnd

The time_t for glibc is always signed and for legacy 32-bit ABIs
it issues fstatat64 and assumes that kernel will handle potential
overflow by returning a proper error (if syscall succeeds then the
file times are within the signed 32 bit time_t range).

My understanding is mips is the only outlier here with unsigned 
kernel stat times, which on glibc is handled with a special function
that just that interprets the values as 2106 timestamp 
(__cp_kstat_stat64_t64).


More information about the Libc-alpha mailing list