From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 0FA793858C5E for ; Thu, 2 Mar 2023 09:04:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0FA793858C5E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677747855; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=M2c5iYDpQnN8J34W6UQSQiLV7Skc2/qaw0T5ZVZKVaA=; b=gZN2zFq7NvrjhhNkgZ/OjjFT8uerHjYIN6UALHPcmqXy0wQuHLEKViv9z5GbiSvsQ7fCx+ IgY3tx9Itw1olew5OV3k0lakoyR/IxxDvwpaorzeppPZrR72ZkpeZpZ4QWx4rFwlDm+UIV nKB45XqeXq+age1jpzqrMvkRsF7NOTc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-628-hPwrxkzSNcSrTk_bdC5S7Q-1; Thu, 02 Mar 2023 04:04:12 -0500 X-MC-Unique: hPwrxkzSNcSrTk_bdC5S7Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0B27B85C710; Thu, 2 Mar 2023 09:04:12 +0000 (UTC) Received: from redhat.com (unknown [10.33.36.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E8F07C16027; Thu, 2 Mar 2023 09:04:09 +0000 (UTC) Date: Thu, 2 Mar 2023 09:04:07 +0000 From: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= To: Demi Marie Obenour Cc: Eric Blake , Sam James , Carlos O'Donell via Libc-alpha , autoconf@gnu.org, c-std-porting@lists.linux.dev, Zack Weinberg , David Seifert , Gentoo Toolchain , Arsen =?utf-8?Q?Arsenovi=C4=87?= , Paul Eggert , rjones@redhat.com Subject: Re: On time64 and Large File Support Message-ID: Reply-To: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= References: <20230301223859.chl5o3bedqckf3tx@redhat.com> <086d6fcd-3738-cc7f-db72-6a8d19d33e30@gmail.com> MIME-Version: 1.0 In-Reply-To: <086d6fcd-3738-cc7f-db72-6a8d19d33e30@gmail.com> User-Agent: Mutt/2.2.9 (2022-11-12) X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Mar 01, 2023 at 07:29:01PM -0500, Demi Marie Obenour wrote: > On 3/1/23 17:38, Eric Blake wrote: > > [replying to the original post, because I'm not sure where else in the > > more recent activity on this thread would be more appropriate] > > > > On Fri, Nov 11, 2022 at 08:38:18AM +0000, Sam James wrote: > >> Hi all, > >> > >> In Gentoo, we've been planning out what we should do for time64 on glibc [0] > >> and concluded that we need some support in glibc for a newer option. I'll outline > >> why below. > >> > > ... > >> > >> Indeed, the gnulib version of change #2 is exactly how we ended up with > >> wget/gnutls breaking [1]. I feel this shows that the only approach > >> "supported" by glibc right now is untenable. > > > >> [1] https://bugs.gentoo.org/828001 > > > > Now Fedora is also being hit by the gnutls ABI change due to time_t in > > public interfaces being silently changed. From an IRC conversation I > > had with Dan Berrange and Rich Jones (I think Rich mean i686 below): > > > > rjones (IRC): oh wow, the certificates created on i696 are not quite right ..... > > Validity: > > Not Before: Sat Sep 05 00:23:57 UTC 2703 > > Not After: Sun Sep 06 00:23:57 UTC 2703 > > just a few years too early > > i think this is looking like a gnutls regression, downgrading gnutls makes it work > > ... > > rjones (IRC): hmm, i'm beginning to think gnutls has been miscompiled by gcc > > gnutls_x509_crt_get_activation_time inside the gnutls verification api returns garbage > > but the very same call done from a demo program returns the right answer > > ... > > OMG, gnulib-- has silently changed gnutls to use 64-bit time_t > > ...which is an ABI incompatibility because gnutls has public APIs which have time_t parameters > > so apps talking to gnutls will expect 32-bit time_t, but gnutls is processing 64-bit time_t > > this is utterly insane > > Time to do a mass rebuild and mass SONAME bump of everything shipped as 32-bits? A mass rebuild won't fix the problem, because the fundamental issue is that apps using GNUTLS don't set _TIME_BITS=64 while GNUTLS does set that, so they have incompatible views of what size time_t is. GLibC sensibly hid the 64-bit time_t behind _TIME_BITS=64, so that applications/libraries didn't get a silent ABI change when updating to newer GLibC. GNULIB's year2038 module will check for this _TIME_BITS=64 support and if present, enable it. That would have been OK on its own as apps would still be opting in to use of GNULIB's year2038 module. The problem with GNUTLS arises because the pre-existing GNULIB largefile module appears to also have been changed to set _TIME_BITS=64. Thus when an application using the largefile module updates GNULIB, they unwittingly get this change to time_t which impacts their ABI compatibility if they export any APIs using time_t, or call into any other non-GLibC libraries that use time_t in their APIs. The compounding factor is that the GNULIB largefile module is something probably any application has been using for decades. IOW, an opt-in GLiBC change to 64-bit time_t has effectively become an always on change to 64-bit time_t for apps/libs using GNULIB. I can understand the good intentions of GNULIB in making this change to largefile expecting it to benefit apps, but I think it has a rather unfortunate / undesirable ripple effect which makes it a net downside. GNULIB did provide a --disable-year2038 flag to configure, however, expecting every existing end user who builds apps/libs to consistently know about and use --disable-year2038 is not practical IMHO. Ideally GNUTLS would not have exposed time_t (or any other variable size type) in its public API, but that's the unfortunately historical baggage they can't address without an API+ABI change. It is possible to argue that the situation with _TIME_BITS=64 is no different to that of _FILE_OFFSET_BITS=64 usage, and from a purely technical view that is correct. Both affect the size of certain GLibC typedefs, and so can impact ABI compatibility of libararies whose public APIs use such typedefs. The difference I think is that _FILE_OFFSET_BITS=64 is ancient history. Apps and libraries have been using _FILE_OFFSET_BITS=64 for 15-20 years already. So while there is a chance of inconsistent usage, and thus ABI incompatibility, in practice this is a non-issue since everything of consequence has long ago opted in to _FILE_OFFSET_BITS=64. Also when that was being adopted, 32-bit platforms were still in widespread use, so developers & users fairly easily identified & fixed problems. Today 32-bit is on its way out, so introducing a new _TIME_BITS=64 and getting everything converted to use is a huge challenge, compounded by the fact that very few developers ever test or use 32-bit anymore. IMHO if distros really want to deal with this, they need to be able to force _TIME_BITS=64 globally / unconditionally, and do a mass rebuild. Having apps/libs incrementally adopt _TIME_BITS=64 in isolation is going to drip feed incompatibility problems over years, many of which will go undetected and silently cause problems. Some of these incompatibilities could ultimately turn out to cause security flaws, because correctly interpreting time is security critical in certain areas of code like certificate validation. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|