public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aurelien at aurel32 dot net" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/29730] New: broken y2038 support in fstatat on MIPS N64
Date: Fri, 28 Oct 2022 19:39:45 +0000	[thread overview]
Message-ID: <bug-29730-131@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=29730

            Bug ID: 29730
           Summary: broken y2038 support in fstatat on MIPS N64
           Product: glibc
           Version: 2.35
            Status: NEW
          Severity: normal
          Priority: P1
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: aurelien at aurel32 dot net
                CC: adhemerval.zanella at linaro dot org, drepper.fsp at gmail dot com
  Target Milestone: ---
              Host: mips64el-unknown-linux-gnuabi64
            Target: mips64el-unknown-linux-gnuabi64
             Build: mips64el-unknown-linux-gnuabi64

On MIPS N64 the fstat/fstatat/lstat functions return EOVERFLOW when they are
called on files with a mtime, atime or ctime that can't be represented within a 
32-bit time_t. This should not happen as time_t is 64-bit on mips64el. This can
be reproduce for instance with:

$ touch -d 20390101 t
$ chmod +x t
chmod: cannot access 't': Value too large for defined data type
$ 

This issue has been introduced in glibc 2.35 by the following commit:

commit 6e8a0aac2f883a23efb1683b120499138f9e6021
Author: Stafford Horne <shorne@gmail.com>
Date:   Mon Jun 7 22:10:19 2021 +0900

    time: Fix overflow itimer tests on 32-bit systems

    On the port of OpenRISC I am working on and it appears the rv32 port
    we have sets __TIMESIZE == 64 && __WORDSIZE == 32.  This causes the
    size of time_t to be 8 bytes, but the tv_sec in the kernel is still 32-bit
    causing truncation.

    The truncations are unavoidable on these systems so skip the
    testing/failures by guarding with __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64.

    Also, futher in the tests and in other parts of code checking for time_t
    overflow does not work on 32-bit systems when time_t is 64-bit.  As
    suggested by Adhemerval, update the in_time_t_range function to assume
    32-bits by using int32_t.

    This also brings in the header for stdint.h so we can update other
    usages of __int32_t to int32_t as suggested by Adhemerval.

    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

MIPS N64 uses a 64-bit time_t, however it does not define XSTAT_IS_XSTAT64.
Therefore fstatat is different than fstatat64, and uses the default
sysdeps/unix/sysv/linux/fstatat.c implementation, which uses in_time_t_range()
with a 64-bit time_t.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2022-10-28 19:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 19:39 aurelien at aurel32 dot net [this message]
2022-10-29 16:56 ` [Bug libc/29730] " syq at debian dot org
2022-10-29 17:16 ` syq at debian dot org
2022-10-29 17:28 ` syq at debian dot org
2022-10-29 19:26 ` aurelien at aurel32 dot net
2022-10-29 19:45 ` syq at debian dot org
2022-10-30  4:14 ` syq at debian dot org
2022-10-30 14:30 ` adhemerval.zanella at linaro dot org
2022-10-30 16:55 ` syq at debian dot org
2022-10-30 18:07 ` aurelien at aurel32 dot net
2022-10-30 18:24 ` adhemerval.zanella at linaro dot org
2022-10-31  0:53 ` syq at debian dot org
2022-10-31  2:48 ` syq at debian dot org
2022-10-31  4:01 ` syq at debian dot org
2022-10-31  5:11 ` syq at debian dot org
2022-10-31 13:17 ` adhemerval.zanella at linaro dot org
2022-10-31 13:54 ` adhemerval.zanella at linaro dot org
2022-10-31 16:07 ` adhemerval.zanella at linaro dot org
2022-10-31 17:01 ` syq at debian dot org
2022-10-31 17:14 ` syq at debian dot org
2022-10-31 17:28 ` adhemerval.zanella at linaro dot org
2022-10-31 17:29 ` adhemerval.zanella at linaro dot org
2022-11-01 12:11 ` aurelien at aurel32 dot net
2022-11-01 12:11 ` aurelien at aurel32 dot net
2022-11-02 15:37 ` aurelien at aurel32 dot net
2022-11-02 15:39 ` cvs-commit at gcc dot gnu.org
2022-11-02 16:35 ` cvs-commit at gcc dot gnu.org
2022-11-02 18:12 ` cvs-commit at gcc dot gnu.org
2022-11-04  1:56 ` syq at debian dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29730-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).