Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3472628imb; Tue, 5 Mar 2019 10:09:29 -0800 (PST) X-Google-Smtp-Source: APXvYqwzzMFKwSszClz4BHrqdessgM3uyA7HHfcTT1LoTfJDFWEqvmqDtuYhRNLv3fgDdLWVFqBj X-Received: by 2002:a17:902:aa88:: with SMTP id d8mr2533568plr.61.1551809369888; Tue, 05 Mar 2019 10:09:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551809369; cv=none; d=google.com; s=arc-20160816; b=q4Q3O0Ss37ZfpzSIYEBdHrs3cAerGFJMoHR2HejGJngjHiWqp5S00396BECz2/2BQk 7K6w1MtRjjhSiS/OuMPYyzkcewoTYcy/ZI/YY3uo6zahZa5wM8amtpJSuTFhzQYhRJ7y xMsBuIUyl7/B+eF1yAJhlsxaTv643OB2y4kvbcVUyaFBQB704b3GZkfmq/rkLcvCf2zx AkclWUcIYH0q+4Rva/9Lru41hwLAG2UgckfhTYQf93Oi9rxCrA6qJJpj57/IXOGu+bji BYz+3rZBS6GNeZXtVL627hYZaEj+F54QzVPa05hvaGKBA0/xTlUYbIkDvc/Gkuf9TcwE CveQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=4H29aknGGiQ/qyTi8W7fgHrEi65LlPNM72qkKP/f4mY=; b=Q7PhpzlK5Yj++nUNvnpdfQvS6N+fJcGdU7lZH9KJ50DNRlky5MKSPW77HhRdXc3Wsl FNJ3z1YnRpqNluudJzMZJuS8w97sxuQ8OlkXAYX5Kc8C83oA7id0B4e0+ioiMTgfnCk1 WAKiESXA50zwhXrcpIj6x95jjiv13fHgh9jMlblU9gRzyQC5zZLODYJn4XYDKPvTdvWt 3F4csnSwdfDAAESaJWettMRQ+71Ech0W+GY3UvnyNN4cK6fSoFwFLwEhCgcQWnteLLEP XAtcULaUfWw7ZU2GJgYUf5O2heJKwUaNKe5CyPhJaSOC+iICNH60gpE+aOC5eEj6lar3 AAKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j35si3226103plb.253.2019.03.05.10.09.14; Tue, 05 Mar 2019 10:09:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727550AbfCEREk (ORCPT + 99 others); Tue, 5 Mar 2019 12:04:40 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:34938 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727041AbfCEREj (ORCPT ); Tue, 5 Mar 2019 12:04:39 -0500 Received: by mail-qt1-f195.google.com with SMTP id p48so9700537qtk.2 for ; Tue, 05 Mar 2019 09:04:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4H29aknGGiQ/qyTi8W7fgHrEi65LlPNM72qkKP/f4mY=; b=grleLfxqhBX3Qu42rMzVf4UXOCRJ5ZcVpGqfN+ZeeBZpUYjFntUH5uNVdRlTG7JFEb V55z6Gl1CalfwY73G75LlKwE1Dhmx8MdlBB3Dotg+uUIt6St7+sHmddIBswyfW8S6spM Tvg9gOzDmxbU4OByO9N0pzRu7TRYmqBWV6Hb5rvcj0zyYVJ2Drflhx2NNAOblsJq+rZV FXgful+1mEWLEBx1xPQHcR7brBSAijsEeUz2/6stqlbtnbdUvYUGt7RjjllMqxnGeZIv z3rEvKFVTrACmgIUmgCf27D3+Hjcz7oS4ISHIgAykt8sSrXKUxSj4Jj5dRa8hpnx/RG5 oCLw== X-Gm-Message-State: APjAAAUSU3/4viowjBimkPFozzNSBNtPPfXUlT2Goem3lWlHQs9gaJAR uXr6vcTmaUpUuGZzOTbD1BwLkE4z58YrAigsg10= X-Received: by 2002:ac8:3251:: with SMTP id y17mr2262407qta.152.1551805478252; Tue, 05 Mar 2019 09:04:38 -0800 (PST) MIME-Version: 1.0 References: <20190305162351.5aadde66@jawa> In-Reply-To: <20190305162351.5aadde66@jawa> From: Arnd Bergmann Date: Tue, 5 Mar 2019 18:04:21 +0100 Message-ID: Subject: Re: [Y2038] Question regarding support of old time interfaces beyond y2038 To: Lukasz Majewski Cc: Linux Kernel Mailing List , Joseph Myers , GNU C Library Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 5, 2019 at 4:24 PM Lukasz Majewski wrote: > > Dear Arnd, > > In your "playground" repository [1] (branch: y2038), the time functions > (stime, settimeofday, etc) are not converted in Linux to be Y2038 aware > (as for example clock_settime{64}() is). Correct. FWIW, this is now merged into the mainline kernel. > I've also searched on the Internet and I've found some old discussions > regarding them: > > SHA1: d33c577cccd0b3e5bb2425f85037f26714a59363 [2] > From commit message: > > "The time, stime, utime, utimes, and futimesat system calls are only > used on older architectures, and we do not provide y2038 safe variants > of them, as they are replaced by clock_gettime64, clock_settime64, > and utimensat_time64." > > Moreover, the stime has been even explicitly marked as obsolete [3]. > > > From other discussion [4] - regarding the following system calls: > time, stime, gettimeofday, settimeofday, adjtimex, nanosleep, alarm, > getitimer, setitimer, select, utime, utimes, futimesat, and > {old,new}{l,f,}stat{,64}. > > "These all pass 32-bit time_t arguments on 32-bit > architectures and are replaced by other interfaces (e.g. posix > timers and clocks, statx). C libraries implementing 64-bit time_t in > 32-bit architectures have to implement the handles by wrapping > around the newer interfaces." > > > > > Has something changed since then? Has any new idea for conversion > emerged? No, this has been the plan for many years now. > After observing the development of y2038 on playground [1], I can deduce > that new interfaces are only going to be supported and converted > (clock_settime64/clock_gettime64, etc.) > > Considering the above - would it be best to drop Y2038 support on 32 > bit machines for old syscalls (stime and friends) and for some others > (settimeofday/gettimeofday) write Y2038 wrappers based on new time > kernel API (clock_gettime/settime) in the C library (i.e. glibc)? There are multiple dimensions to what you are asking here: - On the user space interface, the C library (glibc, musl, uclibc, ...) implements a set of interfaces for time management. The set that is implemented here is defined by POSIX and other standards and decided by the respective C library implementation. All functions that get implemented here have to use the same definition of time_t however, so if there is both a clock_gettime() function and a time() function, they must either both use 32-bit time_t or both must use 64-bit time_t. Both can be implemented on top of any kernel interface for getting the time (time, gettimeofday, clock_gettime, clock_gettime64), but the only sensible implementation is to use clock_gettime64() in order to have the full range and resolution. - The kernel has a growing set of system calls, i.e. we tend to only add new ones but not take old ones away. In many cases, a new syscall is a superset of the old one (e.g. oldstat, newstat stat64, xstat), any architecture that had an old version has to keep it around, but new architectures only ever provide the most recent variant. Arnd