mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [PATCH v3] remaining steps for time64 switchover
Date: Sat, 2 Nov 2019 17:37:15 -0400	[thread overview]
Message-ID: <20191102213715.GT16318@brightrain.aerifal.cx> (raw)
In-Reply-To: <20191102163426.GS16318@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 1998 bytes --]

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

[-- Attachment #2: 0001-fixup-difftime32.patch --]
[-- Type: text/plain, Size: 634 bytes --]

From c634bb6210c770a835bb565c859da4b435ff97f7 Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
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 <time.h>
 
-double __difftime32(time32_t t1, time_t t2)
+double __difftime32(time32_t t1, time32_t t2)
 {
 	return difftime(t1, t2);
 }
-- 
2.21.0


[-- Attachment #3: 0002-compat-fixup-pthread_timedjoin_np_time32.patch --]
[-- Type: text/plain, Size: 930 bytes --]

From 48dab2f8e0b849e406f906f2010cbdc422714d86 Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
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 <time.h>
 #include <pthread.h>
 
-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


[-- Attachment #4: 0003-compat-fixup-__xstat.patch --]
[-- Type: text/plain, Size: 1210 bytes --]

From 11ddfb8983a6e94972f38d255e71d320b72719ae Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
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 <sys/stat.h>
 
-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


      reply	other threads:[~2019-11-02 21:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-02  1:39 Rich Felker
2019-11-02  1:40 ` Rich Felker
2019-11-02 16:34 ` Rich Felker
2019-11-02 21:37   ` Rich Felker [this message]

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=20191102213715.GT16318@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).