From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14480 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: vdso clock_gettime and time64 Date: Wed, 31 Jul 2019 11:07:25 -0400 Message-ID: <20190731150725.GB9017@brightrain.aerifal.cx> References: <20190731051313.GA27476@brightrain.aerifal.cx> <87d0hqsj19.fsf@oldenburg2.str.redhat.com> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="48567"; 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-14496-gllmg-musl=m.gmane.org@lists.openwall.com Wed Jul 31 17:07:41 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 1hsqCa-000CTR-TG for gllmg-musl@m.gmane.org; Wed, 31 Jul 2019 17:07:40 +0200 Original-Received: (qmail 12210 invoked by uid 550); 31 Jul 2019 15:07:38 -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 12187 invoked from network); 31 Jul 2019 15:07:37 -0000 Content-Disposition: inline In-Reply-To: <87d0hqsj19.fsf@oldenburg2.str.redhat.com> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:14480 Archived-At: On Wed, Jul 31, 2019 at 10:30:26AM +0200, Florian Weimer wrote: > * Rich Felker: > > > One looming thing that folks probably aren't going to like about > > switching to 64-bit time_t is losing the vdso clock_gettime on old > > kernels. Instead of a function call in userspace, you get *two* > > syscalls, the first (time64) one failing, every time you call > > clock_gettime. Of course the problem goes away immediately if you have > > a time64-capable kernel providing the time64 vdso function. > > > > Is this a problem, and if so, what can be done about it? > > Some users notice fairly quickly if the vDSO fast path is gone and file > bug reports. (This can happen for various reasons, e.g. buggy kernels > detecting CPU cycle counter drift when there is actually none.) I don't > know to what extent this matters to legacy architectures. These are good points. A lot of these archs actually don't even have vdso clock_gettime (only mips, arm, and i386 seem to). I wonder if it would make sense to support use of 32-bit vdso for now, possibly with logic to drop it if it ever returns a negative tv_sec, and consider removing it after the last kernel without time64 is EOL'd, so that it's gone well before 2038. Thinking about it more, I'm actually concerned about how vdso can possibly work at all with checkpoint/resume functionality. The code in the vdso has to match the running kernel (which will update the data it reads), but the suspended task could be in the middle of vdso code, and even if not it's already bound the function entry point addresses and knowledge of which ones exist. We probably need the answer to this to know if there's even a meaningful problem to solve here. (And if this somehow isn't a question with a known answer already, someone's going to have a really bad day...) Rich