From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14901 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH v3] remaining steps for time64 switchover Date: Sat, 2 Nov 2019 17:37:15 -0400 Message-ID: <20191102213715.GT16318@brightrain.aerifal.cx> References: <20191102013911.GA26175@brightrain.aerifal.cx> <20191102163426.GS16318@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="fjEAjMKpll6GDq3U" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="214244"; 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-14917-gllmg-musl=m.gmane.org@lists.openwall.com Sat Nov 02 22:37:31 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 1iR15O-000tcP-RD for gllmg-musl@m.gmane.org; Sat, 02 Nov 2019 22:37:30 +0100 Original-Received: (qmail 16224 invoked by uid 550); 2 Nov 2019 21:37:28 -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 16206 invoked from network); 2 Nov 2019 21:37:27 -0000 Content-Disposition: inline In-Reply-To: <20191102163426.GS16318@brightrain.aerifal.cx> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:14901 Archived-At: --fjEAjMKpll6GDq3U Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Nov 02, 2019 at 12:34:26PM -0400, Rich Felker wrote: > On Fri, Nov 01, 2019 at 09:39:11PM -0400, Rich Felker wrote: > > A couple errors in the v2 patchset motivated me to factor the changes > > to sys/socket.h and arch/generic/ioctl.h out of the main switchover > > commit, so that the latter only touches arch dirs, and acts uniformly > > on them. The final result with all patches applied is almost the same, > > except now the powerpc and mips[n32] socket.h bits omit the time64 > > socket options, letting the top-level header's defaults take effect. > > > > All archs I have toolchains handy for, which includes the oddballs > > (mips, powerpc) and a few 64-bit ones, have been tested to build > > successfully and get the right values of the sockopt and ioctl macros, > > utilizing a horrible hack (uncommitted of course) dropped into the > > source tree while building. > > > > Hopefully this is "final" now and ready for push. > > compat/time32/adjtimex_time32.c was inconsistent with what was later > done for struct timex (see commit > 928674dcd0c5c643b8a4440466103be841151f5e). Two very helpful reviewers > on #musl pointed this out, and I'll be squashing the attached fix. (I > tried to avoid having many time32 compat shims call each other rather > than directly calling the real functions in libc, but this one would > involve a lot of duplication (and the duplication initially led to > this error) so... And a few more. The first two clearly cause wrong behavior. The last (__xstat) just causes undefined behavior by calling the __*stat*_time32 functions without a prototype with wrong pointer type. (The same issue also applies in theory between the legacy caller and the shims, but it's inevitable, and is only visible with LTO between the old .o files and new libc.a or similar, which just can't be a supported usage. OTOH the libc-internal mismatch could break LTO of libc.so.) I'll be squashing these with the compat shims commit, and pushing real soon now. Rich --fjEAjMKpll6GDq3U Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-fixup-difftime32.patch" >From c634bb6210c770a835bb565c859da4b435ff97f7 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 2 Nov 2019 12:40:50 -0400 Subject: [PATCH 1/3] fixup difftime32 --- compat/time32/difftime32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/time32/difftime32.c b/compat/time32/difftime32.c index 15c65709..5950943a 100644 --- a/compat/time32/difftime32.c +++ b/compat/time32/difftime32.c @@ -1,7 +1,7 @@ #include "time32.h" #include -double __difftime32(time32_t t1, time_t t2) +double __difftime32(time32_t t1, time32_t t2) { return difftime(t1, t2); } -- 2.21.0 --fjEAjMKpll6GDq3U Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0002-compat-fixup-pthread_timedjoin_np_time32.patch" >From 48dab2f8e0b849e406f906f2010cbdc422714d86 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 2 Nov 2019 12:48:27 -0400 Subject: [PATCH 2/3] compat fixup: pthread_timedjoin_np_time32 --- compat/time32/pthread_timedjoin_np_time32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/time32/pthread_timedjoin_np_time32.c b/compat/time32/pthread_timedjoin_np_time32.c index 99a26bc6..3ec29951 100644 --- a/compat/time32/pthread_timedjoin_np_time32.c +++ b/compat/time32/pthread_timedjoin_np_time32.c @@ -3,7 +3,7 @@ #include #include -int __pthread_timedjoin_np_time32(pthread_t t, void **res, const struct timespec *at32) +int __pthread_timedjoin_np_time32(pthread_t t, void **res, const struct timespec32 *at32) { return pthread_timedjoin_np(t, res, !at32 ? 0 : (&(struct timespec){ .tv_sec = at32->tv_sec, .tv_nsec = at32->tv_nsec})); -- 2.21.0 --fjEAjMKpll6GDq3U Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0003-compat-fixup-__xstat.patch" >From 11ddfb8983a6e94972f38d255e71d320b72719ae Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 2 Nov 2019 17:27:00 -0400 Subject: [PATCH 3/3] compat fixup: __xstat --- compat/time32/__xstat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compat/time32/__xstat.c b/compat/time32/__xstat.c index d8cd5ef2..f53660c2 100644 --- a/compat/time32/__xstat.c +++ b/compat/time32/__xstat.c @@ -1,22 +1,22 @@ #include "time32.h" #include -int __fxstat64(int ver, int fd, struct stat *buf) +int __fxstat64(int ver, int fd, struct stat32 *buf) { return __fstat_time32(fd, buf); } -int __fxstatat64(int ver, int fd, const char *path, struct stat *buf, int flag) +int __fxstatat64(int ver, int fd, const char *path, struct stat32 *buf, int flag) { return __fstatat_time32(fd, path, buf, flag); } -int __lxstat64(int ver, const char *path, struct stat *buf) +int __lxstat64(int ver, const char *path, struct stat32 *buf) { return __lstat_time32(path, buf); } -int __xstat64(int ver, const char *path, struct stat *buf) +int __xstat64(int ver, const char *path, struct stat32 *buf) { return __stat_time32(path, buf); } -- 2.21.0 --fjEAjMKpll6GDq3U--