This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v10] y2038: Provide conversion helpers for struct __timespec64


On Wed, Dec 4, 2019 at 11:19 AM Dmitry V. Levin <ldv@altlinux.org> wrote:
> On Mon, Sep 30, 2019 at 03:31:34PM +0200, Lukasz Majewski wrote:
>
> Unfortunately, this didn't work out as intended because Linux kernel prior
> to commit 7b8474466ed97be458c825f34a85f2c2b84c3f95 (including released
> version v5.4) did not zero the upper 32-bits of tv_nsec on 32-bit
> architectures, which means that we have to do it in
> valid_timeval_to_timespec64 and valid_timespec_to_timespec64 instead.

Are you sure that patch actually makes a difference? On compat mode
in 64-bit architectures, the mask was still applied, and on native
32-bit modes, we get into a signed integer overflow when assigning the
tv_nsec from a 64-bit member in __kernel_timespec to a 32-bit member
in timespec64, but as the kernel is built with -fno-strict-overflow that
should still produce the correct result (truncating to 32 bit).

The patch is still useful for clarity but I fear I misread it originally
and thought it made a difference when in practice it does not actually
change the behavior, so the patch description ended overstating
the impact.

       Arnd


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]