From patchwork Tue Mar 31 15:46:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38688 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by sourceware.org (Postfix) with ESMTPS id 55D8B385DC00 for ; Tue, 31 Mar 2020 15:54:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 55D8B385DC00 IronPort-SDR: Hw2u8uqz1k0V50PK7eM+s2SnDOOjuaVMlxh+c0+UAlEEW7h1O6lSgLkOLSSDpfN16WRKIrQx6K pEHFCTzXAEsLjUz0gAYj3s73uCQxKY6Cq4HrLK2k5aeEw6cBWy4kus7xgZVotoSwhvFy0TcsO9 kzCyoemVaTeFwq12Pngi6e/yOiY5KPTB9vALrMMgtjLL76qokF/9OhCKo6JP+nGVxz6dPfGXB8 geb1P/aviiEw0FvmucfAAhhg5IXCGROY0OlagHUjbRsufFT3gwxyk/yKdC6Jwqa5fgmm3FAUMV kJw= X-IronPort-AV: E=Sophos;i="5.72,328,1580745600"; d="scan'208";a="134068944" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 31 Mar 2020 23:54:40 +0800 IronPort-SDR: 16mFJhA4o7gr9z7Bk9NIscKqDEM4QRHNLkII2FKpjlVs4siiD2TgeSiVAw0JHzcouV4RujooqX 6hkIQA5HCKzAa4Ycdp+4QaAg+lCCdOqcdmcfo/dUHYHW1oVbpoNA3LfGzvKSQIog+p0O56tm2z dMyG2RuRE6QRyzSrJLFOPcMoudJtkAFWAwnfkFrysj4ofsQeEQx+JPkkYKTQ5nUKFYVmDbIdzm rp1RxKrnVTVs7iA/UpGM/fSv6ZC/MSHZfh6xGiKUXBh2R/dmIYdHlJqzOe0NC1QjBQd3jzY0gs Op5ewi+7sfpH6boFjmtfvU3c Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2020 08:45:34 -0700 IronPort-SDR: 2pYp5L68MjU82HNGyKZSfFE6ZXy3D0+5LqDm+p24JO1MoxWI3czWSMzFWhT2lHA8xiIHxhcyYD KfZqg8ZfBwOW738G38PvPpSlV/SCHuMGYgUUxF70XIGNHXPEyRzYJTv0uiKBRckfI1aallhkOn cX8HXUvnIZLN1ADIuN3hmyk2FoXZFH3KHqQZq9u9RQgapeFjwi1pOOBfpQrxch1m/6zUUwhnLi 2s6VWRI4cXGK5j7OE+b8/fYyJnP7TIo5Lz+xr3S1ybDs3zLGBkpgu9eMjrn/QMQJfY3UceFehY fXE= WDCIronportException: Internal Received: from usa001473.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.55.8]) by uls-op-cesaip01.wdc.com with ESMTP; 31 Mar 2020 08:54:39 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: Vineet.Gupta1@synopsys.com, alistair23@gmail.com, Alistair Francis Subject: [PATCH v7 0/5] Always use 32-bit time_t for certain syscalls Date: Tue, 31 Mar 2020 08:46:51 -0700 Message-Id: <20200331154656.687841-1-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 X-Spam-Status: No, score=-18.8 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: Tue, 31 Mar 2020 15:54:43 -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? v7: - Fix the lack of setting for getitimer 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 | 61 +++++++++ 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, 507 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%)