From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_GMAIL_RCVD, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 0211C1F463 for ; Mon, 30 Dec 2019 19:57:42 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-type; q=dns; s=default; b=X/6w beViEBnp4GXFr67/cN1+EkRLu0skAmvGFuLuhv4Jia2n6h1H3e5Fs3PHbtKO3D7a avvtIJVgH36QwfYUCivohHT8xZLh44WSAuYUoJE74FITJ9ewCQdedqiw89ViFYNk +cM7nFAzyuoVP5E6WJEvzexR2XeHZVBK75RaShU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-type; s=default; bh=D35TMTfppk I4FZvawK+iRa0guyk=; b=tvo4ShYWauUlS6sZDhU1MbryI2hjnDVw1CFqol/OfI Q1VTfdgxc/vI9tHN9wex0ai6nq5pTCY4ulUnlp/JW4gW17XLZMDddkeMhLvNN6hf j6V2waJIGld3ixGoUGwOqj2qghETY9IoEvDRWKoh9cOEkzmH8skBCMvRIHWpPkYf c= Received: (qmail 3189 invoked by alias); 30 Dec 2019 19:57:40 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 3181 invoked by uid 89); 30 Dec 2019 19:57:40 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-lj1-f195.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gQASTrDu0mqcgs1TXsQTgQphsil81eHPAMuFTKBjlbE=; b=ohzIfEQMeBk7s9Iao2944CZcY0d5Qd7y9fGZVcWxpzJSPbDD8kPAd/qml/8yzH27xX AkwYWE5xAfiKPtibnmV5i+/mmYDurpwkMeKJ0AYeew5+V+eafQ7Ag9PEGKeu4mrETtlO glaZvMoyoDh+rFrVmWH41F5mOxHmN+k2JnhYg9WP9qb56iUcepQ7OlFDE7b3wNEHWcph tOBdFC46G6GhVcDpz4eVkTc4Oe1G+tVlAuStT98F5MDH/HLxrD87KKFgLtQN/VpxqHIj xalQQ5bCcxlXwF7goWqadzj0KXRP3nAYGgpBoae28hvIco0YffzhY21Qh8ol3iIbXLmZ 1zTQ== MIME-Version: 1.0 References: In-Reply-To: From: Alistair Francis Date: Mon, 30 Dec 2019 11:51:00 -0800 Message-ID: Subject: Re: 32-bit time_t inside itimerval To: Arnd Bergmann Cc: GNU C Library , Alistair Francis , Lukasz Majewski Content-Type: text/plain; charset="UTF-8" On Mon, Dec 30, 2019 at 2:02 AM Arnd Bergmann wrote: > > On Sat, Dec 21, 2019 at 6:19 PM Alistair Francis wrote: > > On Sat, Dec 21, 2019 at 5:31 AM Arnd Bergmann wrote: > > > On Fri, Dec 20, 2019 at 10:35 PM Alistair Francis wrote: > > > > > > > What happened here is that originally I thought we would not need > > > setitimer/getitimer > > > and could fall back to timer_settime/timer_gettime, but that turned out to be a > > > misunderstanding (we do need both). > > > > > > By the time we introduced all the other system calls with 64-bit > > > time_t in linux-5.1, > > > there was no replacement yet, but since these interfaces never pass > > > absolute times > > > on the kernel ABI, it was considered good enough. There was a small debate on > > > whether struct itimerval and struct rusage (which has the same problem) should > > > have replacements using struct __kernel_timespec, or a newly added > > > __kernel_timeval, and that discussion never had a conclusion, so we > > > left it at this. > > > > Thanks for clarifying ths Arnd. > > > > Ok, I didn't realise this was the case. It ends up being a bit of a pain. > > I'm sorry to hear that this is causing problems now. I tried hard to > get feedback on the question of whether we need the new syscalls > or not, and in the end decided not to do them, as any libc implementation > would need to do some conversion either way, and they already need > to understand about the kernel types as well. No worries, I understand. Now that I have gotten my head around them it actually isn't too bad. > > > > For glibc, the only sensible implementation is to implement the time64 > > > settimer/getitimer interfaces on top of the time32 setitimer/getitimer > > > system calls, > > > doing the conversion internally. (Same for getrusage and wait4). > > > > Ok, so we need to fix setitimer/getitimer, getrusage and waitid's > > rusage (wait4 isn't in y2038 safe calls). > > Right. To clarify about wait4/waitid (you are probably aware of this, > just pointing it out for other readers): The waitid() libc interface does not > contain a timeval, only the wait3()/wait4() functions do, and they are > implemented on top of the waitid() syscall. Yep! > > > For the glibc people, can we do something like this? > > > > 1. Add a __old_timeval struct used by the itimerval and rusage structs > > 2. Make __old_timeval use __old_time_t that is always a long (no > > matter what time_t really is) > > If you have linux-5.1 kernel headers, there is already __kernel_old_timeval > that is defined specifically for this purpose. Not sure if you can use those > given the state of the kernel headers overall. > > > Then the question becomes do we expose __old_timeval (with 32-bit > > time_t) or the real timeval (64-bit time_t) to callers of the > > functions? > > I would think this has to be the actual timeval, there is no point in > changing the API now. Yeah, agreed. I have updated the RV32 port to internally convert between 32/64-bit. > > > > We may still want to introduce getitimer_time64, setiitimer_timer64, > > > getrusage_time64 and waitid_time64 at some point, using __kernel_timespec > > > to have a saner user space interface, but there is no real point in glibc > > > using those syscalls as the underlying implementation when the fallback > > > to the time32 versions is still required. > > > > I would +1 adding getitimer_time64, setiitimer_timer64, > > getrusage_time64 and waitid_time64 as it simplifies things. > > I have a rework of the itimer functions queued up for the kernel, after that > it should become very easy to add another set based on itimerspec. > > For waitid/getrusage, a little bit of internal reorganization is still required > but shouldn't be hard to do as long as we can agree on the calling > conventions. We had a bit of discussion recently about adding new > waitid() variants that settled with adding new flags for the moment, > so adding another syscall now may take a while (the getrusage > replacement should not be an issue). > > How do you expect the new syscalls to simplify things though? > My guess would be that they add complexity to the implementation > when you have to deal with converting from both the __kernel_timespec > and __kernel_old_timeval formats to the timeval format rather than > just one of the two. Yeah, it might not simplify anything. My thinking was that having time_t be 64-bit everywhere would be simpler, but converting these syscalls isn't as painful as I first thought so it currently isn't really a problem. Alistair > > Arnd