From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B5A013858D1E; Fri, 11 Feb 2022 11:55:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B5A013858D1E From: "adhemerval.zanella at linaro dot org" To: glibc-bugs@sourceware.org Subject: [Bug libc/28880] Program crashes if date beyone 2038 Date: Fri, 11 Feb 2022 11:55:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.34 X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: adhemerval.zanella at linaro dot org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: adhemerval.zanella at linaro dot org X-Bugzilla-Target-Milestone: 2.36 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: target_milestone assigned_to everconfirmed bug_status cf_reconfirmed_on cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Feb 2022 11:55:11 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28880 Adhemerval Zanella changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |2.36 Assignee|unassigned at sourceware dot org |adhemerval.zanella = at linaro dot o | |rg Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2022-02-11 CC| |adhemerval.zanella at lina= ro dot o | |rg --- Comment #1 from Adhemerval Zanella --- (In reply to Vignesh from comment #0) > Hi, >=20 > I am trying to set a date (beyond 2038) and use the following example > program. >=20 > https://stackoverflow.com/questions/70491311/after-update-glibc-to-versio= n-2- > 34-sem-open-failed-sem-open-fail-read-only > If I set the date below 2038 the program executes well, and if I set 2039= it > throws the below error >=20 > WORKS: > root@(none):/home$ date -s "5 MAR 2037 18:00:00" =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 >=20 > Thu Mar =C2=A05 18:00:00 =C2=A02037 > root@(none):/home$ ./sem abc >=20 > FAILS: > root@(none):/home$ date > Sat Mar =C2=A05 18:00:12 =C2=A02039 > root@(none):/home$ ./sem foo > sem_open fail: Value too large for defined data type >=20 > All the userspace applications and the example program were compiled with > these tokens > -D_TIME_BITS=3D64 -D_FILE_OFFSET_BITS=3D64 It is a missing spot from my fix 52a5fe70a2c to use 64 bit stat internally,= the following makes the programs pass: diff --git a/sysdeps/pthread/sem_routines.c b/sysdeps/pthread/sem_routines.c index 9e1924398d..877e1e8556 100644 --- a/sysdeps/pthread/sem_routines.c +++ b/sysdeps/pthread/sem_routines.c @@ -25,7 +25,7 @@ struct inuse_sem { dev_t dev; - ino_t ino; + ino64_t ino; int refcnt; sem_t *sem; char name[]; @@ -34,7 +34,7 @@ struct inuse_sem struct search_sem { dev_t dev; - ino_t ino; + ino64_t ino; int refcnt; sem_t *sem; char name[NAME_MAX + 1]; @@ -77,8 +77,8 @@ __sem_check_add_mapping (const char *name, int fd, sem_t *existing) sem_t *result =3D SEM_FAILED; /* Get the information about the file. */ - struct stat64 st; - if (__fstat64 (fd, &st) =3D=3D 0) + struct __stat64_t64 st; + if (__fstat64_time64 (fd, &st) =3D=3D 0) { /* Get the lock. */ lll_lock (sem_mappings_lock, LLL_PRIVATE); >=20 > But the glibc 2.34 wasn't compiled with those. >=20 > My understanding is that glibc also sholud be compiled with -D_TIME_BITS= =3D64 > -D_FILE_OFFSET_BITS=3D64 No, these flags should be used only the programs to select the time_t and L= FS support. glibc from 2.34 always provide both 32-bit and 64-bit time_t ABI, there is no need to enable it either through configure or extra cflags. --=20 You are receiving this mail because: You are on the CC list for the bug.=