Received: by 10.192.165.156 with SMTP id m28csp1147347imm; Wed, 11 Apr 2018 13:19:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/8vno4axhgGNVYlqifsvjDrILWPxX03Mm2zeewIEhtQsRsp4a/EjL7YEwfIOKQANIm7EGc X-Received: by 2002:a17:902:7291:: with SMTP id d17-v6mr6613619pll.218.1523477969748; Wed, 11 Apr 2018 13:19:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523477969; cv=none; d=google.com; s=arc-20160816; b=Hhu+hlBAgo3BOARbJv4kf2mxaxc/y/y0jhMxWYtcNGLsXDp/dZXlUk2C10SMBB9g7f f8SzvzrIzx4eFiIDDVmGobMeivU904xZDmpFehAL0AUtGdYDhQb1qKt7R5kOFvMTD5TR 6P1iRVkrG/xXZ5fRZA1OlrYNg0EGErpZOBsKQJDCScYExA8nZD1F3IkP4xUf//E+1Icz UjnHZ4qmlBMdrZODkb/hE4tYOIn6cfm6Qsbk8SDN/WkPZw98NhTtU/uE6S3zeymPdA5S 95h+T8iFokf0W/SSN0Cd7rImopqJsAEMdu7BHZz9wAEGyF5Mxk/e7TFzDL64qXVIXfJs 0SIg== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=jenOEIc0A72j9KULD1p+3UgeTGYng++O8ubobc7wfdA=; b=Q/x2w+8nMvT7s6UHgf0WyeB1EpDx9UyUwBXN7XKBmzUlgEZjJEYuEIBHMcXb5Lp7zX IJBOpk2KmQ/aD6j1rtUNL+SEZy0BjXUXWRecQAwsjF9r58dH39s07KzSsm0P6CcnHhLh 1Gr7SM/SX+Lo0pegFxubw+XGXcBE5aq7aAPkEKMsksqVHpYXWEFikSw1MJYN+E8yI2nB srYxlDTBo82j/cXVurRd0F72JeqaXCTZBuct9TtaLMuloOZKuFWvMGsRw1FUsyllBIyA 8Q2dQNypTD5GIsEdYTWxxzG0/YJXpFd7SHr3Xk7KUapg2xtpCYXHkI6za0uzy964FvXD EV2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=r0TMt7ja; 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 t4si1366153pfh.139.2018.04.11.13.18.52; Wed, 11 Apr 2018 13:19:29 -0700 (PDT) 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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=r0TMt7ja; 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 S1757310AbeDKUN4 (ORCPT + 99 others); Wed, 11 Apr 2018 16:13:56 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:34832 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756230AbeDKUNx (ORCPT ); Wed, 11 Apr 2018 16:13:53 -0400 Received: by mail-qt0-f193.google.com with SMTP id s2so3461798qti.2; Wed, 11 Apr 2018 13:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=jenOEIc0A72j9KULD1p+3UgeTGYng++O8ubobc7wfdA=; b=r0TMt7ja13oOHNpaF+Jp+1KjPIKIh1AHs1E7nhPlYN2H66kCq4e5iABFdhGfXswyJu iFbtHXCANXvnQXZDhR8bINOR5xUN7psCZuWvzTcuCGRID136LhRGMKKjw/OOk9f/sS4j J/1cHW8MGZjJcJbHVu7J87rhNRvtIHCVAtyTvwyzlwrd03sm+UDIi7uqkXOQR2llq22J Yc9wznnNldlKwrqL2OiUllFaLA9xJmJohC3S7PkfZJx1Aq/I33rit9WaIHCZWHgD/l+2 dVcTNYkl3gBesijyxFth5r0meqyrKMb2Vv8AEDYrPCpoAF6HjzrbGznYaF6VcdE/KCBp zyEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=jenOEIc0A72j9KULD1p+3UgeTGYng++O8ubobc7wfdA=; b=le94OEb8ms5LX9I1+CC3h/82f32mgqjkhULzxkdsM683R+JJJ9G/mIO5WM6TQh29i0 /MyMt3+VPnOuoMzNpDd5/SoJgAQRvjKSfdbWaEJpcnHdSPztHtuaEikXBoAemWjNgXU4 evn4nBemNGTPhq7hJ99rd3uOpzW3ECk+Gs7oP92wCQne8MdvdRa7OaMvk37PA8yC0+BZ nFzDl71hOErrr1FsOpqhe4fQ5ZlRDNmuOZLn0rq52q1lXhqKpQ0dqBGQoec5bKTusIvs mFDmvWqifSiT8gNY7suN/evKpPq8BO10KTrnU9Gi5tnv4DjczKjQJLJ0XL6U8pwumCPO ADFA== X-Gm-Message-State: ALQs6tBejrqTEw4R0cOGePXdUdECuvpFam0m0oWFYczOshW7nPwiEHim QrUCFVRL8xaK4GAN2Z8shNAIOC7Wt4cPeG98kZ8= X-Received: by 10.200.36.250 with SMTP id t55mr9567171qtt.141.1523477632626; Wed, 11 Apr 2018 13:13:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.185.25 with HTTP; Wed, 11 Apr 2018 13:13:52 -0700 (PDT) In-Reply-To: <87bmepn2o8.fsf_-_@xmission.com> References: <87d0z6ttxe.fsf@xmission.com> <87bmepn2o8.fsf_-_@xmission.com> From: Arnd Bergmann Date: Wed, 11 Apr 2018 22:13:52 +0200 X-Google-Sender-Auth: jGPDbiQQgPOCCW5rbZZCPl9sn2E Message-ID: Subject: Re: Q: Do si_time and si_utime need to be 64bit for y2038? To: "Eric W. Biederman" Cc: Andy Lutomirski , Andy Lutomirski , X86 ML , LKML , linux-arch 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 Wed, Apr 11, 2018 at 6:11 PM, Eric W. Biederman wrote: > > Arnd, > > I am looking at the siginfo si_utime and si_stime fields of type clock_t > on 32bit architectures except for x32 these are 32bit fields. For y2038 > do we want to extend these fields to 64bit like x32 does? Or is it not > a problem for these fields to be 32bit? Short answer: I think we're fine without changing it, at least for y2038. > I care right now because I am trying to figure out how > copy_siginfo_to_user32 and copy_siginfo_to_user need to evolve. > > If we are going to extend existing architectures with 64bit variations > of si_utime and si_stime copy_siginfo_to_user and copy_siginfo_to_user32 > needs an additional parameter describing which variant they should be > copying. > > It looks like posix does not define si_stime and and si_utime so we only > have to be backwards compatible with ourselves for whatever that is > worth. > > I am wondering if perhaps the general solution might be to just add > two extra fields si_stime64 and si_utime64 and always fill those in. > > Arnd do you have any ideas? There are generally four areas to be aware of with the data structure changes required for y2038: 1. Stuff that overflows in the next few decades (either 2038 or some other year). si_utime/si_stime counts relative times, so there is no overflow happening at a particular date that we have to be aware of. However, it does overflow when a 32-bit process runs for more than (LONG_MAX / USER_HZ) seconds, which is about 248 days. When you have a large SMP system with 256 CPUs and run a single task across all of them, the overflow happens within one day of runtime. This is a rare use case for 32-bit tasks, but it is an actual limitation that we may want to fix regardless of the y2038 changes. 2. Types that don't overflow in a particular interface (because they count relative times) but do overflow in others. We have a problem in wait4()/waidid() and getrusage() here, since those use 'struct timeval' to count process times. Those can count up to 68 years of process times (97 days on a 256-core machine running one task), so we probably don't care about the overflow, but POSIX requires the use of timeval [1] and we have to redefine that structure with an incompatible layout. We do have a choice between either keeping the existing structure and letting the libc translate the 32-bit time_t to a 64-bit time_t, or adding replacement syscalls for both getrusage() and waitid(). IIRC we don't need a new wait4(), since that can be implemented using waitid. clock_t is used in exactly two places: struct siginfo and struct tms, so if we change one of the two, we also have to change the other. 3. In some cases, two structures are almost identical between 32-bit and 64-bit architectures. Using the exact same layout simplifies the compat syscall handling. I think in x32, this was a factor as it means that e.g. times() is shared between x32 and x86-64. 4. If we change an interface, we may want to improve it in more than one way, like we did with stat()->stat64()->statx() or time()-> gettimeofday()->clock_gettime()->clock_gettime64(). If we introduce a larger range for the 32-bit siginfo and tms structures, we could also consider extending the resolution to nanoseconds. I wouldn't follow rusage's timeval but use timespec64 (__kernel_timespec as seen from user space). 64-bit nanoseconds are another option, but that again overflows after 584 CPU-years or 52 days on a 4096-core system. Arnd [1] http://pubs.opengroup.org/onlinepubs/009696699/basedefs/sys/resource.h.html