From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14536 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [RFC] final time64 switch-over patch series Date: Fri, 9 Aug 2019 12:30:21 -0400 Message-ID: <20190809163021.GJ9017@brightrain.aerifal.cx> References: <20190802214433.GA25193@brightrain.aerifal.cx> <20190804043109.GL9017@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="XWOWbaMNXpFDWE00" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="158129"; 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-14552-gllmg-musl=m.gmane.org@lists.openwall.com Fri Aug 09 18:30:38 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 1hw7mn-000ezx-QZ for gllmg-musl@m.gmane.org; Fri, 09 Aug 2019 18:30:37 +0200 Original-Received: (qmail 32472 invoked by uid 550); 9 Aug 2019 16:30:34 -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 32450 invoked from network); 9 Aug 2019 16:30:34 -0000 Content-Disposition: inline In-Reply-To: <20190804043109.GL9017@brightrain.aerifal.cx> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:14536 Archived-At: --XWOWbaMNXpFDWE00 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Aug 04, 2019 at 12:31:09AM -0400, Rich Felker wrote: > On Fri, Aug 02, 2019 at 05:44:33PM -0400, Rich Felker wrote: > > >From 3c6bde03ecf2aa7dac605f0a55a1be201f3d4c5f Mon Sep 17 00:00:00 2001 > > From: Rich Felker > > Date: Fri, 2 Aug 2019 15:41:27 -0400 > > Subject: [PATCH 5/5] [RFC] [POC] switch i386 to 64-bit time_t > > > > this is a proof of concept for converting one 32-bit arch, i386, to > > 64-bit time_t. known issues: > > > > 1. the switchover of timespec padding is a hack, and needs to be done > > right, but that involves making alltypes.h aware of endianness, which > > probably should have been done a long time ago anyway and would get > > rid of inappropriate inclusion of in some places. > > > > 2. the rusage, utmpx, and timex structs are not correct with regard to > > ABI or functionality. they need to be fixed before this is safe to > > use. > > > > 3. Makefile change should be its own thing. > > > > there are likely a lot more problems. > > Add a significant incomplete prerequisite I forgot about: dlsym. There > needs to be a redirection for dlsym, and 32-bit archs need a second > asm entry point for __dlsym_time64 which first checks the symbol name > against the list of time64 redirections and rewrites the request if > it's a match. For reference, here's the first draft of the redirection. The worst part of it is the large relro string table. Rich --XWOWbaMNXpFDWE00 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="dlsym_redir_time64.c" #include #include #include #include "dynlink.h" const char *const mapping[][2] = { { "adjtime", "__adjtime64" }, { "adjtimex", "__adjtimex_time64" }, { "aio_suspend", "__aio_suspend_time64" }, { "clock_adjtime", "__clock_adjtime64" }, { "clock_getres", "__clock_getres_time64" }, { "clock_gettime", "__clock_gettime64" }, { "clock_nanosleep", "__clock_nanosleep_time64" }, { "clock_settime", "__clock_settime64" }, { "cnd_timedwait", "__cnd_timedwait_time64" }, { "ctime", "__ctime64" }, { "ctime_r", "__ctime64_r" }, { "difftime", "__difftime64" }, { "dlsym", "__dlsym_time64" }, { "fstat", "__fstat_time64" }, { "fstatat", "__fstatat_time64" }, { "ftime", "__ftime64" }, { "futimens", "__futimens_time64" }, { "futimes", "__futimes_time64" }, { "futimesat", "__futimesat_time64" }, { "getitimer", "__getitimer_time64" }, { "getrusage", "__getrusage_time64" }, { "gettimeofday", "__gettimeofday_time64" }, { "gmtime", "__gmtime64" }, { "gmtime_r", "__gmtime64_r" }, { "localtime", "__localtime64" }, { "localtime_r", "__localtime64_r" }, { "lstat", "__lstat_time64" }, { "lutimes", "__lutimes_time64" }, { "mktime", "__mktime64" }, { "mq_timedreceive", "__mq_timedreceive_time64" }, { "mq_timedsend", "__mq_timedsend_time64" }, { "mtx_timedlock", "__mtx_timedlock_time64" }, { "nanosleep", "__nanosleep_time64" }, { "ppoll", "__ppoll_time64" }, { "pselect", "__pselect_time64" }, { "pthread_cond_timedwait", "__pthread_cond_timedwait_time64" }, { "pthread_mutex_timedlock", "__pthread_mutex_timedlock_time64" }, { "pthread_rwlock_timedrdlock", "__pthread_rwlock_timedrdlock_time64" }, { "pthread_rwlock_timedwrlock", "__pthread_rwlock_timedwrlock_time64" }, { "pthread_timedjoin_np", "__pthread_timedjoin_np_time64" }, { "recvmmsg", "__recvmmsg_time64" }, { "sched_rr_get_interval", "__sched_rr_get_interval_time64" }, { "select", "__select_time64" }, { "sem_timedwait", "__sem_timedwait_time64" }, { "semtimedop", "__semtimedop_time64" }, { "setitimer", "__setitimer_time64" }, { "settimeofday", "__settimeofday_time64" }, { "sigtimedwait", "__sigtimedwait_time64" }, { "stat", "__stat_time64" }, { "stime", "__stime64" }, { "thrd_sleep", "__thrd_sleep_time64" }, { "time", "__time64" }, { "timegm", "__timegm_time64" }, { "timer_gettime", "__timer_gettime64" }, { "timer_settime", "__timer_settime64" }, { "timerfd_gettime", "__timerfd_gettime64" }, { "timerfd_settime", "__timerfd_settime64" }, { "timespec_get", "__timespec_get_time64" }, { "utime", "__utime64" }, { "utimensat", "__utimensat_time64" }, { "utimes", "__utimes_time64" }, { "wait3", "__wait3_time64" }, { "wait4", "__wait4_time64" }, }; static int cmp(const void *a, const void *b) { return strcmp(*(const char *const *)a, *(const char *const *)b); } hidden void *__dlsym_redir_time64(void *restrict p, const char *restrict s, void *restrict ra) { const char *const *map = bsearch(&(const char *const[]){s, 0}, mapping, sizeof mapping/sizeof mapping[0], sizeof mapping[0], cmp); return __dlsym(p, map ? map[1] : s, ra); } --XWOWbaMNXpFDWE00--