From patchwork Sat Mar 28 15:22:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38646 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by sourceware.org (Postfix) with ESMTPS id 8CA38385E009 for ; Sat, 28 Mar 2020 15:30:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8CA38385E009 IronPort-SDR: 5iqUc45z+4QNNyfGgen6u6NH8BXhwrMGWRDhsSOkB0U3hN3NsA0i7jGhpCiI9d7m0PaFaNUHUf R98i9X5mR49yKf7XOXdTIwl6bJkhiCeeUi+Qj6U3NR/ETY+79BlyYyFVi4IhkVRpQs1L9NyEZH 4Ht2bMF5IeMcwXfMX7D/lVDS/5J8NX8ozusm4RLCG2tC1Lni/N3JXEQWs/ez4BTDX1xNgWEWPj TxAWUPiCzo49CYZDJikcuxU+vdZ0dKzjbmTXvH344Uw/jpkTg/VrLsuysaigTA7lgeDZl/Gn+s gTs= X-IronPort-AV: E=Sophos;i="5.72,316,1580745600"; d="scan'208";a="138142286" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 28 Mar 2020 23:30:29 +0800 IronPort-SDR: 4zC2HE+n1hZawOJW5oBNzP4/3GSZcEQYdMg71hd460RYYiAFaHdjgVRQKqHOazA0GVBY78Hy0a LJTXyqYd6dTKGKWInVSxsVJ1DXD4L9KFYW5Pfi2czfErcS2ksDuJ2YetopIiXFoTWdFc5kLoem A+NlYEnE75UvpA/jqLWiNdEKjnfTF3S3VGp6etLgUWryO8cPbILcqOhkrXPy2CuCPQRrNehTtC v6KdL1RG14qwR1VIUbJL0lrYSMM7JPitq96IG0jc+njn9iiJ3NLP+JigKVBSjS/P7+2wlMrGqD hbVS4CsTmXbtQlgQXcNGXQ8m Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2020 08:21:28 -0700 IronPort-SDR: kWEP2eJhKCXVpYJc4l9xZkGcqYVhGrpH32/DF+qx+3QOJsEHAi5nKHh9ZtZi6r1DwencfELLnn GFuHxHnkTmj7PxPHesQTCGUk7JTLgTF8V8o9wM0Y7uQgZc3A+SCnMVi8e1MZiWmFkKxmeuZtn0 iNt/RtbemF/D3fwbjQXSmUpFME8+E7Q7m542lbx1l5QAXh8xQPFLAu8gJDYIiAFmVKo6tS/8CK BjB1o+AtTAGXXfFo8N9Rxq6ZrHc6CV2Bm/w0JNGh5adVMVmqNPWbcf7g24EUxnUmTGVY0tK+Pz asI= WDCIronportException: Internal Received: from wdapacbjl0003.my.asia.wdc.com (HELO risc6-mainframe.hgst.com) ([10.86.55.5]) by uls-op-cesaip02.wdc.com with ESMTP; 28 Mar 2020 08:30:28 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: Vineet.Gupta1@synopsys.com, alistair23@gmail.com, Alistair Francis Subject: [PATCH v6 0/5] Always use 32-bit time_t for certain syscalls Date: Sat, 28 Mar 2020 08:22:44 -0700 Message-Id: <20200328152249.972428-1-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 X-Spam-Status: No, score=-17.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Mar 2020 15:30:32 -0000 On y2038 safe 32-bit systems the Linux kernel expects itimerval and rusage to use a 32-bit time_t, even though the other time_t's are 64-bit. This series converts getitimer, setitimer, getrusage and wait4 to be both y2038 safe and pass a 32-bit time_t based on the __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 macro. On 32-bit systems we will pass a 32-bit time to the kernel (no matter the time_t size). This is no change for most 64-bit architectures or 32-bit architectures with a 32-bit time_t. We can also remove the old Alpha functions as this is now handled genericly. This follows the standard y2038 conversion so that we don't break backwards compatibility but we expose a 64-bit version for y2038 safe architectrures (like RV32). This series was tested by running: ./scripts/build-many-glibcs.py ... compilers ./scripts/build-many-glibcs.py ... glibcs on my x86_64 machine. I also ran make check on RV32 and I only see a total of 10 test failures. I don't have a way to test this on Alpha, would someone mind testing it for me? v6: - Rebase on master - Address v5 review comments v5: - Rebase on master Alistair Francis (5): sysv: Define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 linux: Use long time_t __getitimer/__setitimer resource: Add a __rusage64 struct linux: Use long time_t for wait4/getrusage sysv/alpha: Use generic __timeval32 and helpers bits/typesizes.h | 6 + include/sys/resource.h | 121 ++++++++++++++++++ include/time.h | 15 +++ sysdeps/unix/syscalls.list | 3 - .../unix/sysv/linux/alpha/bits/typesizes.h | 3 + sysdeps/unix/sysv/linux/alpha/osf_adjtime.c | 15 ++- sysdeps/unix/sysv/linux/alpha/osf_getitimer.c | 9 +- sysdeps/unix/sysv/linux/alpha/osf_getrusage.c | 10 +- .../unix/sysv/linux/alpha/osf_gettimeofday.c | 6 +- sysdeps/unix/sysv/linux/alpha/osf_setitimer.c | 15 ++- .../unix/sysv/linux/alpha/osf_settimeofday.c | 6 +- sysdeps/unix/sysv/linux/alpha/osf_utimes.c | 8 +- sysdeps/unix/sysv/linux/alpha/osf_wait4.c | 10 +- .../unix/sysv/linux/generic/bits/typesizes.h | 6 + sysdeps/unix/sysv/linux/getitimer.c | 59 +++++++++ sysdeps/unix/sysv/linux/getrusage.c | 58 +++++++++ sysdeps/unix/sysv/linux/s390/bits/typesizes.h | 6 + sysdeps/unix/sysv/linux/setitimer.c | 94 ++++++++++++++ .../unix/sysv/linux/sparc/bits/typesizes.h | 6 + .../alpha-tv32-compat.h => tv32-compat.h} | 94 ++++++-------- sysdeps/unix/sysv/linux/wait4.c | 50 +++++++- sysdeps/unix/sysv/linux/x86/bits/typesizes.h | 5 + 22 files changed, 505 insertions(+), 100 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/getitimer.c create mode 100644 sysdeps/unix/sysv/linux/getrusage.c create mode 100644 sysdeps/unix/sysv/linux/setitimer.c rename sysdeps/unix/sysv/linux/{alpha/alpha-tv32-compat.h => tv32-compat.h} (53%)