From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14872 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] remaining steps for time64 switchover Date: Sun, 27 Oct 2019 10:53:56 -0400 Message-ID: <20191027145356.GY16318@brightrain.aerifal.cx> References: <20191021024643.GA6192@brightrain.aerifal.cx> <20191027042645.GX16318@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="123818"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-14888-gllmg-musl=m.gmane.org@lists.openwall.com Sun Oct 27 15:54:12 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1iOjvo-000W3t-9P for gllmg-musl@m.gmane.org; Sun, 27 Oct 2019 15:54:12 +0100 Original-Received: (qmail 30390 invoked by uid 550); 27 Oct 2019 14:54:08 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 30371 invoked from network); 27 Oct 2019 14:54:08 -0000 Content-Disposition: inline In-Reply-To: Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:14872 Archived-At: On Sun, Oct 27, 2019 at 08:32:57AM +0000, Laurent Bercot wrote: > >Or here. So, the story on utmpx: we can either > > > >1. match the current size on 32-bit archs, but move the timeval to > > unused space at the end where a time64 version fits, or > > > >2. match the current size and layout of the 64-bit struct, making it > > possible to share records between 32- and 64-bit processes on the > > same machine. > > > >Keep in mind that this struct is not used anywhere in libc presently, > >but normally it's used as a format for on-disk records. > > > >I'm kinda leaning towards option 2, but being that I don't use (and > >hate) utmp, I'd rather hear opinions from people who do use it. Either > >way time fields in existing data will break, so it's a question of > >whether that one-time breakage is already sufficient to go a bit > >further and get 32/64 compat afterwards. > > I don't use the libc's utmpx, but I maintain utmps, which is a > secure implementation of utmp, including the definition of struct > utmpx. > I haven't been following the time64 thing closely. The current struct > utmpx definition includes a struct timeval. Will it need to change, > or will musl's struct timeval change be enough and naturally propagate > so the struct utmpx will become time64-compatible? It will naturally propagate even if nothing is done, but then you have the worst of both worlds of 1 and 2. You neither maintain the size and layout of other members (which would be useful if you have old data or a mix of old and new binaries using it) nor gain any useful compatibility (between 32- and 64-bit on same system). You just get a new size and layout that doesn't match either. So it's better to make some change, I think. Note that the difference between "do nothing" and option 2 is basically nothing except putting padding around ut_session so that ut_tv will start on a 0 mod 8 boundary. This will happen naturally on most archs but not i386 (and m68k but there's no corresponding 64-bit arch there anyway). The proposal I have in mind is basically: - long ut_session; +#if __BYTE_ORDER == 1234 + int ut_session, __ut_pad2; +#else + int __ut_pad2, ut_session; +#endif doing this for 64-bit too since ut_session is semantically 32-bit (pid_t) and glibc has it as 32-bit on x86_64. (I'd also add explicit padding for ut_type just because m68k is wacky and doesn't align ints even, to fix that while we have the chance.) > On-disk data is not a problem. On the distro that I know uses utmps > (Adélie), the utmp/wtmp records, by design, do not survive a reboot, > so a reboot will fix everything - and will be mandatory anyway on > arches where the musl ABI changes. Reboot is not mandatory; as usual, just atomic replacement of libc.so is. > I'm not aware of any distribution that uses musl, doesn't use utmps, > and still keeps on-disk utmpx records. Thanks. Rich