From patchwork Fri Feb 14 16:31:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1238167 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-109752-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha1 header.s=default header.b=uVstMZIG; dkim=pass (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=iYJjJLv+; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 48JzdC3fz4zB3wQ for ; Sat, 15 Feb 2020 03:40:15 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; q=dns; s=default; b=qKk bFfa99IpiJZYEPEzyXaJCofCoNqyo/CuYVscgD0AH4E4L3YZZgY9Cp1UVNjGoLQq HoGYv0vvPhy5vX6GqyG5jlqFpigHSzp6R93pQsY5YKISde2AlBeYP6rb9dANZCRW vQ21DfWkyyek2ExrDjCJyxSeA8NOIAMB8h4V/j/k= 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:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; s=default; bh=O71saxTgV NX8vgxYk9WTBIqkRpE=; b=uVstMZIGzqc14mR3icLZ32gKjjtS5gpGvuKTj9D2V 8m5KrH/qAYZHIxgVTVwIcovpl+C7o1LQyBrg8UIjFRyXgOtw2UM0yYiCbmVnCzO4 J18NAfUDRnkj6Cx1tZS9FiieCWfOk6m7YGSG502G5ej6h+FOWq58F6IgrHG8ZQiX RY= Received: (qmail 68241 invoked by alias); 14 Feb 2020 16:39:33 -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 Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 63199 invoked by uid 89); 14 Feb 2020 16:38:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: esa4.hgst.iphmx.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1581698313; x=1613234313; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ANvpZFS+FrsfxjDWBVvnPss0K7cGMNYqFCQSBmboKpw=; b=iYJjJLv+ifseU73kMyE3RD1/ISYXl1PQ0fkOb6TZIBzkQ8jIY/OjvSF6 u9XjuDsRmaob7W/VBgTvcmRZwvxPpJAGpANBHfmZvtAquOKWxc5VYvUw4 ae39nh8daD8DG2Gk0gq+zygYX92XKBP9+gpQT29lkortp9EKfTW1azBVR f0KNd82efMIRi48uOu9eKRyBEaD5A3f1fSbaWEuB1kXnAymUwR9qR846k /AHeYPJKIrDUbUatvLfByO5c/2NckuF5zy91KNSgc0ZIgOqg4u9ew0App fJuqKb/WS5rfdlraBEUvNYs0VrYurrsUrrBQhG3VWAHf5koPqecROBg57 A==; IronPort-SDR: Z/hK/2hELRWr4wDk5fWQrHfs9MBNGq8H34Al7Cwyr3faATaGeB9GUGnh5whQ2s470ZP+Q9mGo9 7REp6Ujp6hlxgoLzCTQlOZ014f/7SvaVix/As316z9ME6xjVnFr5yZ8oAxOlWJ2Fb4h2RA3/TY HvKu7wPRKsZpjSCPcyf+ZvJBkbTk0EtA0XXYHRSkeTMPPHzyN3dTwx/Qav/3xnn1/712mpV5Xy z0epoB+aSmrTxs72kmqGUn/A8HB6f0wE6rk15wbv4r9Ti5nGUPqAGRjwfVMiFs0QSXES8rg9Tx Tzw= IronPort-SDR: E5pQD7AwrSA66nXt8wllHcIRijuPwQMcimHELBTN7zh7n4WLZrSrt9pVtNHz838+x5ElholuN+ 7kdLMhXe1xp9MM5PECQgXRkkLihh4KEspEdEadI4KqvWuf9h9WIFUaXcWv9mJD6c1oZi3n0BSw CCooYGwsaWOTNkiDdkpIDaFPrWp0qLRREWf5SadHBNeIbNhPkOKJW1bwfqBo77zIvKzBS3qfZO vogrhvfXnqfF/e9uMOC+NLGBlTova35VWXZiEk9/NM2E1avTD7JzeJIswX4Ij1jj7U1x9AMB4f scibF6oXWU+/laxQDjCDlM7x IronPort-SDR: 6LCImx0xsRA3WndVBDl9HnHGbLHUr0lX5EfUz0BxzyQR9P2/fpuhEM+b6ipaJOdnU3oa+nEJom sOAQsRApn5Z/Gex2mRUPVz1DdL64vD1okdCH5QKsUsv9SNZs0zH+X4uvXgLXyMOaOcJzq0PVot 4SHQI2aHI8X4Xq7+U7THQysQmcCqu/prYjBbpD5afVxAiYtAlD+Y/i1A9sKCnzYSPzTiUkmXl6 4rxxZ5nZaTRrhwpHSz8oZO2Mw5zzg8ESXLpLBnrmP3Bxft+w6HfiWZ/1Z/t71ECz/sy2P97occ heg= WDCIronportException: Internal From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH v3 0/8] Always use 32-bit time_t for certain syscalls Date: Fri, 14 Feb 2020 08:31:26 -0800 Message-Id: <20200214163134.31601-1-alistair.francis@wdc.com> MIME-Version: 1.0 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. I don't have a way to test this on Alpha, would someone mind testing it for me? 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. Alistair Francis (8): sysv/linux: Rename alpha functions to be alpha specific time: Add a timeval with a 32-bit tv_sec and tv_usec time: Add a __itimerval64 struct 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 | 120 ++++++++++++++++++ include/time.h | 71 +++++++++++ .../unix/sysv/linux/alpha/bits/typesizes.h | 3 + sysdeps/unix/sysv/linux/alpha/osf_adjtime.c | 7 +- sysdeps/unix/sysv/linux/alpha/osf_getitimer.c | 3 +- sysdeps/unix/sysv/linux/alpha/osf_getrusage.c | 8 +- .../unix/sysv/linux/alpha/osf_gettimeofday.c | 4 +- sysdeps/unix/sysv/linux/alpha/osf_setitimer.c | 5 +- .../unix/sysv/linux/alpha/osf_settimeofday.c | 4 +- sysdeps/unix/sysv/linux/alpha/osf_utimes.c | 4 +- sysdeps/unix/sysv/linux/alpha/osf_wait4.c | 8 +- .../unix/sysv/linux/generic/bits/typesizes.h | 7 + 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 | 95 ++++++++++++++ .../unix/sysv/linux/sparc/bits/typesizes.h | 6 + .../unix/sysv/linux/{alpha => }/tv32-compat.h | 86 +++++-------- sysdeps/unix/sysv/linux/wait4.c | 49 ++++++- sysdeps/unix/sysv/linux/x86/bits/typesizes.h | 3 + 21 files changed, 541 insertions(+), 73 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 => }/tv32-compat.h (59%)