From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [PATCH] remaining steps for time64 switchover
Date: Sun, 27 Oct 2019 10:53:56 -0400 [thread overview]
Message-ID: <20191027145356.GY16318@brightrain.aerifal.cx> (raw)
In-Reply-To: <em03b56343-11cd-4d6b-b7f4-400c15d94f5e@elzian>
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
next prev parent reply other threads:[~2019-10-27 14:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-21 2:46 Rich Felker
2019-10-21 12:43 ` Rich Felker
2019-10-27 4:15 ` Rich Felker
2019-10-27 4:26 ` Rich Felker
2019-10-27 8:32 ` Laurent Bercot
2019-10-27 14:53 ` Rich Felker [this message]
2019-10-27 20:12 ` Matias Fonzo
2019-10-27 21:14 ` Rich Felker
2019-10-27 21:53 ` Matias Fonzo
2019-10-27 23:27 ` Laurent Bercot
2019-10-28 21:31 ` Matias Fonzo
2019-10-28 22:22 ` Rich Felker
2019-10-29 19:52 ` Rich Felker
2019-10-29 19:53 ` Rich Felker
2019-10-29 23:08 ` Rich Felker
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=20191027145356.GY16318@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).