From patchwork Fri Nov 8 21:07:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178963 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3281005ilf; Fri, 8 Nov 2019 13:08:49 -0800 (PST) X-Google-Smtp-Source: APXvYqxUz602cv6BdKHm/MrqP7K0sPsgh05mnedr++CayLbqa3IGF/76+Vvvs7i8Zh151n6agM5E X-Received: by 2002:a17:906:4bd4:: with SMTP id x20mr11000973ejv.200.1573247329300; Fri, 08 Nov 2019 13:08:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247329; cv=none; d=google.com; s=arc-20160816; b=ZsvjkCWMr3s+OFO212FYOe2Ho+w/nRIrmXyc0RwR7CcRDKzO9lZXJzeCXGkTdiiauu K7Ee6VucvarUtecpGIBUKDxChvUgQ8KjbCR1y5exCFoGjl/1ZUUmdDPuIlOgdaJI7Fwb aGf0gU/ohh3G/vzflAXQOXY9UFERdD6Yx6Sg97ikT5CmfaTe3IIvudnU/WP9IqWr4ulj wFv7grY5Wr+42ZCqFBvpffz7U80BkgwtVHGf8ZIASuiN0qCi+KxS9msP6pJgIYWMSoo4 XCjDgsxImQkMZAPVrByJ0sVUPBaL7sKUWz4GbqHlmpmYoaSNdpVG1Al2m6FKlIL3St0W LBwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=MGQj0aqW/EMMzGlMNsKvi7JTu04uUif9ZmVVKw90ivg=; b=LqrVXYBvDk9QXvPMMRKQOsLX8ArslPxV7TZ9qB8s5qV3IX1Gt7ab3JzWt6qQ2cUxUF hctZKmLdyWQ8PSL+1KpPlDsx1HoAWjEg0M8puQcasBAhuTQGRO1N/rMUmb5KTwS9JAkt myqMYfnupwB2ORbf3+6+1uxxTAXdm0F3rqK96OT55lJtUgACD0svaeDr7GFqeR1ZKl6y LHhdu8JpknIZVt0B5c00CJuFsGlYGLMXatgRoSpNeE8ofDhUoEiKk80wST5S1+PF6JZf 6LeUL9n3KKYj2CIFFOiR2cN8Iz7MQTXqr+4FYReTn1wJvdxTXbqM7b2zB00xmvM+A9xC EJBg== 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 y17si5044988edd.148.2019.11.08.13.08.49; Fri, 08 Nov 2019 13:08:49 -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 S1731858AbfKHVIq (ORCPT + 26 others); Fri, 8 Nov 2019 16:08:46 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:43469 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726349AbfKHVIp (ORCPT ); Fri, 8 Nov 2019 16:08:45 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mv2pC-1hcBKf32ie-00r1bf; Fri, 08 Nov 2019 22:08:29 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Thomas Gleixner , John Stultz Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Alexander Viro , Benjamin LaHaise , Stephen Boyd , "David S. Miller" , linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, netdev@vger.kernel.org Subject: [PATCH 01/23] y2038: remove CONFIG_64BIT_TIME Date: Fri, 8 Nov 2019 22:07:21 +0100 Message-Id: <20191108210824.1534248-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:H2tiCmOPXYw8s1qtnX/2cKq67XKFxksIA+eJap+sUEcVUWZWb+Y 8qBIXKy6r6bmI22vV77RnVQUuIj7iwJikQx6acqRH7nHsZTPjpxMcyvlS/WoqsCQJhc+0bI X/svWIrOH3ivqFs2+WfQmIBo7M1x9Coag63s5V0Nz6hOszrZ4K8t595MS92PQ3lbhuIvQop IEsAxjRtAtCpbkolITw/g== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Ga9diiCQdOk=:i8WuivqPZNstauNeRgqfYF XxoGLuFx6ewBMCyp9wIrs18C/yqZN+6404yWmhT82msLSJeX2vSKHrAFnYnzg/8MdJ803WspP SeKEga2VQG3SKNkMdXbrPU8qlEGog0T3nd0aK+j7NxqbixbqnfRcgFyPRznM6I7CFpYXuhNG3 hwBLs01rZjsBnn6CjQbQvPkvcNUXdW4u09kN5yoJ3EjXlItrfLObZSd7JLBUZC9+TXFRQf3z8 Uq6KzhBTPCtKpmVHbGKmR5PAcuZIQ+oh8BpDo+r9+8KXGg7U6ePPPvFj5bdJU/CmGbTnbxuHK 4lvg0GaC/SouPKAT5KxCVR9w3ltBoVdSyEx/nDFNYTVU8nM1oFoU/mwhdQzyQYh87cuQZ3dUc c8xyLsvMCae1P4y9EjSF3z3U8KMBmlNOqBokGX/GVYghcOR2zvJyVT3IsepSNkfW+CHBlqWCV AIW9zf/jfzxipCBsntrLzHma+84YW0ajLN6J0pn7ZB+H3tlMdOM1YDRwhuX3ABeqSPv7Vjorv Xf11OoHQuaKkncSn9mfJRaPD050DbTjRckQjyKxRDHw8uDB0GxqHcv22gE5Qi051n44ItIxdM 09xIWJQQlN+Dz0XlXU2/h4Fqi40/NAAQm8m21mzw0BzuiYw+yEVDmTDC+aqhBAFTTsJU6bLOy j++yfRwfHZh0lgIcWboO7bYTO6gWwQ64I4U1YWyipuR571DU1pL3429Ca8FZOMrbMFG9g8hrp ugSbD3CgtnzJmTpy41Xc8CWytO8HqrSc7JdKcb4U1HK4c5XwlcVg+L3stkOQBKmy4qlP/0GIb 12JmTyvu9QAMNB2OeZwl9LfD8GHfEoWlW7JbT2kVWaPgydoIjMugiKOPDMqwCP0gtbbePHmlG 5GfM8WBlOtDbzNDlEwQQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The CONFIG_64BIT_TIME option is defined on all architectures, and can be removed for simplicity now. Signed-off-by: Arnd Bergmann --- arch/Kconfig | 8 -------- fs/aio.c | 2 +- ipc/syscall.c | 2 +- kernel/time/hrtimer.c | 2 +- kernel/time/time.c | 4 ++-- net/socket.c | 2 +- 6 files changed, 6 insertions(+), 14 deletions(-) -- 2.20.0 diff --git a/arch/Kconfig b/arch/Kconfig index 5f8a5d84dbbe..0e1fded2940e 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -796,14 +796,6 @@ config OLD_SIGACTION config COMPAT_OLD_SIGACTION bool -config 64BIT_TIME - def_bool y - help - This should be selected by all architectures that need to support - new system calls with a 64-bit time_t. This is relevant on all 32-bit - architectures, and 64-bit architectures as part of compat syscall - handling. - config COMPAT_32BIT_TIME def_bool !64BIT || COMPAT help diff --git a/fs/aio.c b/fs/aio.c index 01e0fb9ae45a..447e3a0c572c 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -2056,7 +2056,7 @@ static long do_io_getevents(aio_context_t ctx_id, * specifies an infinite timeout. Note that the timeout pointed to by * timeout is relative. Will fail with -ENOSYS if not implemented. */ -#if !defined(CONFIG_64BIT_TIME) || defined(CONFIG_64BIT) +#ifdef CONFIG_64BIT SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id, long, min_nr, diff --git a/ipc/syscall.c b/ipc/syscall.c index 581bdff4e7c5..dfb0e988d542 100644 --- a/ipc/syscall.c +++ b/ipc/syscall.c @@ -30,7 +30,7 @@ int ksys_ipc(unsigned int call, int first, unsigned long second, return ksys_semtimedop(first, (struct sembuf __user *)ptr, second, NULL); case SEMTIMEDOP: - if (IS_ENABLED(CONFIG_64BIT) || !IS_ENABLED(CONFIG_64BIT_TIME)) + if (IS_ENABLED(CONFIG_64BIT)) return ksys_semtimedop(first, ptr, second, (const struct __kernel_timespec __user *)fifth); else if (IS_ENABLED(CONFIG_COMPAT_32BIT_TIME)) diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 65605530ee34..9e20873148c6 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -1940,7 +1940,7 @@ long hrtimer_nanosleep(const struct timespec64 *rqtp, return ret; } -#if !defined(CONFIG_64BIT_TIME) || defined(CONFIG_64BIT) +#ifdef CONFIG_64BIT SYSCALL_DEFINE2(nanosleep, struct __kernel_timespec __user *, rqtp, struct __kernel_timespec __user *, rmtp) diff --git a/kernel/time/time.c b/kernel/time/time.c index 45a358953f09..ddbddf504c23 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c @@ -267,7 +267,7 @@ COMPAT_SYSCALL_DEFINE2(settimeofday, struct old_timeval32 __user *, tv, } #endif -#if !defined(CONFIG_64BIT_TIME) || defined(CONFIG_64BIT) +#ifdef CONFIG_64BIT SYSCALL_DEFINE1(adjtimex, struct __kernel_timex __user *, txc_p) { struct __kernel_timex txc; /* Local copy of parameter */ @@ -884,7 +884,7 @@ int get_timespec64(struct timespec64 *ts, ts->tv_sec = kts.tv_sec; /* Zero out the padding for 32 bit systems or in compat mode */ - if (IS_ENABLED(CONFIG_64BIT_TIME) && in_compat_syscall()) + if (in_compat_syscall()) kts.tv_nsec &= 0xFFFFFFFFUL; ts->tv_nsec = kts.tv_nsec; diff --git a/net/socket.c b/net/socket.c index 6a9ab7a8b1d2..98f6544b0096 100644 --- a/net/socket.c +++ b/net/socket.c @@ -2833,7 +2833,7 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args) a[2], true); break; case SYS_RECVMMSG: - if (IS_ENABLED(CONFIG_64BIT) || !IS_ENABLED(CONFIG_64BIT_TIME)) + if (IS_ENABLED(CONFIG_64BIT)) err = __sys_recvmmsg(a0, (struct mmsghdr __user *)a1, a[2], a[3], (struct __kernel_timespec __user *)a[4], From patchwork Fri Nov 8 21:07:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178964 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3281174ilf; Fri, 8 Nov 2019 13:08:57 -0800 (PST) X-Google-Smtp-Source: APXvYqwdYLqtNIFP2zdn0rDhtqlAKDXSpPjNhOEuORQOMR5ezC/vT2IUpOlS6ECujMEaC5TmjQWi X-Received: by 2002:a50:c408:: with SMTP id v8mr12742566edf.140.1573247337433; Fri, 08 Nov 2019 13:08:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247337; cv=none; d=google.com; s=arc-20160816; b=drpQxWVBaWoCC6Dp2ZeiojM5UMDaSTm3H0xklCFAlrbqY2/KWQbGhvH+hIhSRwo8Jf o/Mw61F1bghbEWZvVJVt7ISK2ryHHAFp7MT/PzZkp1g7B1l1S61LPfLY2BZJHjgdswN6 dinc3qk0rpBDV2zF6TEdF9fjMWhZCOlccRL4n992EFJODTM9d0isggw5Id9KUMRiY27p z3o4RsUCj6SWpbEBeL7KlpUYisx0T99udFWx2E39k8JIS8j+kv/YeD9jTCdH9JtlzhYv zx1g7pCsWxfEop+KTAoPbKlQDoGve/KQhF8+cxRKny5vQp32qo0uHSblkrIkNd5rblGE UHCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=k+GeTuMPmpo4E5ZzcaqHSBsJWqlQs+SwSAf7fEC0bhc=; b=Y3FX5qb787G9tBsdbi7icNLvH8JvzBhlU5h2GVMci3N2+qXV7lOLOngVWTYVP59vsZ B8ojgJbjw+HX/1j5fQ75erIjUO0fLx5Lo6P/zHai1xNK63BTv0UU3X+QuP5O9o+LEhRg yy151tn2eaTXXvj5zLPwZ+JKdCDNI0BZs9eQZ/3EF0lqoMh3EDwcH5tTlEGXKio0cVfj onASAAoKyAaKblaRgwXK3Dj3lhzH6DzkCQ3SmwCAVfUfouHoIiydVwDtm6ZPa4yGgW3+ JDoH0IpnK4eju776YGA7MgfIvfFobNC8Rvz69f3STPZabJI/VrblDfr6QGGmk5mR/8Jv OvhQ== 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 dc16si4600090ejb.192.2019.11.08.13.08.57; Fri, 08 Nov 2019 13:08:57 -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 S1732304AbfKHVIy (ORCPT + 26 others); Fri, 8 Nov 2019 16:08:54 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:33093 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726349AbfKHVIy (ORCPT ); Fri, 8 Nov 2019 16:08:54 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1N5mSj-1hrrj32IW3-017H8q; Fri, 08 Nov 2019 22:08:46 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Arnd Bergmann Cc: linux-kernel@vger.kernel.org, "David S. Miller" , Deepa Dinamani , linux-arch@vger.kernel.org Subject: [PATCH 02/23] y2038: add __kernel_old_timespec and __kernel_old_time_t Date: Fri, 8 Nov 2019 22:07:22 +0100 Message-Id: <20191108210824.1534248-2-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:b5N3TpWxS8V8FWtAAfXOHjyNkW2dd6vsCxc3KrZ6/bDozC0UzGX z868QcmcxcXwLNvP/3j81Fa4z9V7PlenxpvccLoVz4hKjdilYMaDe/ddhT2s8zuc6t343yp NWgkAlequJ80TyMQU6XoRmbEi9koTAj5AzKTrifgQcLBQRXriFwCnD+Qaqn8hJqr6IlGUan MybHnAEMRxVEmgjwINzdA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:q5HMqU+dZb4=:uY+qkO0lXE59wSs58wgWT+ 9hOYnpRnXLK3Q5CA7O6So4C2b7pZDg8dPtx9dcZ0BzX9ToZrv84PD++2Y366m7viED6W2R8by Jt9dhtGloAaPP3DuCRY0+vmILayaAm7UraXmlPaw+ToPZ/OFZ/6VOO16cGYzLvuFECU3nUNhQ AIcjQ0GkQo5E1LaNXdF622Vyj2QD+tBUemLVc7vlTY7as80tyjmrgBKD1KtVWfy8OJH6yeTkU G7hwfS4qvnRAYdRa+9VJY5W/J3QNbGtkyp7audhrk4nnvxldr6Lj44Lal8YJLRiBMhHhq7AbA 1NgnLMS3UZkLRCIxIIfCp3KLHep5m+IAtOfdjKs5hUEM1ueWJiP8PAKkLmaDFGp5W18s4yHWF MYUO/mvHXcvYTUe9/jn2VjWe5MZaVQ/JiCpRfI0zV/lnH6Fg7BbfegkwiUwdifmCpiWhRfnjH KEbL1KDCUiVrLJkWgNPfiHoRqEz57pn64uYrV+bNK7cpswlfQU13Wi3vRPNyfsiKFyc3tgP2m 7iSEfQqLqADbdHdhiy3wm7nYVDEXWzU8NG9DFm+Xl/pb5/UG+YspYxTvsfO4GjZiHOp9QVg7+ pf7Va5/5mNKVJTbSjHuhGd3BxU8vsw/7V/AX0s2alLrCJeg0Dmlj53MWdBEqcJGZbaLuLiV5J rGKQZb34B2HxnRMnKEp3LyYiBV7ltEEQLUDq2Lv8Og6C0VgHuOJV68fpNj4MG6rtF9JF7rfHI dWxx0lRApWFEtY/5cWnHsJorajJ0X7o/DPVdd0yQGLCJgwJJHwPfxQk8CCJRDu+dHnbB40MKh 6U2XmdRyQoyHCsXkr4TeAFe2JZbkwjMe66DT8QLzALG9LVsfhFh1j4HmvkK8vYUosdOTd35wW +m0gcm31rHmV5xpdHInQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 'struct timespec' definition can no longer be part of the uapi headers because it conflicts with a a now incompatible libc definition. Also, we really want to remove it in order to prevent new uses from creeping in. The same namespace conflict exists with time_t, which should also be removed. __kernel_time_t could be used safely, but adding 'old' in the name makes it clearer that this should not be used for new interfaces. Add a replacement __kernel_old_timespec structure and __kernel_old_time_t along the lines of __kernel_old_timeval. Signed-off-by: Arnd Bergmann --- include/uapi/asm-generic/posix_types.h | 1 + include/uapi/linux/time_types.h | 5 +++++ 2 files changed, 6 insertions(+) -- 2.20.0 Acked-by: Deepa Dinamani diff --git a/include/uapi/asm-generic/posix_types.h b/include/uapi/asm-generic/posix_types.h index f0733a26ebfc..2f9c80595ba7 100644 --- a/include/uapi/asm-generic/posix_types.h +++ b/include/uapi/asm-generic/posix_types.h @@ -86,6 +86,7 @@ typedef struct { */ typedef __kernel_long_t __kernel_off_t; typedef long long __kernel_loff_t; +typedef __kernel_long_t __kernel_old_time_t; typedef __kernel_long_t __kernel_time_t; typedef long long __kernel_time64_t; typedef __kernel_long_t __kernel_clock_t; diff --git a/include/uapi/linux/time_types.h b/include/uapi/linux/time_types.h index 27bfc8fc6904..60b37f29842d 100644 --- a/include/uapi/linux/time_types.h +++ b/include/uapi/linux/time_types.h @@ -28,6 +28,11 @@ struct __kernel_old_timeval { }; #endif +struct __kernel_old_timespec { + __kernel_time_t tv_sec; /* seconds */ + long tv_nsec; /* nanoseconds */ +}; + struct __kernel_sock_timeval { __s64 tv_sec; __s64 tv_usec; From patchwork Fri Nov 8 21:07:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178967 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3283407ilf; Fri, 8 Nov 2019 13:10:45 -0800 (PST) X-Google-Smtp-Source: APXvYqzfz316e8Y9iWHOZE4z5HsV+FLAK6AGISLZm29yPJyOa3YYTchABiX2rehUmhC0+vS39S5e X-Received: by 2002:a05:6402:1049:: with SMTP id e9mr12670236edu.91.1573247445442; Fri, 08 Nov 2019 13:10:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247445; cv=none; d=google.com; s=arc-20160816; b=ZczM5xumkYOZfK4Chms0XY9iakhxwt8MA1umN/Ya3XC3izWp6IfM4tixF/rm9QxcOa uYNjrYWuWSFdHX4H52JpALN53tp3Dj2P8YM/9fRdG/Bch2zUeJ8Q7XYmj8eS3dsxdYvg zNTuTGo9tYDMlp9OhpEqhqml8G/N1u/E1WRH7cBLfC0vXQl5oiehd4yJbp/WLpcVcmCs UpgJ3KcRjp2ygG9TSTQTwXWTy3dJGXR2cs9vMI3DVfzf+vvMCLpBYuDsZQwbL+cVNW9e 5dsMXVf07C1EiYd+VjrLXQDhlHXrbUywwRp0Gz8bbaLlI+eKITtHRrjIsFEE+BaW+BaH KWpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Dp1Fe+5wci35k3FcWPzyzx9uh8ibJi9GMa9HZhSmphY=; b=OHq7sl9diRdi9G8jkOKrxWY7f6t4EBOyg3N8Xbw44/ZPPpnZIYjHbzjaWFhrgqF4A9 cCz7VO63Yemn01irXp9dTazTmNJHzi4m/lG75TeELTeVijj3IGOZ22RYnqgh7JjOLHZY lUBrww+lEWULjSFoQCmKIDq4tyzuasWfJCOutrnbVnKXPCRYy7eCGKCbPbjxhxbOxXoE pq/xG2SwNuaWndIB7VdK1QRqR++Q/MDyUODrLoGPNMQ2YOVrMdrOOlQoZGMRsTfXCCP3 m7+9oDBnuR9I8xNzTjDx9JtRI7b3Ey2qQP7M6IEOFqv+BTyjAFspQDvAg+nSTxzXW98N dnyw== 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 a12si4412065ejp.425.2019.11.08.13.10.45; Fri, 08 Nov 2019 13:10:45 -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 S1732470AbfKHVKo (ORCPT + 26 others); Fri, 8 Nov 2019 16:10:44 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:49557 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732137AbfKHVKn (ORCPT ); Fri, 8 Nov 2019 16:10:43 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1M3lkT-1iTSce3JNz-000qeu; Fri, 08 Nov 2019 22:09:27 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Greentime Hu , Vincent Chen , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "David S. Miller" , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, Jeff Dike , Richard Weinberger , Anton Ivanov Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , "H. Peter Anvin" , Vincenzo Frascino , Christophe Leroy , "Eric W. Biederman" , linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org Subject: [PATCH 03/23] y2038: vdso: change timeval to __kernel_old_timeval Date: Fri, 8 Nov 2019 22:07:23 +0100 Message-Id: <20191108210824.1534248-3-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:VLIICAlTXnc6akV8I31bwvzXwDpY0cN0rydeLsQ3qT4lpr37nsE QSig7L9+fEYaUu4VulfxoNH+E4reHQ6RGrJbyz6AENXlp2ZEvLfgcY5zMAWMTtfjhtb9edx ThuUA780pWF4C2g4IuqR0gBlX5zv2mPKayttxb2UIkHe16yvjCZTYmmmavae5t5ZhdPPiRv OVGfDhmMw8AlwVhNlpN+g== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:2XmZ2WmhQSs=:NtEfBD4YRcAIUdi0aMJ9Mm Mb4MrEng20SlCkVVAtea6ffQ6TULJ8SxAulod/wh653pQ191y5a8Xt10083lB+77jDbyi4+vK MDPPbVDUw0opOuiZldymkKMNZhOr8UO10SDtogxW8SXOgk0rhSB8Cuw9mdlktFSIWkUEEWHCI 0ElYr/fvDtAlD4LLLkQ/uM2yHFlbFaWwkz8s3F5RB5+NgS5dyQzrnM0v8fZJY+zllVf/nLHHg S+JdA/xXJmfin7xMl3GN8tXVcoaVJivmYpohnP8QPHHer9yOutJpyAQkmm2xkfT7h0Igsu3oU X7muOLP+G+TGYA13w4IduabKZm9OUyfp5uiwxnvgWOPSb/mTkZzHPmo24nqv9omNrbgRVXXU7 2niBolECHBbWEeRl1dGen3sUQ7GZ4qbUoUFoUp+i08S7bqkr55zs1TDHv7eUCwQm62DLz5crv C8TlnwrkMQDuNh2GBssvXpj8kYuiUDzF4ktKGI1rpKi5EY/V+fSNMZwlaPqA7OqXF6U2JoFq4 e9BFBX6PWHsDUKdIXE5ecwqwRsSlvyXIOmOCRIanfX05ssEC+a1ha6njy87yln9bUWDP0tkaT N2uGm6uY6keDg0rUIdDm344DVUK19EuWbIknJb5TEkWdzzA85DCgwHBXbB82XpfvZSJKjGTUJ 8K/Or/oyje4QwbXSajyrofGYCVLUZd5J20QQom5N/BEI1jgoHhzm7BKPrqJlDrq+o1YRcXBrR NyGWFUaGrsk0KRRa1VAVfG5R6N8Hbgd5U7vg1qjDCdjYmTAiTEab5ZC+Iw5iTZHVOD4p8p1gD yqRjJzL1IDd9qAlDwHeRWKbOoQ+545KRPzlvfMBBBmEn8DURYyTREjntT8XHg8KqjjNQ4FNl+ tGkJFPgb3klzzrokdFpg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The gettimeofday() function in vdso uses the traditional 'timeval' structure layout, which will be incompatible with future versions of glibc on 32-bit architectures that use a 64-bit time_t. This interface is problematic for y2038, when time_t overflows on 32-bit architectures, but the plan so far is that a libc with 64-bit time_t will not call into the gettimeofday() vdso helper at all, and only have a method for entering clock_gettime(). This means we don't have to fix it here, though we probably want to add a new clock_gettime() entry point using a 64-bit version of 'struct timespec' at some point. Changing the vdso code to use __kernel_old_timeval helps isolate this usage from the other ones that still need to be fixed properly, and it gets us closer to removing the 'timeval' definition from the kernel sources. Signed-off-by: Arnd Bergmann --- arch/nds32/kernel/vdso/gettimeofday.c | 6 +++--- arch/powerpc/kernel/asm-offsets.c | 8 ++++---- arch/sparc/vdso/vclock_gettime.c | 12 ++++++------ arch/x86/entry/vsyscall/vsyscall_64.c | 2 +- arch/x86/um/vdso/um_vdso.c | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) -- 2.20.0 Reviewed-by: Thomas Gleixner diff --git a/arch/nds32/kernel/vdso/gettimeofday.c b/arch/nds32/kernel/vdso/gettimeofday.c index b02581891c33..1e69fd5b067b 100644 --- a/arch/nds32/kernel/vdso/gettimeofday.c +++ b/arch/nds32/kernel/vdso/gettimeofday.c @@ -230,10 +230,10 @@ notrace int __vdso_clock_getres(clockid_t clk_id, struct timespec *res) return 0; } -static notrace inline int gettimeofday_fallback(struct timeval *_tv, +static notrace inline int gettimeofday_fallback(struct __kernel_old_timeval *_tv, struct timezone *_tz) { - register struct timeval *tv asm("$r0") = _tv; + register struct __kernel_old_timeval *tv asm("$r0") = _tv; register struct timezone *tz asm("$r1") = _tz; register int ret asm("$r0"); @@ -246,7 +246,7 @@ static notrace inline int gettimeofday_fallback(struct timeval *_tv, return ret; } -notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) +notrace int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) { struct timespec ts; struct vdso_data *vdata; diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 484f54dab247..827f4c354e13 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c @@ -393,8 +393,8 @@ int main(void) OFFSET(CFG_DCACHE_LOGBLOCKSZ, vdso_data, dcache_log_block_size); #ifdef CONFIG_PPC64 OFFSET(CFG_SYSCALL_MAP64, vdso_data, syscall_map_64); - OFFSET(TVAL64_TV_SEC, timeval, tv_sec); - OFFSET(TVAL64_TV_USEC, timeval, tv_usec); + OFFSET(TVAL64_TV_SEC, __kernel_old_timeval, tv_sec); + OFFSET(TVAL64_TV_USEC, __kernel_old_timeval, tv_usec); OFFSET(TVAL32_TV_SEC, old_timeval32, tv_sec); OFFSET(TVAL32_TV_USEC, old_timeval32, tv_usec); OFFSET(TSPC64_TV_SEC, timespec, tv_sec); @@ -402,8 +402,8 @@ int main(void) OFFSET(TSPC32_TV_SEC, old_timespec32, tv_sec); OFFSET(TSPC32_TV_NSEC, old_timespec32, tv_nsec); #else - OFFSET(TVAL32_TV_SEC, timeval, tv_sec); - OFFSET(TVAL32_TV_USEC, timeval, tv_usec); + OFFSET(TVAL32_TV_SEC, __kernel_old_timeval, tv_sec); + OFFSET(TVAL32_TV_USEC, __kernel_old_timeval, tv_usec); OFFSET(TSPC32_TV_SEC, timespec, tv_sec); OFFSET(TSPC32_TV_NSEC, timespec, tv_nsec); #endif diff --git a/arch/sparc/vdso/vclock_gettime.c b/arch/sparc/vdso/vclock_gettime.c index fc5bdd14de76..a20c5030578d 100644 --- a/arch/sparc/vdso/vclock_gettime.c +++ b/arch/sparc/vdso/vclock_gettime.c @@ -74,7 +74,7 @@ notrace static long vdso_fallback_gettime(long clock, struct timespec *ts) return o0; } -notrace static long vdso_fallback_gettimeofday(struct timeval *tv, struct timezone *tz) +notrace static long vdso_fallback_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) { register long num __asm__("g1") = __NR_gettimeofday; register long o0 __asm__("o0") = (long) tv; @@ -304,7 +304,7 @@ __vdso_clock_gettime_stick(clockid_t clock, struct timespec *ts) } notrace int -__vdso_gettimeofday(struct timeval *tv, struct timezone *tz) +__vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) { struct vvar_data *vvd = get_vvar_data(); @@ -312,7 +312,7 @@ __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) if (likely(tv != NULL)) { union tstv_t { struct timespec ts; - struct timeval tv; + struct __kernel_old_timeval tv; } *tstv = (union tstv_t *) tv; do_realtime(vvd, &tstv->ts); /* @@ -336,11 +336,11 @@ __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) return vdso_fallback_gettimeofday(tv, tz); } int -gettimeofday(struct timeval *, struct timezone *) +gettimeofday(struct __kernel_old_timeval *, struct timezone *) __attribute__((weak, alias("__vdso_gettimeofday"))); notrace int -__vdso_gettimeofday_stick(struct timeval *tv, struct timezone *tz) +__vdso_gettimeofday_stick(struct __kernel_old_timeval *tv, struct timezone *tz) { struct vvar_data *vvd = get_vvar_data(); @@ -348,7 +348,7 @@ __vdso_gettimeofday_stick(struct timeval *tv, struct timezone *tz) if (likely(tv != NULL)) { union tstv_t { struct timespec ts; - struct timeval tv; + struct __kernel_old_timeval tv; } *tstv = (union tstv_t *) tv; do_realtime_stick(vvd, &tstv->ts); /* diff --git a/arch/x86/entry/vsyscall/vsyscall_64.c b/arch/x86/entry/vsyscall/vsyscall_64.c index e7c596dea947..76e62bcb8d87 100644 --- a/arch/x86/entry/vsyscall/vsyscall_64.c +++ b/arch/x86/entry/vsyscall/vsyscall_64.c @@ -184,7 +184,7 @@ bool emulate_vsyscall(unsigned long error_code, */ switch (vsyscall_nr) { case 0: - if (!write_ok_or_segv(regs->di, sizeof(struct timeval)) || + if (!write_ok_or_segv(regs->di, sizeof(struct __kernel_old_timeval)) || !write_ok_or_segv(regs->si, sizeof(struct timezone))) { ret = -EFAULT; goto check_fault; diff --git a/arch/x86/um/vdso/um_vdso.c b/arch/x86/um/vdso/um_vdso.c index 891868756a51..845336c11364 100644 --- a/arch/x86/um/vdso/um_vdso.c +++ b/arch/x86/um/vdso/um_vdso.c @@ -25,7 +25,7 @@ int __vdso_clock_gettime(clockid_t clock, struct timespec *ts) int clock_gettime(clockid_t, struct timespec *) __attribute__((weak, alias("__vdso_clock_gettime"))); -int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) +int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) { long ret; @@ -34,7 +34,7 @@ int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) return ret; } -int gettimeofday(struct timeval *, struct timezone *) +int gettimeofday(struct __kernel_old_timeval *, struct timezone *) __attribute__((weak, alias("__vdso_gettimeofday"))); time_t __vdso_time(time_t *t) From patchwork Fri Nov 8 21:07:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178966 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3283380ilf; Fri, 8 Nov 2019 13:10:44 -0800 (PST) X-Google-Smtp-Source: APXvYqyKr9M1Q+Fkr4jr11wmfNyqp9dmpRQYSO+sUdGAPExRY7Lt9fz1lBC3P9QtQfqErG6dhuDO X-Received: by 2002:a50:fb85:: with SMTP id e5mr12606292edq.274.1573247443860; Fri, 08 Nov 2019 13:10:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247443; cv=none; d=google.com; s=arc-20160816; b=ICd7T2JYsKVO6S0nI46yvHq3Aoilire+tPfwv4nMc8Fv6+yUlg6e7K3qTmGbTLxIf/ KIMhWX+HKwYwHaCa6Ac5SwCkD7e2ExhC9ObJatsmIIlSYXijHs+C3iPthYxVQU0bvDaw VxlJw8crB1SMiNJY0xpDIrGGTo71DD2elR/6lslJAXqAIICKRBqKT4SysPaEj9pgcWVZ Qhm1nHKB7whsaL3oLgK0X8Dzteni9m0ZfBGPXCIAoKvI7oRaNS1kYmWpSt2/D6b50uZ9 4gScfedYZt9cFn0ErGeYFZKlsbPNjMAxNqg5bWu5uqII2BfGLeui3JXIHh/2asuAFOxP 4E9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=uZ9qv/QmK9kf7o4q4CIjR5Xxc1QP3um/i2ffw5maoaA=; b=WMMn5Ac0b1kNUBhrDAiBh4z20LAT8a5N7TAruOiedXOSAppAEnhZKie3/kdjOpOIqD 37fTRZox+JMZNiSypkZ8O3GwUengPkCHyx4NcbE6bOY6stHDvAWemNVpMhO3E6b0OBeD zyk4WaBgBbW0zsjkHaPV2op5Y3fB20nw3zumGaTmwdyaL4zrEzZyseCpp7xVP03nUJN9 Jg97Qkg/KVeW63DIWRZhOmspcrBRzVo7Qyk/Iu7Evdgtduseb+cbwY7NxCJBh8Jr4jZC zYV9mpYh46xhq7EfVwHSG3oCaWI9uRMwVTwyIHOWkBa4mDOWDwYH56JYH8ni9fQj9LS3 Q45Q== 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 a12si4412065ejp.425.2019.11.08.13.10.43; Fri, 08 Nov 2019 13:10:43 -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 S1732408AbfKHVKl (ORCPT + 26 others); Fri, 8 Nov 2019 16:10:41 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:46847 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727558AbfKHVKk (ORCPT ); Fri, 8 Nov 2019 16:10:40 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1M1Hi8-1iVvbf1voI-002mbB; Fri, 08 Nov 2019 22:09:53 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Tony Luck , Fenghua Yu , Greentime Hu , Vincent Chen , "David S. Miller" , Jeff Dike , Richard Weinberger , Anton Ivanov , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , "H. Peter Anvin" , Vincenzo Frascino , linux-ia64@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org Subject: [PATCH 04/23] y2038: vdso: change timespec to __kernel_old_timespec Date: Fri, 8 Nov 2019 22:07:24 +0100 Message-Id: <20191108210824.1534248-4-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:iUMTIn2k//jQuPHzBKv9Ib37q4ViI/mNhqZJ57OBwpcBl5lp/uG Yxus14+SjobKprmmaeZD4XxB2BIGkXNAexaoLA2+T3M+IBa0dDbE8j0r6GxPuFfPxpOPrpm NIxvHXrIah5Flb1U5qno5OLifcJ6ykGJnfi2sXO7PX5fpadwCVTpT5nnMW5995xwvOvNpQs Q31uAIy0/wP9Ysu2CzPRA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:KV//2V92wyo=:Skk32CYuicSxZZPRFkUmgX of8r2viVfQmq0LSYcMd5JsyQ7bzAea6olG150FsN7SU+t3ElN2w1rxq6FusqtKA+yf16rXESX Dt3PochsKFpKQc9csS53CyT34DoP887CohItB8UbmqrsVYl6HpeXYh2LJHFjcPYPmWJWMJBuI iU2Jw4dVS7WxPNmGyRHjAO/V/0XB+O10dTNADW5qp/Akc9JHggrhF7a33CM2G0ndH36+9jkqV 88Wgo6sZ47FqKryV14wGHcalWv5zn3tfzK+70Wc8aFhuusyAEVf7SYPLMU28ahn7nnEWH2HCK BPNxBjz0PhANbnRcMayu1kL6sdbPyykKsCc3ytzsIl8gupa3mBzPp3u/SiBqde8pqWPqpdJ7W G0mnyPE0Wa9Qnp38/dkA10CPrnu6m5+1xgcc49OGU6vRHj4MI83ouXumW1Sly+zsREM235j8C u/7Lqq2mLg2Oi2m2erPdo2GPygqXcIeXiFGW/snVHW+AYTRwudN3gjSa/BWSjjvlSbutcN6HY DdHZf8kl7aW+DKNARzGoD7vuxXvHSyZdkbUhhFRZuSclmQaUGRsxLxdORyCUqgX6HedA6D0Qh MViltzh9TOF8ume4tvJxUED11YP3bKS2mse7XLgHWw7LV48lxKKQZRA7S1xUuiZccCel4qHh3 dj5xgRCPrUMvgmVjhURd2n9M3FxIJ2ZzH5qd5uYUut/3jFnjg1k34wqehASZm5vlvnYQYKE7J RndaRjEV6PP3hlZd8cg15A6gWFIvkB0qGq8LMyCl490dGt8bdTLt+ST9tnFQSobtkyOrgAwd/ DnmI4hzELiV+kqV0nNu3InzQoynFlUdwFNiz0BqNNvVmWTL79UBboap6x7/StzeJZmnz5qelL izN88dGZmM8O8Tt7Quaw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to remove 'timespec' completely from the kernel, all internal uses should be converted to a y2038-safe type, while those that are only for compatibity with existing user space should be marked appropriately. Change vdso to use __kernel_old_timespec in order to avoid the deprecated type and mark these interfaces as outdated. Signed-off-by: Arnd Bergmann --- arch/ia64/kernel/asm-offsets.c | 2 +- arch/nds32/kernel/vdso/gettimeofday.c | 22 +++++++++++----------- arch/sparc/vdso/vclock_gettime.c | 24 ++++++++++++------------ arch/x86/um/vdso/um_vdso.c | 4 ++-- 4 files changed, 26 insertions(+), 26 deletions(-) -- 2.20.0 diff --git a/arch/ia64/kernel/asm-offsets.c b/arch/ia64/kernel/asm-offsets.c index 00e8e2a1eb19..fb0deb8a4221 100644 --- a/arch/ia64/kernel/asm-offsets.c +++ b/arch/ia64/kernel/asm-offsets.c @@ -211,7 +211,7 @@ void foo(void) offsetof (struct cpuinfo_ia64, ptce_stride)); BLANK(); DEFINE(IA64_TIMESPEC_TV_NSEC_OFFSET, - offsetof (struct timespec, tv_nsec)); + offsetof (struct __kernel_old_timespec, tv_nsec)); DEFINE(IA64_TIME_SN_SPEC_SNSEC_OFFSET, offsetof (struct time_sn_spec, snsec)); diff --git a/arch/nds32/kernel/vdso/gettimeofday.c b/arch/nds32/kernel/vdso/gettimeofday.c index 1e69fd5b067b..687abc7145f5 100644 --- a/arch/nds32/kernel/vdso/gettimeofday.c +++ b/arch/nds32/kernel/vdso/gettimeofday.c @@ -48,9 +48,9 @@ static notrace int vdso_read_retry(const struct vdso_data *vdata, u32 start) } static notrace long clock_gettime_fallback(clockid_t _clkid, - struct timespec *_ts) + struct __kernel_old_timespec *_ts) { - register struct timespec *ts asm("$r1") = _ts; + register struct __kernel_old_timespec *ts asm("$r1") = _ts; register clockid_t clkid asm("$r0") = _clkid; register long ret asm("$r0"); @@ -63,7 +63,7 @@ static notrace long clock_gettime_fallback(clockid_t _clkid, return ret; } -static notrace int do_realtime_coarse(struct timespec *ts, +static notrace int do_realtime_coarse(struct __kernel_old_timespec *ts, struct vdso_data *vdata) { u32 seq; @@ -78,7 +78,7 @@ static notrace int do_realtime_coarse(struct timespec *ts, return 0; } -static notrace int do_monotonic_coarse(struct timespec *ts, +static notrace int do_monotonic_coarse(struct __kernel_old_timespec *ts, struct vdso_data *vdata) { struct timespec tomono; @@ -115,7 +115,7 @@ static notrace inline u64 vgetsns(struct vdso_data *vdso) return ((u64) cycle_delta & vdso->cs_mask) * vdso->cs_mult; } -static notrace int do_realtime(struct timespec *ts, struct vdso_data *vdata) +static notrace int do_realtime(struct __kernel_old_timespec *ts, struct vdso_data *vdata) { unsigned count; u64 ns; @@ -133,7 +133,7 @@ static notrace int do_realtime(struct timespec *ts, struct vdso_data *vdata) return 0; } -static notrace int do_monotonic(struct timespec *ts, struct vdso_data *vdata) +static notrace int do_monotonic(struct __kernel_old_timespec *ts, struct vdso_data *vdata) { struct timespec tomono; u64 nsecs; @@ -158,7 +158,7 @@ static notrace int do_monotonic(struct timespec *ts, struct vdso_data *vdata) return 0; } -notrace int __vdso_clock_gettime(clockid_t clkid, struct timespec *ts) +notrace int __vdso_clock_gettime(clockid_t clkid, struct __kernel_old_timespec *ts) { struct vdso_data *vdata; int ret = -1; @@ -191,10 +191,10 @@ notrace int __vdso_clock_gettime(clockid_t clkid, struct timespec *ts) } static notrace int clock_getres_fallback(clockid_t _clk_id, - struct timespec *_res) + struct __kernel_old_timespec *_res) { register clockid_t clk_id asm("$r0") = _clk_id; - register struct timespec *res asm("$r1") = _res; + register struct __kernel_old_timespec *res asm("$r1") = _res; register int ret asm("$r0"); asm volatile ("movi $r15, %3\n" @@ -206,7 +206,7 @@ static notrace int clock_getres_fallback(clockid_t _clk_id, return ret; } -notrace int __vdso_clock_getres(clockid_t clk_id, struct timespec *res) +notrace int __vdso_clock_getres(clockid_t clk_id, struct __kernel_old_timespec *res) { struct vdso_data *vdata = __get_datapage(); @@ -248,7 +248,7 @@ static notrace inline int gettimeofday_fallback(struct __kernel_old_timeval *_tv notrace int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) { - struct timespec ts; + struct __kernel_old_timespec ts; struct vdso_data *vdata; int ret; diff --git a/arch/sparc/vdso/vclock_gettime.c b/arch/sparc/vdso/vclock_gettime.c index a20c5030578d..e794edde6755 100644 --- a/arch/sparc/vdso/vclock_gettime.c +++ b/arch/sparc/vdso/vclock_gettime.c @@ -63,7 +63,7 @@ notrace static __always_inline struct vvar_data *get_vvar_data(void) return (struct vvar_data *) ret; } -notrace static long vdso_fallback_gettime(long clock, struct timespec *ts) +notrace static long vdso_fallback_gettime(long clock, struct __kernel_old_timespec *ts) { register long num __asm__("g1") = __NR_clock_gettime; register long o0 __asm__("o0") = clock; @@ -144,7 +144,7 @@ notrace static __always_inline u64 vgetsns_stick(struct vvar_data *vvar) } notrace static __always_inline int do_realtime(struct vvar_data *vvar, - struct timespec *ts) + struct __kernel_old_timespec *ts) { unsigned long seq; u64 ns; @@ -164,7 +164,7 @@ notrace static __always_inline int do_realtime(struct vvar_data *vvar, } notrace static __always_inline int do_realtime_stick(struct vvar_data *vvar, - struct timespec *ts) + struct __kernel_old_timespec *ts) { unsigned long seq; u64 ns; @@ -184,7 +184,7 @@ notrace static __always_inline int do_realtime_stick(struct vvar_data *vvar, } notrace static __always_inline int do_monotonic(struct vvar_data *vvar, - struct timespec *ts) + struct __kernel_old_timespec *ts) { unsigned long seq; u64 ns; @@ -204,7 +204,7 @@ notrace static __always_inline int do_monotonic(struct vvar_data *vvar, } notrace static __always_inline int do_monotonic_stick(struct vvar_data *vvar, - struct timespec *ts) + struct __kernel_old_timespec *ts) { unsigned long seq; u64 ns; @@ -224,7 +224,7 @@ notrace static __always_inline int do_monotonic_stick(struct vvar_data *vvar, } notrace static int do_realtime_coarse(struct vvar_data *vvar, - struct timespec *ts) + struct __kernel_old_timespec *ts) { unsigned long seq; @@ -237,7 +237,7 @@ notrace static int do_realtime_coarse(struct vvar_data *vvar, } notrace static int do_monotonic_coarse(struct vvar_data *vvar, - struct timespec *ts) + struct __kernel_old_timespec *ts) { unsigned long seq; @@ -251,7 +251,7 @@ notrace static int do_monotonic_coarse(struct vvar_data *vvar, } notrace int -__vdso_clock_gettime(clockid_t clock, struct timespec *ts) +__vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts) { struct vvar_data *vvd = get_vvar_data(); @@ -275,11 +275,11 @@ __vdso_clock_gettime(clockid_t clock, struct timespec *ts) return vdso_fallback_gettime(clock, ts); } int -clock_gettime(clockid_t, struct timespec *) +clock_gettime(clockid_t, struct __kernel_old_timespec *) __attribute__((weak, alias("__vdso_clock_gettime"))); notrace int -__vdso_clock_gettime_stick(clockid_t clock, struct timespec *ts) +__vdso_clock_gettime_stick(clockid_t clock, struct __kernel_old_timespec *ts) { struct vvar_data *vvd = get_vvar_data(); @@ -311,7 +311,7 @@ __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) if (likely(vvd->vclock_mode != VCLOCK_NONE)) { if (likely(tv != NULL)) { union tstv_t { - struct timespec ts; + struct __kernel_old_timespec ts; struct __kernel_old_timeval tv; } *tstv = (union tstv_t *) tv; do_realtime(vvd, &tstv->ts); @@ -347,7 +347,7 @@ __vdso_gettimeofday_stick(struct __kernel_old_timeval *tv, struct timezone *tz) if (likely(vvd->vclock_mode != VCLOCK_NONE)) { if (likely(tv != NULL)) { union tstv_t { - struct timespec ts; + struct __kernel_old_timespec ts; struct __kernel_old_timeval tv; } *tstv = (union tstv_t *) tv; do_realtime_stick(vvd, &tstv->ts); diff --git a/arch/x86/um/vdso/um_vdso.c b/arch/x86/um/vdso/um_vdso.c index 845336c11364..371724cf70da 100644 --- a/arch/x86/um/vdso/um_vdso.c +++ b/arch/x86/um/vdso/um_vdso.c @@ -13,7 +13,7 @@ #include #include -int __vdso_clock_gettime(clockid_t clock, struct timespec *ts) +int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts) { long ret; @@ -22,7 +22,7 @@ int __vdso_clock_gettime(clockid_t clock, struct timespec *ts) return ret; } -int clock_gettime(clockid_t, struct timespec *) +int clock_gettime(clockid_t, struct __kernel_old_timespec *) __attribute__((weak, alias("__vdso_clock_gettime"))); int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) From patchwork Fri Nov 8 21:07:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178968 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3283908ilf; Fri, 8 Nov 2019 13:11:10 -0800 (PST) X-Google-Smtp-Source: APXvYqxHhdd4TASzksWvZ8DxvNi0FuvLyNICmmbXXWbx0nddRP44sfd3RyrqnormpN/+AFbGqXbq X-Received: by 2002:a05:6402:1250:: with SMTP id l16mr12671981edw.219.1573247470201; Fri, 08 Nov 2019 13:11:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247470; cv=none; d=google.com; s=arc-20160816; b=utoDqlZz88gfnCC2zeCL6IE7zY25kv9v+i6+Of63LgtLnf3qdQ+9kaQdeKEov5apHL wqQoj+vf5YerFpV0yba+k40k2mtppiwT5ExrLhZolesV8cyEMqodLpsF44W7fuB2nUiX NGwZT3shaO9WIezVM/6EF2YKEpU+RCL1JZD9IfrY/KqBj7YeOZMq0DDFQX3llf1UUdQ/ VvAEl0q1fO3cqzumOM+9lkytGk3KnI+lToYV+Z+mWLNfVlND1DUnGowOI74pT+t3+R4Y W567YliKo7lRSNVOf6dxKHoOZASpSSNF8fAZ08qIpBxFU5h4EiAaQ8pBDR/bkoRL0/nk T5iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=qLjUahYTthBYbRGotnYx/LS444dTxHI+GoahCpn6OXY=; b=Bs+GHCjGV6rgfmi8NSImjm8mOFi/gZ1K+Lw3ubml1SfexlTc46qkxnxJT0ZFNgciim tzkZubt20oY+EJX/Zr2Yx/I+h4wLsvIXVe+leKaVMLjNfyTyvrjSd8Rval6gvPKSuwF8 pnRVbgdApbRubVDEiU1l8NpZ7bY5NOXSQlg5oSeAQZFThi6HXjtn6LzMMa/QxRiRPy9B NmhBxZrN5ycNdATdxeqlcKPu2AiOHQ1kHbTP0s9RPVS+bJE8e/afiAQwXaU9P3Aiwm86 CCAdn933DljIwjvCtd2SLT7jHKNIgXKZJuCeV3n+iFHzVAjRw1fFL0MFDj4kIs4f76fe SD6w== 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 p11si4536285ejz.98.2019.11.08.13.11.09; Fri, 08 Nov 2019 13:11:10 -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 S1732533AbfKHVLH (ORCPT + 26 others); Fri, 8 Nov 2019 16:11:07 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:58533 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731386AbfKHVLF (ORCPT ); Fri, 8 Nov 2019 16:11:05 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MrQR7-1i6FJk2Bdf-00oUk0; Fri, 08 Nov 2019 22:10:27 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, Jeff Dike , Richard Weinberger , Anton Ivanov , Vincenzo Frascino Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , "H. Peter Anvin" , linux-um@lists.infradead.org Subject: [PATCH 05/23] y2038: vdso: change time_t to __kernel_old_time_t Date: Fri, 8 Nov 2019 22:07:25 +0100 Message-Id: <20191108210824.1534248-5-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:o8Zkr+sOZ52wm0ae45/RQryAsK7xYXnsT+HPUpQaufkmPH+Q6/t Mx1QjONjSFAcKcXg6d+qmIO5Nz2Z1PzDnxY6Ir3M0ox/+vbOAVauXJZo7+cMsdRcRszJBe7 Aj8ZN5RLd1R69CpmSVEU9MTURTureJNFvVMuvJJDqIIb4Y4IhYa+4XE+s6Ccc/3w7U5VVCC UD2jKhDgaH7FjqUd1a5VA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:1Ts/01x3JdM=:/uunyXLl4bvJWCavpfEcb/ 9UoHBVyzqBkcj75fodAjDhjhAyjHi2SMlxz2uJbRFRUmXsG6e6eAogVfcdfts7c47d1reojiA KrgDDY253RADofyZtnh5viCrKGzvxm4TKGABjrnBJ0bt1w3KfIWjCYWav1trSnZDSOZooRHfO WWwwqG5TUQys5Sv+D10PdDh1BmV1PkR0uQvqi3CJd4F1tM+ZGkEG/J9xbVfFsiF8+0dbqDPUQ hr3zgVglY92iRK6SwZ3FDgYMfVogf9R2bfVq1QDRbmGdrtFL2VujlHW7nH5WANGKBkOXxZHrO gXnN2qQQM31mucJGqTVaHLg+IF8tEGR7WvtN5gFD771I0OsvEOSfwY4xnWz6Z8mPCLoTrrfg0 iO1f2ahEO0l71Q3MDRR9pChW632vnUMGqXR0Ky4OTVKsj1JqLoKg32dGg6Nf2QnNk4+i5Nn4N 8P3pt9RnLY3nZ8uRAevHKgNdEPEzkueh4uRRA1fLHzn7oheQgyQ958Xc84M2+/zWIdm4pq7h/ ReSWhlc/Z0PIHrf6SCL/pkAUlTZ0nXkqcG2+JlONuaSiCIQ1UBPDIwAPipVV24b3qpbmW4+uZ ELTyVt3T3AirdIi6KcrlMebb/OnK4+Dpa2LEw92WHUcZ8wj70YTk2UptblgI1j60iH9hZBR7V DB3kobMcaX8Q7kGMdND8zIaTooRs/2vF0yOcrx4+3ujrUla+IZhROs6oWdLsansep6RTDDz3R 3oqTybQw5FsZaFfFrXLoFrDZGx9IkW9T7vaKNmv/iEf/bxmME60Q+D50eSBPH5cE5flykxY1y 89ZLtDAK60bylXgCvCP2fF5he1cpwrsVM+CNavdYFN4bEulPNhEaj7Ri0q4m9ntK04XxaoFqh BWMSp+QkU2j1ZURv5T0w== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Only x86 uses the 'time' syscall in vdso, so change that to __kernel_old_time_t as a preparation for removing 'time_t' and '__kernel_time_t' later. Signed-off-by: Arnd Bergmann --- arch/x86/entry/vdso/vclock_gettime.c | 6 +++--- arch/x86/entry/vsyscall/vsyscall_64.c | 2 +- arch/x86/um/vdso/um_vdso.c | 4 ++-- lib/vdso/gettimeofday.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) -- 2.20.0 Reviewed-by: Thomas Gleixner diff --git a/arch/x86/entry/vdso/vclock_gettime.c b/arch/x86/entry/vdso/vclock_gettime.c index d9ff616bb0f6..7d70935b6758 100644 --- a/arch/x86/entry/vdso/vclock_gettime.c +++ b/arch/x86/entry/vdso/vclock_gettime.c @@ -15,7 +15,7 @@ #include "../../../../lib/vdso/gettimeofday.c" extern int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz); -extern time_t __vdso_time(time_t *t); +extern __kernel_old_time_t __vdso_time(__kernel_old_time_t *t); int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) { @@ -25,12 +25,12 @@ int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) int gettimeofday(struct __kernel_old_timeval *, struct timezone *) __attribute__((weak, alias("__vdso_gettimeofday"))); -time_t __vdso_time(time_t *t) +__kernel_old_time_t __vdso_time(__kernel_old_time_t *t) { return __cvdso_time(t); } -time_t time(time_t *t) __attribute__((weak, alias("__vdso_time"))); +__kernel_old_time_t time(__kernel_old_time_t *t) __attribute__((weak, alias("__vdso_time"))); #if defined(CONFIG_X86_64) && !defined(BUILD_VDSO32_64) diff --git a/arch/x86/entry/vsyscall/vsyscall_64.c b/arch/x86/entry/vsyscall/vsyscall_64.c index 76e62bcb8d87..bba5bfdb2a56 100644 --- a/arch/x86/entry/vsyscall/vsyscall_64.c +++ b/arch/x86/entry/vsyscall/vsyscall_64.c @@ -194,7 +194,7 @@ bool emulate_vsyscall(unsigned long error_code, break; case 1: - if (!write_ok_or_segv(regs->di, sizeof(time_t))) { + if (!write_ok_or_segv(regs->di, sizeof(__kernel_old_time_t))) { ret = -EFAULT; goto check_fault; } diff --git a/arch/x86/um/vdso/um_vdso.c b/arch/x86/um/vdso/um_vdso.c index 371724cf70da..2112b8d14668 100644 --- a/arch/x86/um/vdso/um_vdso.c +++ b/arch/x86/um/vdso/um_vdso.c @@ -37,7 +37,7 @@ int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) int gettimeofday(struct __kernel_old_timeval *, struct timezone *) __attribute__((weak, alias("__vdso_gettimeofday"))); -time_t __vdso_time(time_t *t) +__kernel_old_time_t __vdso_time(__kernel_old_time_t *t) { long secs; @@ -47,7 +47,7 @@ time_t __vdso_time(time_t *t) return secs; } -time_t time(time_t *t) __attribute__((weak, alias("__vdso_time"))); +__kernel_old_time_t time(__kernel_old_time_t *t) __attribute__((weak, alias("__vdso_time"))); long __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused) diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index 45f57fd2db64..9ecfd3b547ba 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -164,10 +164,10 @@ __cvdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) } #ifdef VDSO_HAS_TIME -static __maybe_unused time_t __cvdso_time(time_t *time) +static __maybe_unused __kernel_old_time_t __cvdso_time(__kernel_old_time_t *time) { const struct vdso_data *vd = __arch_get_vdso_data(); - time_t t = READ_ONCE(vd[CS_HRES_COARSE].basetime[CLOCK_REALTIME].sec); + __kernel_old_time_t t = READ_ONCE(vd[CS_HRES_COARSE].basetime[CLOCK_REALTIME].sec); if (time) *time = t; From patchwork Fri Nov 8 21:07:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178965 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3283326ilf; Fri, 8 Nov 2019 13:10:41 -0800 (PST) X-Google-Smtp-Source: APXvYqzk8Zr2889fBj5Ib6cofgtLMFk4p9o6rxqVSas7omTy5EbsBYLLpFnjrh3QboqMSHMPVA2Z X-Received: by 2002:aa7:c6c9:: with SMTP id b9mr12631939eds.1.1573247441602; Fri, 08 Nov 2019 13:10:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247441; cv=none; d=google.com; s=arc-20160816; b=mEKixD6j04RBHJ5i8FZGTmiu4bA75KvXILm8ZNU8nGWBkOFv7oO88dVDIpFxi4Z1RI aUEkPp7WIEd4h3TpNY9pKrkJiiq1d6tZIcdrNaMdXdjBkrXYi4LWJvelWsAbERw1QlWl Ed1EIXJEBQT4M8RhPXHsXWE3GmcQGVk6vF1bUGSE3YyC2D38UL6fxHlttMAKzI5SF5j8 vFOH8Dd7FyAEDEDC3fUz0udcDcwfz3m/B/ReIB1kE8rJAyH/1yq48XPPlq0NIA3mP+rS nzfAzlAdqUVJQ8/gGQwvVfLkQIjWuqbPOsvpZ81iD+ibF6z55ObEw7CV0xYlvBqKtxd3 lV6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8PuORsoHACnpcO/lkXG5hkW1+8J+sLJGS2MQ4hsOa70=; b=qivswwWs26vLKOdy0QSpH/fJglVoAivc3AiZQrgsact60ANPx5yGF1+VwXBByZB0YQ YzU3Exdn3Ee8Iwop67UylNXMdBmbRTuxShxgf6s4F8x0HXLnAV2orLQhkZPa3PLDBmx6 LZfXSiEZtFOOq2wH0LctxScdKx6KXz7c9fIbxNf+t3/eC4PoVdQHfs2esAeY7ElUf64d LwfQYQQxBNY5zdK+KP/GApbWFE/hpxJSn/CTN2dA2IpoM3cs05p/IJsCYdsHqgolmpuM RL5kmiN2hnlVRfUmQzKt78TmMkHeHWZ2QeIn2+Sgvy8aP9xLN6jWFfVfpvol+AP0by6L zMtg== 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 k35si5264494edb.84.2019.11.08.13.10.41; Fri, 08 Nov 2019 13:10:41 -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 S1731945AbfKHVKi (ORCPT + 26 others); Fri, 8 Nov 2019 16:10:38 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:40383 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727558AbfKHVKh (ORCPT ); Fri, 8 Nov 2019 16:10:37 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MvJwN-1hbuBO0HpZ-00rIaY; Fri, 08 Nov 2019 22:10:35 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Greentime Hu , Vincent Chen Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Vincenzo Frascino Subject: [PATCH 06/23] y2038: vdso: nds32: open-code timespec_add_ns() Date: Fri, 8 Nov 2019 22:07:26 +0100 Message-Id: <20191108210824.1534248-6-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:YuJmh0hdaoXKPB496OqQwH5zF3mK0xLxqrenBpCosELtgojDeG6 0ydOvFj7+DITM/cL850c75HGzUSrstupuG0x40X8tVSgqOJJEzjQoFnTixpW6lIarskuNf3 8p9iwlohOgg5Ic09T3K1Xsm5JNORDInkJ0iuOX2hm3SuHbgw32nVkc0sU5iORDrl13FAf2d NDuF1g3kxV+9ZuX/vNNUA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:W7ipudwxVNs=:i23o+CyoqGzloOAK6blQ7L H0nBM6ZEN0Zz8/3kx0MorJxywha7JE8NNOPLmX8OSej99FDv/kuAjpwHE6gav7zf1A+dTf97J gPPxe+E4J34Moz4o9ROc+e1l68aXTat3nwheFhTxO3jDCEJlbICgpoB95HVxxeDDC7L0bYt3I aVknHQ3wLXIJUnQN0Zk+J9TQyqpq2GHFlj+WA5/PQbsE8ZFqCvF87mzNZjoImu7viL4itYUPn xVYVEo79PeD4ZrN0iTzdZ3D3TU+PzDSM4YEAcekYxv8OPsG6ua2LBAg/QBAxCll1kJA4CRMv7 6SPdy4TF0ym+xNZ+1uPxXAlyXJJ0dwHsfeffms8Z3HWZC+521wLxBYhTj0qErNqxNUXoxwKiZ J0gZec1g3FfSuw/+eUkyjFW/awCWr3rKLhP+FTBqQLhGf2Pf5j1+b+xJM+mNMbgE+j3rf47pX xwPgZFdphFgoUpmjLSWDmvUzheodPhJi9mS9JuLp90v33vGzT33E8VwE+SplX5rp8JOLQQ1YG UWrFZ2vpTi3vLFKP52pnKVODkYiTYr4lavfLqfXFzL/4iqSwxL1cV3LwFRB9xNyQcCUeHdd3o TNZ02u6yXaC475jY/OpDb8KcBx1NQvUUZ9FzoOinV1AgR92jJsBvNqm3VIbyHg50NbTUgwXd4 +/OEgMRJMwURcdcMenvbgLm12/UGdJrQEoifs1mU2M5IldNTtrPmv4NrYV87pj4Ft5ItgyRs5 XNUTzZwxVGmif6tUMojrweawqqLfcRdW5h/witqeF0KQdoSbpRLN1wXvOh85s5T3Bt9flDh3P xwx3dSKCVt117fCza5IlcVAfqreCo6kVwaFVVfY4huHvhnbf9ydVEHZpRevXylWyEXIpsJ5mz tdlbq72Zg/YV+Dtf8ZFA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The nds32 vdso is now the last user of the deprecated timespec_add_ns(). Change it to an open-coded version like the one it already uses in do_realtime(). What we should really do though is to use the generic vdso implementation that is now used in x86. arm and mips. Signed-off-by: Arnd Bergmann --- arch/nds32/kernel/vdso/gettimeofday.c | 33 ++++++++++++--------------- 1 file changed, 15 insertions(+), 18 deletions(-) -- 2.20.0 diff --git a/arch/nds32/kernel/vdso/gettimeofday.c b/arch/nds32/kernel/vdso/gettimeofday.c index 687abc7145f5..9ec03cf0ec54 100644 --- a/arch/nds32/kernel/vdso/gettimeofday.c +++ b/arch/nds32/kernel/vdso/gettimeofday.c @@ -81,22 +81,20 @@ static notrace int do_realtime_coarse(struct __kernel_old_timespec *ts, static notrace int do_monotonic_coarse(struct __kernel_old_timespec *ts, struct vdso_data *vdata) { - struct timespec tomono; u32 seq; + u64 ns; do { seq = vdso_read_begin(vdata); - ts->tv_sec = vdata->xtime_coarse_sec; - ts->tv_nsec = vdata->xtime_coarse_nsec; - - tomono.tv_sec = vdata->wtm_clock_sec; - tomono.tv_nsec = vdata->wtm_clock_nsec; + ts->tv_sec = vdata->xtime_coarse_sec + vdata->wtm_clock_sec; + ns = vdata->xtime_coarse_nsec + vdata->wtm_clock_nsec; } while (vdso_read_retry(vdata, seq)); - ts->tv_sec += tomono.tv_sec; - timespec_add_ns(ts, tomono.tv_nsec); + ts->tv_sec += __iter_div_u64_rem(ns, NSEC_PER_SEC, &ns); + ts->tv_nsec = ns; + return 0; } @@ -135,26 +133,25 @@ static notrace int do_realtime(struct __kernel_old_timespec *ts, struct vdso_dat static notrace int do_monotonic(struct __kernel_old_timespec *ts, struct vdso_data *vdata) { - struct timespec tomono; - u64 nsecs; + u64 ns; u32 seq; do { seq = vdso_read_begin(vdata); ts->tv_sec = vdata->xtime_clock_sec; - nsecs = vdata->xtime_clock_nsec; - nsecs += vgetsns(vdata); - nsecs >>= vdata->cs_shift; + ns = vdata->xtime_clock_nsec; + ns += vgetsns(vdata); + ns >>= vdata->cs_shift; - tomono.tv_sec = vdata->wtm_clock_sec; - tomono.tv_nsec = vdata->wtm_clock_nsec; + ts->tv_sec += vdata->wtm_clock_sec; + ns += vdata->wtm_clock_nsec; } while (vdso_read_retry(vdata, seq)); - ts->tv_sec += tomono.tv_sec; - ts->tv_nsec = 0; - timespec_add_ns(ts, nsecs + tomono.tv_nsec); + ts->tv_sec += __iter_div_u64_rem(ns, NSEC_PER_SEC, &ns); + ts->tv_nsec = ns; + return 0; } From patchwork Fri Nov 8 21:07:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178969 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3284260ilf; Fri, 8 Nov 2019 13:11:28 -0800 (PST) X-Google-Smtp-Source: APXvYqyUHcmv/MHQejV60y+mG+vJra6EjvLL66fZrrZnoPFzCkqsz3F4PNphKVrhrqz3Ob0AEBos X-Received: by 2002:aa7:d499:: with SMTP id b25mr12753163edr.64.1573247488038; Fri, 08 Nov 2019 13:11:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247488; cv=none; d=google.com; s=arc-20160816; b=Vi6rEUIrdhd257tkapqxvpwOKocPebEnFsKfAcZuEaef5z/8PCLBauLNddEnnrctz/ HsWSMLk6sVu5TlZ12993zojIwBfmhUsARtDyl929aKOmpemXoMyBawSoWmZYbEcGl8wS FtGVJeNLj/jdckyDCLmnQIJwBTElvhnd7i2KlkD2f/cE2zzbX2bS4A5w7HxqzMYirU3X KklJ/nozE+Q1mRfAx+inA/Vuq3Vw9/s8z/VqoEPT7g7ri7+Yi7R+pkzIud3CiHFP2Kyc W/KEQ6MS96d7QKh82vmwpksgVc+5fq12jgVPXNk5mZ0TcI69lihpaQqk8Utxk+llGnxM wxPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=iFrNvqUnx18Wefo+ycNi6WlF/UuaAFs/7F9zVuJIR74=; b=tCqbUJ4023+y2JJmH76M78DXHhIGH65xbpoyUoA9ooDd6c6ApUEcWwVPm0OcvUkAJ5 yZIXld5kqsSIB0OYITSnLXaqQTX/gQA8mY3RQwY6kDL4xTowmY3ek/b2lMLBv+3Mg0gD 7fTA79nywTw06EqjUugvhbcAhOHiJANhkoiZ1E3rAqyt13k6mqClv5xmJ9DRS/+TSLD9 BHtd9gDvK4LaUsf5eg+wgT1Kjht5JMww1ASG9drsiuAS8ONjpdbaH/c1A58yYy7KxonY FepvAA2NRuhkgcDg9A5N3FyEmTOYJalc3wi+9YKjFrYEmPVu+zhSC7YqcVE/PNg5Ggpa ZNlA== 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 bo7si4592913ejb.15.2019.11.08.13.11.27; Fri, 08 Nov 2019 13:11:28 -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 S1732573AbfKHVLY (ORCPT + 26 others); Fri, 8 Nov 2019 16:11:24 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:56197 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726349AbfKHVLX (ORCPT ); Fri, 8 Nov 2019 16:11:23 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MOzGc-1iGzm719gK-00PNQ7; Fri, 08 Nov 2019 22:11:03 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Greg Kroah-Hartman , Thomas Gleixner , Allison Randal , Christophe Leroy , Nicholas Piggin , linuxppc-dev@lists.ozlabs.org Subject: [PATCH 07/23] y2038: vdso: powerpc: avoid timespec references Date: Fri, 8 Nov 2019 22:07:27 +0100 Message-Id: <20191108210824.1534248-7-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:lx86RfWyo1UtJmp56v0swjpp1ZWdSL3mM/CF24wl/EwN3VfO2KR j/eJXK26jFhg4VDBKMZnBKXvjJlTnXuhBv4X0pvatFTBWnn4TEN4bPDkd7iYKgHePuxM/tb wUwHYFsQXBh0x5JEX0SRRQIXE1SdA3wsE47PhksU0OV5C8D0xBjkRrcfg736jm6VFDtgqS3 3QIN7Q4EkUAp7uOhcSRpA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Rd/L+EZnQb0=:UjleirH8JG1dR2gQl/Q6DR GOM0RkhxTsPJjHfHyivo5x41Frwviz6le8FWEzShs/U2Ro/kGU+xvA8mN+yEU2nIEEg3jDcY/ c5h2VbhNuKgzzRJJUwUjUx3xltr2qfbQCpGK7KjkXPlTPds/XqqiFPxHnE+0r2c4qOVP4jmP7 WwanXtBSlBsEbvLuHq8Hoovn74Ocz54mpPGVpF4Kq66XuWBuCPJMVaJfo7ULJ3i1xOxSnVX3v KbHID6hOzNJieoF2OZkYkhdL7kvpEbwBXAVDQDHMNK5nyYpRmp/6rXp97HYGcm3lAjdfRCmNd iKGTvwcgR4BD4R7NrJ6uq3V9Wl4TJDo6ouEcPv8QnnHZLfgpJ5WWvXodkkxf3pMabfvOAgDec hretNvCjx1E6sWSljXS7Cj/BykZTI6OSLvwDL/rfsF/8+0erJYRNFa1pg6wc/RszUhPdC3lIh 9f5iUfY64HtC4d8ZCP0MxCzKpwq795IWhcW6UEBQzjdDTLq3VMaaLFICBwOGbomGeJtZbUB5f tszDN2uLLaHuc7KmVnlZC+JphbuaI3r6M3ZogEpLcC9QVcrNNl1EeYnGmVYJW032U0WA1p2Np rocuQR0wc8PQeKTGBifdtFBaiuxb+d6uBmhy1Th7HAYjo6pZWfCE4aBLPsalPKfJ5uyVZRN8S FAvLzEts8YFMQ3VgVsAaPV4leRizzFM6abySu+NXDp3N1KTAV8ZfC8EITaj4b/mkrjDQgEx/1 dAh6pR9cY1nbX1nEUtalVPv1n/UJvNxsa5HD7vPIR+IHSA/ecLTsBh0LKbNi1cFjZhj0Rjk6P ELCJpRpIXQirHw4bXiw+aIz4FGoVHiIv9GQmp4Ylbo0pplVtQPv/7WOUkeGuCEPqzY/Z9IQcw ywdKmC+WhY23VmlASp5Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As a preparation to stop using 'struct timespec' in the kernel, change the powerpc vdso implementation: - split up the vdso data definition to have equivalent members for seconds and nanoseconds instead of an xtime structure - use timespec64 as an intermediate for the xtime update - change the asm-offsets definition to be based the appropriate fixed-length types This is only a temporary fix for changing the types, in order to actually support a 64-bit safe vdso32 version of clock_gettime(), the entire powerpc vdso should be replaced with the generic lib/vdso/ implementation. If that happens first, this patch becomes obsolete. Signed-off-by: Arnd Bergmann --- arch/powerpc/include/asm/vdso_datapage.h | 6 ++++-- arch/powerpc/kernel/asm-offsets.c | 14 +++++--------- arch/powerpc/kernel/time.c | 5 +++-- arch/powerpc/kernel/vdso32/gettimeofday.S | 6 ++---- arch/powerpc/kernel/vdso64/gettimeofday.S | 8 ++++---- 5 files changed, 18 insertions(+), 21 deletions(-) -- 2.20.0 diff --git a/arch/powerpc/include/asm/vdso_datapage.h b/arch/powerpc/include/asm/vdso_datapage.h index c61d59ed3b45..a115970a6809 100644 --- a/arch/powerpc/include/asm/vdso_datapage.h +++ b/arch/powerpc/include/asm/vdso_datapage.h @@ -81,7 +81,8 @@ struct vdso_data { __u32 stamp_sec_fraction; /* fractional seconds of stamp_xtime */ __s32 wtom_clock_nsec; /* Wall to monotonic clock nsec */ __s64 wtom_clock_sec; /* Wall to monotonic clock sec */ - struct timespec stamp_xtime; /* xtime as at tb_orig_stamp */ + __s64 stamp_xtime_sec; /* xtime secs as at tb_orig_stamp */ + __s64 stamp_xtime_nsec; /* xtime nsecs as at tb_orig_stamp */ __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */ __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ }; @@ -101,7 +102,8 @@ struct vdso_data { __u32 tz_dsttime; /* Type of dst correction 0x5C */ __s32 wtom_clock_sec; /* Wall to monotonic clock */ __s32 wtom_clock_nsec; - struct timespec stamp_xtime; /* xtime as at tb_orig_stamp */ + __s32 stamp_xtime_sec; /* xtime seconds as at tb_orig_stamp */ + __s32 stamp_xtime_nsec; /* xtime nsecs as at tb_orig_stamp */ __u32 stamp_sec_fraction; /* fractional seconds of stamp_xtime */ __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ __u32 dcache_block_size; /* L1 d-cache block size */ diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 827f4c354e13..f22bd6d1fe93 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c @@ -385,7 +385,8 @@ int main(void) OFFSET(CFG_SYSCALL_MAP32, vdso_data, syscall_map_32); OFFSET(WTOM_CLOCK_SEC, vdso_data, wtom_clock_sec); OFFSET(WTOM_CLOCK_NSEC, vdso_data, wtom_clock_nsec); - OFFSET(STAMP_XTIME, vdso_data, stamp_xtime); + OFFSET(STAMP_XTIME_SEC, vdso_data, stamp_xtime_sec); + OFFSET(STAMP_XTIME_NSEC, vdso_data, stamp_xtime_nsec); OFFSET(STAMP_SEC_FRAC, vdso_data, stamp_sec_fraction); OFFSET(CFG_ICACHE_BLOCKSZ, vdso_data, icache_block_size); OFFSET(CFG_DCACHE_BLOCKSZ, vdso_data, dcache_block_size); @@ -395,18 +396,13 @@ int main(void) OFFSET(CFG_SYSCALL_MAP64, vdso_data, syscall_map_64); OFFSET(TVAL64_TV_SEC, __kernel_old_timeval, tv_sec); OFFSET(TVAL64_TV_USEC, __kernel_old_timeval, tv_usec); +#endif + OFFSET(TSPC64_TV_SEC, __kernel_timespec, tv_sec); + OFFSET(TSPC64_TV_NSEC, __kernel_timespec, tv_nsec); OFFSET(TVAL32_TV_SEC, old_timeval32, tv_sec); OFFSET(TVAL32_TV_USEC, old_timeval32, tv_usec); - OFFSET(TSPC64_TV_SEC, timespec, tv_sec); - OFFSET(TSPC64_TV_NSEC, timespec, tv_nsec); OFFSET(TSPC32_TV_SEC, old_timespec32, tv_sec); OFFSET(TSPC32_TV_NSEC, old_timespec32, tv_nsec); -#else - OFFSET(TVAL32_TV_SEC, __kernel_old_timeval, tv_sec); - OFFSET(TVAL32_TV_USEC, __kernel_old_timeval, tv_usec); - OFFSET(TSPC32_TV_SEC, timespec, tv_sec); - OFFSET(TSPC32_TV_NSEC, timespec, tv_nsec); -#endif /* timeval/timezone offsets for use by vdso */ OFFSET(TZONE_TZ_MINWEST, timezone, tz_minuteswest); OFFSET(TZONE_TZ_DSTTIME, timezone, tz_dsttime); diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 694522308cd5..1fad5a04d083 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -885,7 +885,7 @@ static notrace u64 timebase_read(struct clocksource *cs) void update_vsyscall(struct timekeeper *tk) { - struct timespec xt; + struct timespec64 xt; struct clocksource *clock = tk->tkr_mono.clock; u32 mult = tk->tkr_mono.mult; u32 shift = tk->tkr_mono.shift; @@ -957,7 +957,8 @@ void update_vsyscall(struct timekeeper *tk) vdso_data->tb_to_xs = new_tb_to_xs; vdso_data->wtom_clock_sec = tk->wall_to_monotonic.tv_sec; vdso_data->wtom_clock_nsec = tk->wall_to_monotonic.tv_nsec; - vdso_data->stamp_xtime = xt; + vdso_data->stamp_xtime_sec = xt.sec; + vdso_data->stamp_xtime_nsec = xt.nsec; vdso_data->stamp_sec_fraction = frac_sec; smp_wmb(); ++(vdso_data->tb_update_count); diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S index 4327665ad86f..37ba4c3d965b 100644 --- a/arch/powerpc/kernel/vdso32/gettimeofday.S +++ b/arch/powerpc/kernel/vdso32/gettimeofday.S @@ -15,10 +15,8 @@ /* Offset for the low 32-bit part of a field of long type */ #if defined(CONFIG_PPC64) && defined(CONFIG_CPU_BIG_ENDIAN) #define LOPART 4 -#define TSPEC_TV_SEC TSPC64_TV_SEC+LOPART #else #define LOPART 0 -#define TSPEC_TV_SEC TSPC32_TV_SEC #endif .text @@ -192,7 +190,7 @@ V_FUNCTION_BEGIN(__kernel_time) bl __get_datapage@local mr r9, r3 /* datapage ptr in r9 */ - lwz r3,STAMP_XTIME+TSPEC_TV_SEC(r9) + lwz r3,STAMP_XTIME_SEC+LOWPART(r9) cmplwi r11,0 /* check if t is NULL */ beq 2f @@ -268,7 +266,7 @@ __do_get_tspec: * as a 32.32 fixed-point number in r3 and r4. * Load & add the xtime stamp. */ - lwz r5,STAMP_XTIME+TSPEC_TV_SEC(r9) + lwz r5,STAMP_XTIME_SEC+LOWPART(r9) lwz r6,STAMP_SEC_FRAC(r9) addc r4,r4,r6 adde r3,r3,r5 diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S index 07bfe33fe874..1f24e411af80 100644 --- a/arch/powerpc/kernel/vdso64/gettimeofday.S +++ b/arch/powerpc/kernel/vdso64/gettimeofday.S @@ -116,8 +116,8 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime) * CLOCK_REALTIME_COARSE, below values are needed for MONOTONIC_COARSE * too */ - ld r4,STAMP_XTIME+TSPC64_TV_SEC(r3) - ld r5,STAMP_XTIME+TSPC64_TV_NSEC(r3) + ld r4,STAMP_XTIME_SEC(r3) + ld r5,STAMP_XTIME_NSEC(r3) bne cr6,75f /* CLOCK_MONOTONIC_COARSE */ @@ -220,7 +220,7 @@ V_FUNCTION_BEGIN(__kernel_time) mr r11,r3 /* r11 holds t */ bl V_LOCAL_FUNC(__get_datapage) - ld r4,STAMP_XTIME+TSPC64_TV_SEC(r3) + ld r4,STAMP_XTIME_SEC(r3) cmpldi r11,0 /* check if t is NULL */ beq 2f @@ -265,7 +265,7 @@ V_FUNCTION_BEGIN(__do_get_tspec) mulhdu r6,r6,r5 /* in units of 2^-32 seconds */ /* Add stamp since epoch */ - ld r4,STAMP_XTIME+TSPC64_TV_SEC(r3) + ld r4,STAMP_XTIME_SEC(r3) lwz r5,STAMP_SEC_FRAC(r3) or r0,r4,r5 or r0,r0,r6 From patchwork Fri Nov 8 21:07:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178971 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3285741ilf; Fri, 8 Nov 2019 13:12:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwSP1MH3hkWqd7jTi9E2I8UjnM00JD11EhLbNFAoF7EIm2Uq2GkZMPZXk8tPbVMXKbs3f/a X-Received: by 2002:a50:b262:: with SMTP id o89mr12496527edd.170.1573247566760; Fri, 08 Nov 2019 13:12:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247566; cv=none; d=google.com; s=arc-20160816; b=fa+rv6qv29gfPU6RQiCRBz8sHN5yrTmdAHkjEk1dz4x3kwbrVYaCEcYaueVo5/7/u6 eH49fjgG2lc3hl7nU0uYZHLu+LHBWB1/ofJhwCK+AgxhHjMYFsy1BQq0xdnqu7s1g97T H4qtUulasNx7o+jeb/04qYwt54EKVybdjUJGk6bvfMAATWssHKnOPbdehnBeDo9H5bsp 3oUAl7d09T2T/8ikJoXDSd9BwmiYrKpanf9awNNVN5G1guS0XCAxiwu1LX1y2GlBITrS /ab/qQzQpVnqk1eAvcrXet8c2kHz2AY9GdZRd7Wl3BdeOeFwuXfQcONTT1kg9O248zzk M/vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=sEkrTgOXuxku6f+4a4mtMBtVn9Lvm5fLQ49nYxKV5Gs=; b=lBJyIpeMUxUH3Aek32S++428qejvwmQrJrr7KrjWN43G0hdDSEBXlyeenprQwcVrrQ 4yyKb1UPm268H4muZ2Q47YPKb2OWKcp0R0PuAxxTlwBmLEDsn8VMnzqEODvjpilcwpF4 VOrITX5aVBGyQ+XunHnoouy/5KIwj+JsWB3KjwIRsstWjYscGLhuxoRqdJYDafjvNwMQ xf/aW7sN0ZF19K9D8JCp0GEeFAGSAlZ5p2A+PsR3C93TECiDJQPyh5dia2fkbYgA69Kk rJ9wjN0kcO3JfLYRaP8gHEO/FvM9YV21HT1ZwEhl2Myp2VJk3biLinZ4hY1m4AHIfpAx nEkg== 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 n2si4644216ejz.65.2019.11.08.13.12.46; Fri, 08 Nov 2019 13:12:46 -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 S1732662AbfKHVMn (ORCPT + 26 others); Fri, 8 Nov 2019 16:12:43 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:59309 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732622AbfKHVMm (ORCPT ); Fri, 8 Nov 2019 16:12:42 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mt71D-1he6Ia3jLN-00tVVi; Fri, 08 Nov 2019 22:12:02 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Ralf Baechle , Paul Burton , James Hogan , "James E.J. Bottomley" , Helge Deller , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "David S. Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, Arnd Bergmann Cc: linux-kernel@vger.kernel.org, "H. Peter Anvin" , linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org Subject: [PATCH 08/23] y2038: ipc: remove __kernel_time_t reference from headers Date: Fri, 8 Nov 2019 22:07:28 +0100 Message-Id: <20191108210824.1534248-8-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Ovo0znhTfBciqHb5dk0y9f3n8qBGpYoN5a+fnOutVi0zwjP5IUw HjIVyFgCbCf58CGn4gwb5GNQIGmRVw5mMk8UaHe2qlr3ru5M8GkK4eRrsN2PFQIfGyB1mmZ nxJu8Pco7TO8N2iXYpgX8cHBRts25B+w8zGGR49P65oOsNPllFUrHlwNLsnOMRJh3vZ5gZn vGIyiYPc0ivZ7E/oWr5Rg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:EknCUVeDeik=:kFs35h3Qt8AyXZ2wLRCzrT YmJt6ugFf5BcZj0XVNSYiCfXF2ZKLKP597Bd2wzHGFLq2sJ7DZV79y4hPpYmK0HLEqR+4bUDo 2IrKvgJRSEDI7Y3XEidmjGen8tcGv/fr+x30rF7r+ZAQheq2HdsdfDojlmkDUegAnwv205p9J Gl3FGYDv1U+SQQhvzTlQFZ16AombosrEgM6SIAy+vL3oxygTzXrsOEHpHHw3R1PAjLFMKh3kY bCVuJ9JJEf2ypKk9q8KeJ9EjOZux0gGtaLmL5AJzUEY88C5Td6Lt/Pjn8H1sEcepIKpZXANlK YHTWE+3gmeMwsHoVO0UdLkX9iwJNbQwLVIabxORRj/p9/GIz7JEOHdd0wwjUhHpzV3Aq9pRse hWp7CEiBUvo+eQrHAhsA/5mD5WzRjVV9omb+QCWDzvyJ+RSEbiPEg5vCdpb2fQaJEPk5GxvTu iqu2lwYjL7rzSvZnnOPhAXuyWZdwsb7+GaYiR+woosbqPbUlRBpBjahjxqVUogx8l0y9/9x6q Yc+3T3lEuiX2Om2g9dt5lqFof2y519ROqQfcFkp9+e1tFTxSY0OyNnr8UGQ3hBOOGV1pOc8qg rKkhlOwNMMhf2ZfJb0Yj44txpMD/P5rCgADdR+jPj5dH8cP+6PtStusgw8h88iDe7EGQ6dDnK adJMPF6VF3ecWYvZ+lg9aD331VzTIKEy8Uv+6T0zMt3hAQQB9ZeWW9SoqUCtGOexgZb4hYtw2 RF2mIWtYV+RAkc/0XWTAKKbQLKGCvizAft3ZrkQ3TILY9WzIiY+WiJQKeLo5BpsAPucT+WhKn 8DIRQ/j+I+dkO/biVhC5KG5tcHGW1p7hcaeCuPKiTtZAyFKpfD/jm2Q6iKnEyYfx5wfzxVP3E ERJYOUdYmAa4C2oTobnQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are two structures based on time_t that conflict between libc and kernel: timeval and timespec. Both are now renamed to __kernel_old_timeval and __kernel_old_timespec. For time_t, the old typedef is still __kernel_time_t. There is nothing wrong with that name, but it would be nice to not use that going forward as this type is used almost only in deprecated interfaces because of the y2038 overflow. In the IPC headers (msgbuf.h, sembuf.h, shmbuf.h), __kernel_time_t is only used for the 64-bit variants, which are not deprecated. Change these to a plain 'long', which is the same type as __kernel_time_t on all 64-bit architectures anyway, to reduce the number of users of the old type. Signed-off-by: Arnd Bergmann --- arch/mips/include/uapi/asm/msgbuf.h | 6 +++--- arch/mips/include/uapi/asm/sembuf.h | 4 ++-- arch/mips/include/uapi/asm/shmbuf.h | 6 +++--- arch/parisc/include/uapi/asm/msgbuf.h | 6 +++--- arch/parisc/include/uapi/asm/sembuf.h | 4 ++-- arch/parisc/include/uapi/asm/shmbuf.h | 6 +++--- arch/powerpc/include/uapi/asm/msgbuf.h | 6 +++--- arch/powerpc/include/uapi/asm/sembuf.h | 4 ++-- arch/powerpc/include/uapi/asm/shmbuf.h | 6 +++--- arch/sparc/include/uapi/asm/msgbuf.h | 6 +++--- arch/sparc/include/uapi/asm/sembuf.h | 4 ++-- arch/sparc/include/uapi/asm/shmbuf.h | 6 +++--- arch/x86/include/uapi/asm/msgbuf.h | 6 +++--- arch/x86/include/uapi/asm/sembuf.h | 4 ++-- arch/x86/include/uapi/asm/shmbuf.h | 6 +++--- include/uapi/asm-generic/msgbuf.h | 12 ++++++------ include/uapi/asm-generic/sembuf.h | 7 +++---- include/uapi/asm-generic/shmbuf.h | 12 ++++++------ 18 files changed, 55 insertions(+), 56 deletions(-) -- 2.20.0 diff --git a/arch/mips/include/uapi/asm/msgbuf.h b/arch/mips/include/uapi/asm/msgbuf.h index 46aa15b13e4e..9e0c2e230274 100644 --- a/arch/mips/include/uapi/asm/msgbuf.h +++ b/arch/mips/include/uapi/asm/msgbuf.h @@ -15,9 +15,9 @@ #if defined(__mips64) struct msqid64_ds { struct ipc64_perm msg_perm; - __kernel_time_t msg_stime; /* last msgsnd time */ - __kernel_time_t msg_rtime; /* last msgrcv time */ - __kernel_time_t msg_ctime; /* last change time */ + long msg_stime; /* last msgsnd time */ + long msg_rtime; /* last msgrcv time */ + long msg_ctime; /* last change time */ unsigned long msg_cbytes; /* current number of bytes on queue */ unsigned long msg_qnum; /* number of messages in queue */ unsigned long msg_qbytes; /* max number of bytes on queue */ diff --git a/arch/mips/include/uapi/asm/sembuf.h b/arch/mips/include/uapi/asm/sembuf.h index 60c89e6cb25b..43e1b4a2f68a 100644 --- a/arch/mips/include/uapi/asm/sembuf.h +++ b/arch/mips/include/uapi/asm/sembuf.h @@ -14,8 +14,8 @@ #ifdef __mips64 struct semid64_ds { struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ - __kernel_time_t sem_otime; /* last semop time */ - __kernel_time_t sem_ctime; /* last change time */ + long sem_otime; /* last semop time */ + long sem_ctime; /* last change time */ unsigned long sem_nsems; /* no. of semaphores in array */ unsigned long __unused1; unsigned long __unused2; diff --git a/arch/mips/include/uapi/asm/shmbuf.h b/arch/mips/include/uapi/asm/shmbuf.h index 9b9bba3401f2..680bb95b2240 100644 --- a/arch/mips/include/uapi/asm/shmbuf.h +++ b/arch/mips/include/uapi/asm/shmbuf.h @@ -17,9 +17,9 @@ struct shmid64_ds { struct ipc64_perm shm_perm; /* operation perms */ size_t shm_segsz; /* size of segment (bytes) */ - __kernel_time_t shm_atime; /* last attach time */ - __kernel_time_t shm_dtime; /* last detach time */ - __kernel_time_t shm_ctime; /* last change time */ + long shm_atime; /* last attach time */ + long shm_dtime; /* last detach time */ + long shm_ctime; /* last change time */ __kernel_pid_t shm_cpid; /* pid of creator */ __kernel_pid_t shm_lpid; /* pid of last operator */ unsigned long shm_nattch; /* no. of current attaches */ diff --git a/arch/parisc/include/uapi/asm/msgbuf.h b/arch/parisc/include/uapi/asm/msgbuf.h index 6a2e9ab2ef8d..3b877335da38 100644 --- a/arch/parisc/include/uapi/asm/msgbuf.h +++ b/arch/parisc/include/uapi/asm/msgbuf.h @@ -16,9 +16,9 @@ struct msqid64_ds { struct ipc64_perm msg_perm; #if __BITS_PER_LONG == 64 - __kernel_time_t msg_stime; /* last msgsnd time */ - __kernel_time_t msg_rtime; /* last msgrcv time */ - __kernel_time_t msg_ctime; /* last change time */ + long msg_stime; /* last msgsnd time */ + long msg_rtime; /* last msgrcv time */ + long msg_ctime; /* last change time */ #else unsigned long msg_stime_high; unsigned long msg_stime; /* last msgsnd time */ diff --git a/arch/parisc/include/uapi/asm/sembuf.h b/arch/parisc/include/uapi/asm/sembuf.h index 3c31163b1241..8241cf126018 100644 --- a/arch/parisc/include/uapi/asm/sembuf.h +++ b/arch/parisc/include/uapi/asm/sembuf.h @@ -16,8 +16,8 @@ struct semid64_ds { struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ #if __BITS_PER_LONG == 64 - __kernel_time_t sem_otime; /* last semop time */ - __kernel_time_t sem_ctime; /* last change time */ + long sem_otime; /* last semop time */ + long sem_ctime; /* last change time */ #else unsigned long sem_otime_high; unsigned long sem_otime; /* last semop time */ diff --git a/arch/parisc/include/uapi/asm/shmbuf.h b/arch/parisc/include/uapi/asm/shmbuf.h index c89b3dd8db21..5da3089be65e 100644 --- a/arch/parisc/include/uapi/asm/shmbuf.h +++ b/arch/parisc/include/uapi/asm/shmbuf.h @@ -16,9 +16,9 @@ struct shmid64_ds { struct ipc64_perm shm_perm; /* operation perms */ #if __BITS_PER_LONG == 64 - __kernel_time_t shm_atime; /* last attach time */ - __kernel_time_t shm_dtime; /* last detach time */ - __kernel_time_t shm_ctime; /* last change time */ + long shm_atime; /* last attach time */ + long shm_dtime; /* last detach time */ + long shm_ctime; /* last change time */ #else unsigned long shm_atime_high; unsigned long shm_atime; /* last attach time */ diff --git a/arch/powerpc/include/uapi/asm/msgbuf.h b/arch/powerpc/include/uapi/asm/msgbuf.h index 2b1b37797a47..969bd83e4d3d 100644 --- a/arch/powerpc/include/uapi/asm/msgbuf.h +++ b/arch/powerpc/include/uapi/asm/msgbuf.h @@ -11,9 +11,9 @@ struct msqid64_ds { struct ipc64_perm msg_perm; #ifdef __powerpc64__ - __kernel_time_t msg_stime; /* last msgsnd time */ - __kernel_time_t msg_rtime; /* last msgrcv time */ - __kernel_time_t msg_ctime; /* last change time */ + long msg_stime; /* last msgsnd time */ + long msg_rtime; /* last msgrcv time */ + long msg_ctime; /* last change time */ #else unsigned long msg_stime_high; unsigned long msg_stime; /* last msgsnd time */ diff --git a/arch/powerpc/include/uapi/asm/sembuf.h b/arch/powerpc/include/uapi/asm/sembuf.h index 3f60946f77e3..008ae77c6746 100644 --- a/arch/powerpc/include/uapi/asm/sembuf.h +++ b/arch/powerpc/include/uapi/asm/sembuf.h @@ -26,8 +26,8 @@ struct semid64_ds { unsigned long sem_ctime_high; unsigned long sem_ctime; /* last change time */ #else - __kernel_time_t sem_otime; /* last semop time */ - __kernel_time_t sem_ctime; /* last change time */ + long sem_otime; /* last semop time */ + long sem_ctime; /* last change time */ #endif unsigned long sem_nsems; /* no. of semaphores in array */ unsigned long __unused3; diff --git a/arch/powerpc/include/uapi/asm/shmbuf.h b/arch/powerpc/include/uapi/asm/shmbuf.h index b591c4d7e4c5..00422b2f3c63 100644 --- a/arch/powerpc/include/uapi/asm/shmbuf.h +++ b/arch/powerpc/include/uapi/asm/shmbuf.h @@ -22,9 +22,9 @@ struct shmid64_ds { struct ipc64_perm shm_perm; /* operation perms */ #ifdef __powerpc64__ - __kernel_time_t shm_atime; /* last attach time */ - __kernel_time_t shm_dtime; /* last detach time */ - __kernel_time_t shm_ctime; /* last change time */ + long shm_atime; /* last attach time */ + long shm_dtime; /* last detach time */ + long shm_ctime; /* last change time */ #else unsigned long shm_atime_high; unsigned long shm_atime; /* last attach time */ diff --git a/arch/sparc/include/uapi/asm/msgbuf.h b/arch/sparc/include/uapi/asm/msgbuf.h index ffc46c211d6d..eeeb91933280 100644 --- a/arch/sparc/include/uapi/asm/msgbuf.h +++ b/arch/sparc/include/uapi/asm/msgbuf.h @@ -13,9 +13,9 @@ struct msqid64_ds { struct ipc64_perm msg_perm; #if defined(__sparc__) && defined(__arch64__) - __kernel_time_t msg_stime; /* last msgsnd time */ - __kernel_time_t msg_rtime; /* last msgrcv time */ - __kernel_time_t msg_ctime; /* last change time */ + long msg_stime; /* last msgsnd time */ + long msg_rtime; /* last msgrcv time */ + long msg_ctime; /* last change time */ #else unsigned long msg_stime_high; unsigned long msg_stime; /* last msgsnd time */ diff --git a/arch/sparc/include/uapi/asm/sembuf.h b/arch/sparc/include/uapi/asm/sembuf.h index f3d309c2e1cd..cbcbaa4e7128 100644 --- a/arch/sparc/include/uapi/asm/sembuf.h +++ b/arch/sparc/include/uapi/asm/sembuf.h @@ -14,8 +14,8 @@ struct semid64_ds { struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ #if defined(__sparc__) && defined(__arch64__) - __kernel_time_t sem_otime; /* last semop time */ - __kernel_time_t sem_ctime; /* last change time */ + long sem_otime; /* last semop time */ + long sem_ctime; /* last change time */ #else unsigned long sem_otime_high; unsigned long sem_otime; /* last semop time */ diff --git a/arch/sparc/include/uapi/asm/shmbuf.h b/arch/sparc/include/uapi/asm/shmbuf.h index 06618b84822d..a5d7d8d681c4 100644 --- a/arch/sparc/include/uapi/asm/shmbuf.h +++ b/arch/sparc/include/uapi/asm/shmbuf.h @@ -14,9 +14,9 @@ struct shmid64_ds { struct ipc64_perm shm_perm; /* operation perms */ #if defined(__sparc__) && defined(__arch64__) - __kernel_time_t shm_atime; /* last attach time */ - __kernel_time_t shm_dtime; /* last detach time */ - __kernel_time_t shm_ctime; /* last change time */ + long shm_atime; /* last attach time */ + long shm_dtime; /* last detach time */ + long shm_ctime; /* last change time */ #else unsigned long shm_atime_high; unsigned long shm_atime; /* last attach time */ diff --git a/arch/x86/include/uapi/asm/msgbuf.h b/arch/x86/include/uapi/asm/msgbuf.h index 90ab9a795b49..7c5bb43ed8af 100644 --- a/arch/x86/include/uapi/asm/msgbuf.h +++ b/arch/x86/include/uapi/asm/msgbuf.h @@ -15,9 +15,9 @@ struct msqid64_ds { struct ipc64_perm msg_perm; - __kernel_time_t msg_stime; /* last msgsnd time */ - __kernel_time_t msg_rtime; /* last msgrcv time */ - __kernel_time_t msg_ctime; /* last change time */ + __kernel_long_t msg_stime; /* last msgsnd time */ + __kernel_long_t msg_rtime; /* last msgrcv time */ + __kernel_long_t msg_ctime; /* last change time */ __kernel_ulong_t msg_cbytes; /* current number of bytes on queue */ __kernel_ulong_t msg_qnum; /* number of messages in queue */ __kernel_ulong_t msg_qbytes; /* max number of bytes on queue */ diff --git a/arch/x86/include/uapi/asm/sembuf.h b/arch/x86/include/uapi/asm/sembuf.h index 89de6cd9f0a7..7c1b156695ba 100644 --- a/arch/x86/include/uapi/asm/sembuf.h +++ b/arch/x86/include/uapi/asm/sembuf.h @@ -21,9 +21,9 @@ struct semid64_ds { unsigned long sem_ctime; /* last change time */ unsigned long sem_ctime_high; #else - __kernel_time_t sem_otime; /* last semop time */ + long sem_otime; /* last semop time */ __kernel_ulong_t __unused1; - __kernel_time_t sem_ctime; /* last change time */ + long sem_ctime; /* last change time */ __kernel_ulong_t __unused2; #endif __kernel_ulong_t sem_nsems; /* no. of semaphores in array */ diff --git a/arch/x86/include/uapi/asm/shmbuf.h b/arch/x86/include/uapi/asm/shmbuf.h index 644421f3823b..f0305dc660c9 100644 --- a/arch/x86/include/uapi/asm/shmbuf.h +++ b/arch/x86/include/uapi/asm/shmbuf.h @@ -16,9 +16,9 @@ struct shmid64_ds { struct ipc64_perm shm_perm; /* operation perms */ size_t shm_segsz; /* size of segment (bytes) */ - __kernel_time_t shm_atime; /* last attach time */ - __kernel_time_t shm_dtime; /* last detach time */ - __kernel_time_t shm_ctime; /* last change time */ + __kernel_long_t shm_atime; /* last attach time */ + __kernel_long_t shm_dtime; /* last detach time */ + __kernel_long_t shm_ctime; /* last change time */ __kernel_pid_t shm_cpid; /* pid of creator */ __kernel_pid_t shm_lpid; /* pid of last operator */ __kernel_ulong_t shm_nattch; /* no. of current attaches */ diff --git a/include/uapi/asm-generic/msgbuf.h b/include/uapi/asm-generic/msgbuf.h index 9fe4881557cb..af95aa89012e 100644 --- a/include/uapi/asm-generic/msgbuf.h +++ b/include/uapi/asm-generic/msgbuf.h @@ -13,9 +13,9 @@ * everyone just ended up making identical copies without specific * optimizations, so we may just as well all use the same one. * - * 64 bit architectures typically define a 64 bit __kernel_time_t, - * so they do not need the first three padding words. - * On big-endian systems, the padding is in the wrong place. + * 64 bit architectures use a 64-bit long time field here, while + * 32 bit architectures have a pair of unsigned long values. + * On big-endian systems, the lower half is in the wrong place. * * Pad space is left for: * - 2 miscellaneous 32-bit values @@ -24,9 +24,9 @@ struct msqid64_ds { struct ipc64_perm msg_perm; #if __BITS_PER_LONG == 64 - __kernel_time_t msg_stime; /* last msgsnd time */ - __kernel_time_t msg_rtime; /* last msgrcv time */ - __kernel_time_t msg_ctime; /* last change time */ + long msg_stime; /* last msgsnd time */ + long msg_rtime; /* last msgrcv time */ + long msg_ctime; /* last change time */ #else unsigned long msg_stime; /* last msgsnd time */ unsigned long msg_stime_high; diff --git a/include/uapi/asm-generic/sembuf.h b/include/uapi/asm-generic/sembuf.h index 0bae010f1b64..137606018c6a 100644 --- a/include/uapi/asm-generic/sembuf.h +++ b/include/uapi/asm-generic/sembuf.h @@ -13,9 +13,8 @@ * everyone just ended up making identical copies without specific * optimizations, so we may just as well all use the same one. * - * 64 bit architectures use a 64-bit __kernel_time_t here, while + * 64 bit architectures use a 64-bit long time field here, while * 32 bit architectures have a pair of unsigned long values. - * so they do not need the first two padding words. * * On big-endian systems, the padding is in the wrong place for * historic reasons, so user space has to reconstruct a time_t @@ -29,8 +28,8 @@ struct semid64_ds { struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ #if __BITS_PER_LONG == 64 - __kernel_time_t sem_otime; /* last semop time */ - __kernel_time_t sem_ctime; /* last change time */ + long sem_otime; /* last semop time */ + long sem_ctime; /* last change time */ #else unsigned long sem_otime; /* last semop time */ unsigned long sem_otime_high; diff --git a/include/uapi/asm-generic/shmbuf.h b/include/uapi/asm-generic/shmbuf.h index e504422fc501..2bab955e0fed 100644 --- a/include/uapi/asm-generic/shmbuf.h +++ b/include/uapi/asm-generic/shmbuf.h @@ -13,9 +13,9 @@ * everyone just ended up making identical copies without specific * optimizations, so we may just as well all use the same one. * - * 64 bit architectures typically define a 64 bit __kernel_time_t, - * so they do not need the first two padding words. - * On big-endian systems, the padding is in the wrong place. + * 64 bit architectures use a 64-bit long time field here, while + * 32 bit architectures have a pair of unsigned long values. + * On big-endian systems, the lower half is in the wrong place. * * * Pad space is left for: @@ -26,9 +26,9 @@ struct shmid64_ds { struct ipc64_perm shm_perm; /* operation perms */ size_t shm_segsz; /* size of segment (bytes) */ #if __BITS_PER_LONG == 64 - __kernel_time_t shm_atime; /* last attach time */ - __kernel_time_t shm_dtime; /* last detach time */ - __kernel_time_t shm_ctime; /* last change time */ + long shm_atime; /* last attach time */ + long shm_dtime; /* last detach time */ + long shm_ctime; /* last change time */ #else unsigned long shm_atime; /* last attach time */ unsigned long shm_atime_high; From patchwork Fri Nov 8 21:07:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178970 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3285457ilf; Fri, 8 Nov 2019 13:12:32 -0800 (PST) X-Google-Smtp-Source: APXvYqwLvCL1uQpLXP4+scr1QzvemlU02Cxaxp0QSpo4R54V0oopOszyQxsugSbnDnXIgbFVtL3E X-Received: by 2002:a50:959a:: with SMTP id w26mr12812085eda.214.1573247552064; Fri, 08 Nov 2019 13:12:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247552; cv=none; d=google.com; s=arc-20160816; b=T3tWGmIW52YdhdDqT2JKM1xFfYxZrKTmmjaod4NgmJnXeLYJG1Zo1U+zokcAaqrxW1 K6ChXIQvZTmgouBXaaGAU4uvJcb2OVcPIf0tMkK4nMn/LUwrrIPxpCltCx3oL25zOn03 Wm86dzXgfPW/YX/y1FOlfJHp7QpPN3GmSP7w6N0z2ysXn16CsU5cuHutbwe67W6ecYvV XOKhRmdMCywOlurYUPutr1xcIE9GE7zgAjM/ZhxAMVqrRqVd+Bm7kNtukUT6ixjN9b/6 O7fYMCmnZNoV7FZkSYRZqDcj6GZpDeVkmQhwZUrVD4Fx+wt9+dd6n2Yv156NFCURSF0n FhEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=4CaxTq1yyZQ9I3V9WYsXZemmoXtcj8LmvTRFnf3fn8U=; b=cPsfxFZ+eK5qGeK344YQ2DRcLVAw8R3Tg7/P8aRKyhIT+EExHEeCkEfoxUe5jVW+Ih Lhk6ycQ1vP22nmNuHq+t8G47xxGTesepHRNM5ESY5qODHgH0hRqM+qRT56Gf5M4Q+Eqh MALsCeF0q9/vAQQ4D+RWRiJf/fR56BLXUUSOvznsQCCedaafXmkeVG44w6GyX0cJDi2U ZECQmLI4xVBttGCBhcU+ZlLc0rPm4OYDnxbP3fcK9MzpYmISdRrwpnbiLXTcEj9vH5hE n8bM9jk2zn6qCGNbi+j6pGoGqoespgesZprm11nfAwosxFe8mSd0djVNYa3UmDc0qO0H +4eg== 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 o3si5569669edi.374.2019.11.08.13.12.31; Fri, 08 Nov 2019 13:12:32 -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 S1732612AbfKHVM2 (ORCPT + 26 others); Fri, 8 Nov 2019 16:12:28 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:38659 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731181AbfKHVM1 (ORCPT ); Fri, 8 Nov 2019 16:12:27 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MuUrM-1hcjO90hCk-00rZpx; Fri, 08 Nov 2019 22:12:15 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Ralf Baechle , Paul Burton , James Hogan , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "David S. Miller" Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org Subject: [PATCH 09/23] y2038: stat: avoid 'time_t' in 'struct stat' Date: Fri, 8 Nov 2019 22:07:29 +0100 Message-Id: <20191108210824.1534248-9-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:hQI2PKcMsbaE8ATmNf2BhWXqyHFlTZauM/SrY3t0jiAIGW3xOTB hBBN0IXOSct8hlnQ6w0xvFFKPx4AzXlvbQt+HI21ZvqdieWlTPMP53mXMixyGqPmqpLX2DY 18kt9E8OgSmLQXE29GwEdOk7+TRAL6MlF7MNEprN+IqVwZmx25e2l/aFzmEtBVdILamjFUy Huk0oJvJ7dYi4x9qJROYw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:K2C61v4B7ck=:smMLVvXqVSSEvnAoP3AxsT OuKZb07AaMqYhICWFPMqlbsAapbNDFK4bOzD/3oRJwzr7UJm1i6wF9XvZSkcRdmlPv/KX0Jgu yUvg6oGveX/ZLlgNXufjr35smf+6i4THT3VNVU7PWkK5mBgzxteOrbgzGYGMXVk14gqD9wjVY Jxa+QtngWpzu6yKHFZp10FgRvCqS0sF1gopRhTHA3/Ulu/bHkRjS40+U/BRGvBZcKFODyqNIu +RF9Fjpc+bY7sIqlKpYISoze8N+wEdBNI6GKALttvycVWdXZaqqsrFvBPRn4chaAmh3Cin9DD RFAW16O6wAMluc5+dvvPJ8clH/mYnZkfmffzCO+BITb8sEwxe5fvEfH2qPJV80Ll6NyK97F07 ksemAwS1FEtmrqxA0DOgJGdF1soJ7/tnMHTLt2BIgmZNbRGlRWxu12h+D9EOUrkqD/BSBSkFW OBUi6Kz/2kMsLiEVTskzYiBN5n3mtyWwQobf00gKtMITgu03G8SbcXsr0Y86FRRgFr+H5mSRd CjaBhfs876ftE8uUYNwvI+7tUgfoK+FjGAJZKOCARN79dIE6wSLV55b/hJ6/Eas64A/v56kHS TbCz731akDnJRGLqLGCgD/XHfaDrA7u2NpAnbPrddHwjpY99pomh/6+wUNKnUMZ+OnnFQJ+B5 E8VJWnuQ3b+TDEJBGDDCKm4LANvO+4Tw8XAxKyWBfnQtDSs/FNGqLlL63ZlfEdlrYetPrrjTW onYjBFAoYV7bHtvkZLX8eanC/RADpovly16lRZpwutbetKA6NqvtFbseTgxWEAbmLyWB5q/ap 1VlEUAyc/EQF/xFTgy6ejeKrMwbFlvGg2j/NlimY8/yEUyY0xA+cgukXFuQ47MtjhJg/ufCdt /STLYGmt0wiwvRWxE7ZQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The time_t definition may differ between user space and kernel space, so replace time_t with an unambiguous 'long' for the mips and sparc. The same structures also contain 'off_t', which has the same problem, so replace that as well on those two architectures and powerpc. Signed-off-by: Arnd Bergmann --- arch/mips/include/uapi/asm/stat.h | 16 ++++++++-------- arch/powerpc/include/uapi/asm/stat.h | 2 +- arch/sparc/include/uapi/asm/stat.h | 24 ++++++++++++------------ 3 files changed, 21 insertions(+), 21 deletions(-) -- 2.20.0 diff --git a/arch/mips/include/uapi/asm/stat.h b/arch/mips/include/uapi/asm/stat.h index 95416f366d7f..3d2a3b71845c 100644 --- a/arch/mips/include/uapi/asm/stat.h +++ b/arch/mips/include/uapi/asm/stat.h @@ -26,17 +26,17 @@ struct stat { gid_t st_gid; unsigned st_rdev; long st_pad2[2]; - off_t st_size; + long st_size; long st_pad3; /* * Actually this should be timestruc_t st_atime, st_mtime and st_ctime * but we don't have it under Linux. */ - time_t st_atime; + long st_atime; long st_atime_nsec; - time_t st_mtime; + long st_mtime; long st_mtime_nsec; - time_t st_ctime; + long st_ctime; long st_ctime_nsec; long st_blksize; long st_blocks; @@ -70,13 +70,13 @@ struct stat64 { * Actually this should be timestruc_t st_atime, st_mtime and st_ctime * but we don't have it under Linux. */ - time_t st_atime; + long st_atime; unsigned long st_atime_nsec; /* Reserved for st_atime expansion */ - time_t st_mtime; + long st_mtime; unsigned long st_mtime_nsec; /* Reserved for st_mtime expansion */ - time_t st_ctime; + long st_ctime; unsigned long st_ctime_nsec; /* Reserved for st_ctime expansion */ unsigned long st_blksize; @@ -105,7 +105,7 @@ struct stat { unsigned int st_rdev; unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ - off_t st_size; + long st_size; /* * Actually this should be timestruc_t st_atime, st_mtime and st_ctime diff --git a/arch/powerpc/include/uapi/asm/stat.h b/arch/powerpc/include/uapi/asm/stat.h index afd25f2ff4e8..7871055e5e32 100644 --- a/arch/powerpc/include/uapi/asm/stat.h +++ b/arch/powerpc/include/uapi/asm/stat.h @@ -40,7 +40,7 @@ struct stat { uid_t st_uid; gid_t st_gid; unsigned long st_rdev; - off_t st_size; + long st_size; unsigned long st_blksize; unsigned long st_blocks; unsigned long st_atime; diff --git a/arch/sparc/include/uapi/asm/stat.h b/arch/sparc/include/uapi/asm/stat.h index b6ec4eb217f7..732c41720e24 100644 --- a/arch/sparc/include/uapi/asm/stat.h +++ b/arch/sparc/include/uapi/asm/stat.h @@ -14,12 +14,12 @@ struct stat { uid_t st_uid; gid_t st_gid; unsigned int st_rdev; - off_t st_size; - time_t st_atime; - time_t st_mtime; - time_t st_ctime; - off_t st_blksize; - off_t st_blocks; + long st_size; + long st_atime; + long st_mtime; + long st_ctime; + long st_blksize; + long st_blocks; unsigned long __unused4[2]; }; @@ -57,15 +57,15 @@ struct stat { unsigned short st_uid; unsigned short st_gid; unsigned short st_rdev; - off_t st_size; - time_t st_atime; + long st_size; + long st_atime; unsigned long st_atime_nsec; - time_t st_mtime; + long st_mtime; unsigned long st_mtime_nsec; - time_t st_ctime; + long st_ctime; unsigned long st_ctime_nsec; - off_t st_blksize; - off_t st_blocks; + long st_blksize; + long st_blocks; unsigned long __unused4[2]; }; From patchwork Fri Nov 8 21:12:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178972 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3286986ilf; Fri, 8 Nov 2019 13:13:47 -0800 (PST) X-Google-Smtp-Source: APXvYqwVi0w3wgV2FkjJgoF3YnuSAr6C0Yoci2s26A5ecrkUom3xfbPzPZsKs+5KTpwvetvhg5wp X-Received: by 2002:a50:fb8d:: with SMTP id e13mr12418623edq.213.1573247627732; Fri, 08 Nov 2019 13:13:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247627; cv=none; d=google.com; s=arc-20160816; b=mP9lRaB7/NcUGkFDDl4hSYnhVCjHeAqaCyOgoONzs2Hc+0q0ogf4lYQWBn+KqLo925 c+MM/sktQjOG+4YAt6xRWhzrGecPRDsKvFDbhoO8LGx8D1OmPV6BaIm10pdoEVDV1xLY +OLXyKmIYWnhEMvirvbod0NcICdT1eQpjDRDMzuUM2NKeLs2Un1Y7TT7KQI4yjXHjIlS QQul1Oh17N79u8Fr0IyJYZQknRIu0gT93jJVp7KRjyUOdRMmAu7tvxjcx2yuzaQfefX3 kU/fWeduf0zHGdHIGoY47sqyT+gfVhMc30/AQ+ds2NXe19YR2xUPkvdMME+5gKgWoMi7 BHpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lzaQ7Abaz9qH+TtuURQ/psQbT0XlpaexTp3TCvnGYx0=; b=mP9vUNcxLdVNO1gQIyRUS4Ebz2MqGEmP3B9cvmLuY/7xdW/R9atHq10b3Z6Oyo/LMD LifuBCv55dPQplWa6AB8FBtgFxSAnGUNv7qrqW7ejvBZjEdrlYLrrWl0DnGw2sCjy16r wpGXj8hUDC1ZopM32UQBwZuCwbhtB/bm1Y3a02/svoRBv/C8iGY5dGGaDb4ap+nwa2NO x5IIhxEP+XhYX4zDf7bQ+BqS9KRvdbpcJYdKPR4f7inFuV2t9UcbtujD5KD2ZNkgzCIj RoKVY8PRgbZkEWOcOmytst3RcfxMPmxeZw85Kwv2V6dNv6F6M7VxBSMAxOkRWspne7U2 hpLA== 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 p13si3766037eju.398.2019.11.08.13.13.47; Fri, 08 Nov 2019 13:13:47 -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 S1732689AbfKHVNo (ORCPT + 26 others); Fri, 8 Nov 2019 16:13:44 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:39555 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731687AbfKHVNn (ORCPT ); Fri, 8 Nov 2019 16:13:43 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MtwpW-1hdHL21W5U-00uJeP; Fri, 08 Nov 2019 22:13:28 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, John Stultz , Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Stephen Boyd , David Howells , Al Viro , Deepa Dinamani , Christian Brauner , linux-api@vger.kernel.org Subject: [PATCH 10/23] y2038: uapi: change __kernel_time_t to __kernel_old_time_t Date: Fri, 8 Nov 2019 22:12:09 +0100 Message-Id: <20191108211323.1806194-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:zwDWAHKUX8iR4jhuhwk7qp7pSqmuICttWQvBARCBMBfK/SfKsaj 4sSOsyNqS76f8b9ozUpyUt0GTeTA4llifwefp58GUsW0jmooQ6wSB97jBSehNjL6UqC5BNv halH7a0LND5nxbhpwfSV5uvFb9PGFlRiVwvz0jNHBGdU1wgwfCkaizle09u2Jcwm2T/bAj8 D/tqHBLuxECXv1uCQOHzw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:YBFovS3jMaI=:OL6ullB6tXpTEa+GH5u+MC VBc7j0XvjVUq5I2a+KtXlHRkUS/9Td3CQ7Riv5UUAyqFq4WCt6lKuhxQdEYZd22Ne0izhyIM3 52F0AI7lxiknt4DZxNyhE9FHywB0MxsPG8Hrw7IXhCVoLhiWcKvuEjD4ApQYxl4oH7GyJUBje LGZd2ekbo0O6XdYNK3g1wq5oZlJYz9IHAu0S3OoOsHcAl4Lx7XntslLveUpsnjjcCS6Q5l7He jkCXucdj1RcuGsO2A+bE6npJ2EOlt8q/QKI6Td9+QXIiwB/XYq7ZNAqsCCHyAud0lRfnXSLCU d/SqNxyCzFSN9V6wi2z9TPFBouOWcJBBXI5emx6qY3sFMt5/cqYQcxps2D64IlKxL/m6Y566h mCicNdzl2RffPxzMqS7uXuVwHVGQmVBsz8EEQW8TqalEakTLuQ8txega+DjfkSB6Lqe8pe5do J0XePuSVh+wPRGJvPUKIBuzVi/bFbM0mfWXnXwH31CaOxt/Y1fhgFkHiYiI3wz4pqUpFEaW6O ewcMUd1Ixtv3cqxVKl1GkSDdEGXXnS19gMuBG4xSVjHqiByv0hrMEHfOpyOnXhBSFp0nVw/bi HqbVLULuZhAYZm1IYbWQg3jPz/txfx2PHu611QuRD8A9iCXFwaETsXTxaFT28UEEExLoAmo3f VPzAJxc2JZhinBjH2D/fVLukpRZFWwOhFkRisbaeLfNtO7YrsZBTrUgUVTwkEKh6Yj1F7Pi9G 44hzXpEe+myXG3QTmFnJ4Ub7QLhERD2JuzgRGeKZOmO24VU1VlD4boifLXiDrvQthGoov5mLY 0Ff9itgme2IaqSoWeO7l5JmSxU7cC8UmHo+2QdlZZ2rVwWSd0/JbEz1z2Cw3i6/rietgnTcjV lAzKHyr8NlHxBw8jaGOw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is mainly a patch for clarification, and to let us remove the time_t definition from the kernel to prevent new users from creeping in that might not be y2038-safe. All remaining uses of 'time_t' or '__kernel_time_t' are part of the user API that cannot be changed by that either have a replacement or that do not suffer from the y2038 overflow. Signed-off-by: Arnd Bergmann --- include/linux/syscalls.h | 4 ++-- include/linux/time32.h | 2 +- include/linux/types.h | 2 +- include/uapi/linux/cyclades.h | 6 +++--- include/uapi/linux/msg.h | 6 +++--- include/uapi/linux/ppp_defs.h | 4 ++-- include/uapi/linux/sem.h | 4 ++-- include/uapi/linux/shm.h | 6 +++--- include/uapi/linux/time.h | 6 +++--- include/uapi/linux/time_types.h | 4 ++-- include/uapi/linux/utime.h | 4 ++-- kernel/time/time.c | 6 +++--- 12 files changed, 27 insertions(+), 27 deletions(-) -- 2.20.0 Acked-by: Deepa Dinamani Acked-by: Christian Brauner diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index f7c561c4dcdd..2f27bc9d5ef0 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -1076,7 +1076,7 @@ asmlinkage long sys_fadvise64(int fd, loff_t offset, size_t len, int advice); asmlinkage long sys_alarm(unsigned int seconds); asmlinkage long sys_getpgrp(void); asmlinkage long sys_pause(void); -asmlinkage long sys_time(time_t __user *tloc); +asmlinkage long sys_time(__kernel_old_time_t __user *tloc); asmlinkage long sys_time32(old_time32_t __user *tloc); #ifdef __ARCH_WANT_SYS_UTIME asmlinkage long sys_utime(char __user *filename, @@ -1116,7 +1116,7 @@ asmlinkage long sys_sysfs(int option, asmlinkage long sys_fork(void); /* obsolete: kernel/time/time.c */ -asmlinkage long sys_stime(time_t __user *tptr); +asmlinkage long sys_stime(__kernel_old_time_t __user *tptr); asmlinkage long sys_stime32(old_time32_t __user *tptr); /* obsolete: kernel/signal.c */ diff --git a/include/linux/time32.h b/include/linux/time32.h index 0a1f302a1753..cad4c3186002 100644 --- a/include/linux/time32.h +++ b/include/linux/time32.h @@ -12,7 +12,7 @@ #include #include -#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) +#define TIME_T_MAX (__kernel_old_time_t)((1UL << ((sizeof(__kernel_old_time_t) << 3) - 1)) - 1) typedef s32 old_time32_t; diff --git a/include/linux/types.h b/include/linux/types.h index 05030f608be3..e32c1180b742 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -67,7 +67,7 @@ typedef __kernel_ptrdiff_t ptrdiff_t; #ifndef _TIME_T #define _TIME_T -typedef __kernel_time_t time_t; +typedef __kernel_old_time_t time_t; #endif #ifndef _CLOCK_T diff --git a/include/uapi/linux/cyclades.h b/include/uapi/linux/cyclades.h index 8279bc3d60ca..fc0add2194a9 100644 --- a/include/uapi/linux/cyclades.h +++ b/include/uapi/linux/cyclades.h @@ -83,9 +83,9 @@ struct cyclades_monitor { * open) */ struct cyclades_idle_stats { - __kernel_time_t in_use; /* Time device has been in use (secs) */ - __kernel_time_t recv_idle; /* Time since last char received (secs) */ - __kernel_time_t xmit_idle; /* Time since last char transmitted (secs) */ + __kernel_old_time_t in_use; /* Time device has been in use (secs) */ + __kernel_old_time_t recv_idle; /* Time since last char received (secs) */ + __kernel_old_time_t xmit_idle; /* Time since last char transmitted (secs) */ unsigned long recv_bytes; /* Bytes received */ unsigned long xmit_bytes; /* Bytes transmitted */ unsigned long overruns; /* Input overruns */ diff --git a/include/uapi/linux/msg.h b/include/uapi/linux/msg.h index e4a0d9a9a9e8..01ee8d54c1c8 100644 --- a/include/uapi/linux/msg.h +++ b/include/uapi/linux/msg.h @@ -19,9 +19,9 @@ struct msqid_ds { struct ipc_perm msg_perm; struct msg *msg_first; /* first message on queue,unused */ struct msg *msg_last; /* last message in queue,unused */ - __kernel_time_t msg_stime; /* last msgsnd time */ - __kernel_time_t msg_rtime; /* last msgrcv time */ - __kernel_time_t msg_ctime; /* last change time */ + __kernel_old_time_t msg_stime; /* last msgsnd time */ + __kernel_old_time_t msg_rtime; /* last msgrcv time */ + __kernel_old_time_t msg_ctime; /* last change time */ unsigned long msg_lcbytes; /* Reuse junk fields for 32 bit */ unsigned long msg_lqbytes; /* ditto */ unsigned short msg_cbytes; /* current number of bytes on queue */ diff --git a/include/uapi/linux/ppp_defs.h b/include/uapi/linux/ppp_defs.h index 0039fa39a358..20286bd90ab5 100644 --- a/include/uapi/linux/ppp_defs.h +++ b/include/uapi/linux/ppp_defs.h @@ -148,8 +148,8 @@ struct ppp_comp_stats { * based on the libc time_t. */ struct ppp_idle { - __kernel_time_t xmit_idle; /* time since last NP packet sent */ - __kernel_time_t recv_idle; /* time since last NP packet received */ + __kernel_old_time_t xmit_idle; /* time since last NP packet sent */ + __kernel_old_time_t recv_idle; /* time since last NP packet received */ }; struct ppp_idle32 { diff --git a/include/uapi/linux/sem.h b/include/uapi/linux/sem.h index 39a1876f039e..75aa3b273cd9 100644 --- a/include/uapi/linux/sem.h +++ b/include/uapi/linux/sem.h @@ -24,8 +24,8 @@ /* Obsolete, used only for backwards compatibility and libc5 compiles */ struct semid_ds { struct ipc_perm sem_perm; /* permissions .. see ipc.h */ - __kernel_time_t sem_otime; /* last semop time */ - __kernel_time_t sem_ctime; /* create/last semctl() time */ + __kernel_old_time_t sem_otime; /* last semop time */ + __kernel_old_time_t sem_ctime; /* create/last semctl() time */ struct sem *sem_base; /* ptr to first semaphore in array */ struct sem_queue *sem_pending; /* pending operations to be processed */ struct sem_queue **sem_pending_last; /* last pending operation */ diff --git a/include/uapi/linux/shm.h b/include/uapi/linux/shm.h index 6507ad0afc81..8d1f17a4e08e 100644 --- a/include/uapi/linux/shm.h +++ b/include/uapi/linux/shm.h @@ -28,9 +28,9 @@ struct shmid_ds { struct ipc_perm shm_perm; /* operation perms */ int shm_segsz; /* size of segment (bytes) */ - __kernel_time_t shm_atime; /* last attach time */ - __kernel_time_t shm_dtime; /* last detach time */ - __kernel_time_t shm_ctime; /* last change time */ + __kernel_old_time_t shm_atime; /* last attach time */ + __kernel_old_time_t shm_dtime; /* last detach time */ + __kernel_old_time_t shm_ctime; /* last change time */ __kernel_ipc_pid_t shm_cpid; /* pid of creator */ __kernel_ipc_pid_t shm_lpid; /* pid of last operator */ unsigned short shm_nattch; /* no. of current attaches */ diff --git a/include/uapi/linux/time.h b/include/uapi/linux/time.h index 958932effc5e..a655aa28dc6e 100644 --- a/include/uapi/linux/time.h +++ b/include/uapi/linux/time.h @@ -8,13 +8,13 @@ #ifndef _STRUCT_TIMESPEC #define _STRUCT_TIMESPEC struct timespec { - __kernel_time_t tv_sec; /* seconds */ - long tv_nsec; /* nanoseconds */ + __kernel_old_time_t tv_sec; /* seconds */ + long tv_nsec; /* nanoseconds */ }; #endif struct timeval { - __kernel_time_t tv_sec; /* seconds */ + __kernel_old_time_t tv_sec; /* seconds */ __kernel_suseconds_t tv_usec; /* microseconds */ }; diff --git a/include/uapi/linux/time_types.h b/include/uapi/linux/time_types.h index 60b37f29842d..074e391d73a1 100644 --- a/include/uapi/linux/time_types.h +++ b/include/uapi/linux/time_types.h @@ -29,8 +29,8 @@ struct __kernel_old_timeval { #endif struct __kernel_old_timespec { - __kernel_time_t tv_sec; /* seconds */ - long tv_nsec; /* nanoseconds */ + __kernel_old_time_t tv_sec; /* seconds */ + long tv_nsec; /* nanoseconds */ }; struct __kernel_sock_timeval { diff --git a/include/uapi/linux/utime.h b/include/uapi/linux/utime.h index fd9aa26b6860..bc8f13e81d6e 100644 --- a/include/uapi/linux/utime.h +++ b/include/uapi/linux/utime.h @@ -5,8 +5,8 @@ #include struct utimbuf { - __kernel_time_t actime; - __kernel_time_t modtime; + __kernel_old_time_t actime; + __kernel_old_time_t modtime; }; #endif diff --git a/kernel/time/time.c b/kernel/time/time.c index ddbddf504c23..7eba7c9a7e3e 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c @@ -59,9 +59,9 @@ EXPORT_SYMBOL(sys_tz); * why not move it into the appropriate arch directory (for those * architectures that need it). */ -SYSCALL_DEFINE1(time, time_t __user *, tloc) +SYSCALL_DEFINE1(time, __kernel_old_time_t __user *, tloc) { - time_t i = (time_t)ktime_get_real_seconds(); + __kernel_old_time_t i = (__kernel_old_time_t)ktime_get_real_seconds(); if (tloc) { if (put_user(i,tloc)) @@ -78,7 +78,7 @@ SYSCALL_DEFINE1(time, time_t __user *, tloc) * architectures that need it). */ -SYSCALL_DEFINE1(stime, time_t __user *, tptr) +SYSCALL_DEFINE1(stime, __kernel_old_time_t __user *, tptr) { struct timespec64 tv; int err; From patchwork Fri Nov 8 21:12:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178976 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3289775ilf; Fri, 8 Nov 2019 13:15:50 -0800 (PST) X-Google-Smtp-Source: APXvYqxbPxEMIzbfnqSn4uOtCIy6it4sV6JacYQPORdYwdpEnO6hH+/wkOrC9UemUI4aOeDwdQj/ X-Received: by 2002:a17:906:2cd4:: with SMTP id r20mr1391194ejr.307.1573247750066; Fri, 08 Nov 2019 13:15:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247750; cv=none; d=google.com; s=arc-20160816; b=UgoQZmydf651apGbfJzzrLpgiAMpFmZhLazW275K2TeAnwDMxC8sHF2D3ZkbLPr+jD 63KJaziHoicaockN+sO3neK6AsnbEPnp0/6LxBmFiq4BNk/cbh9OVBSuezTIOoaUyjXb LQcK9HPfvQUlS70bFD+gQQV5YUpJfTssnHfstMCMEgRuSgEWZQOBovSoPH83fcaK4RRO Vw+BS6cRyigE+O9DqO9hh4CcLICUgddTNxAWnLbGAkYL7Y1A1ttg2yRA3g37aAvny+FT FZc8/QayJdPebZI6g+pJX+eZx/dvP+Qscpr5xrRU4PLAEiA+hE/9KEIijufXf7JcTW5H L+FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ljt1MGUiQpeFXBz06+zOy9h1ni/sWupfjqQUEdYHERo=; b=ZG7nrq408Wtv1jx8onsyfYiJCvaF4+zvPGHfhQOUX8t4fq71dBIrLbDsVxPvD7GOG2 pBaH6Q3mfmw/CPHvntpCeHluQ0NZOtZzUgyShg0ZadN35qKjbcgAb/yydQrB7xJ7F2Z5 rCWfoIAUD+FnDnnQhoA7y5rQiwvHElPzoQJHXFMTkUX77BkHUQEeV/WELSm+4USGwnVF UiFMh3+vl3Z5211r+y0VwhuqMLP0zrSc9UkP1ddFunzoaOIjUuQFhf06dsfyumpmDUbX wNcEgyS0KHJrmxGnumanqJoWbV3UliHbFowEPL/sTLNQvKkAH2upTvgvp/Y6zAXBH09d AI9w== 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 u4si6577767edi.179.2019.11.08.13.15.49; Fri, 08 Nov 2019 13:15:50 -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 S1732986AbfKHVPq (ORCPT + 26 others); Fri, 8 Nov 2019 16:15:46 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:52805 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732944AbfKHVPp (ORCPT ); Fri, 8 Nov 2019 16:15:45 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MBE3k-1idfB62d2c-00ChQV; Fri, 08 Nov 2019 22:13:54 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Richard Henderson , Ivan Kokshaysky , Matt Turner Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Deepa Dinamani , Thomas Gleixner , Cyrill Gorcunov , Will Deacon , =?utf-8?q?Michal_Koutn=C3=BD?= , Catalin Marinas , Dave Hansen , linux-alpha@vger.kernel.org Subject: [PATCH 11/23] y2038: rusage: use __kernel_old_timeval Date: Fri, 8 Nov 2019 22:12:10 +0100 Message-Id: <20191108211323.1806194-2-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:ccHgshTWM+8bd3ARSVMsRuKkh2xp2UsGP2nSeaQ4JIi6tssxXxX Ksc3ikHH0cvgfaaztiNxX2CA4M+Vpy+c174W7J82D3dRrGrnyPssN3YkhqOJl4UWmIO+gbA agHARrixznilq2Wuz/W8WEdYBVFHiiV/YAO+jxkRGfTb8j7isXTK1lMvsGAaljnSpEG5tr7 YONctU0hfEGMMd9SvQr1w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:+IIOzgpyUfs=:iMdRdlqkxA2961O/fF/WN8 CcJxoL2fphhDAhIBltVa6+Gt61QsWjNTOFQiqp1MqYVPg9/LFi3ErQAAVruRV7YdbfSaa9mGJ 1r0WVU7G6r8giQHEnP6SQFW4nWLjxin/D1KCbvlc6qSAjJ6vVFl0ueyjfQ+Fi4LX+s1oncHJW vDOYP+1To6pKCk7ZKQrtDy/rhEA0NTXarJh4gni94dM0HE/D0a7pCESI0iC2N4wjJdsbWvjBO 60olqAnUxBnn6DtJ9x7sg7fW2EkXkq9J4rZdAq8+n5fw8SRGLdV2YIdQGLGelKWDPMFrgZK1p G1ZNTYGy4XVQ+WRyzx4kFgQ2gfTeQBMS3uSasDhy/3DqXfNfY+9gEZlZoGHsls9UU4FSpt4QT naE81is5oZu5XB8WhhpmPgVbYzsS9KW8Hee3J7LIfeoUP6FSTxtUCfoiTw5E/VrneZm6t/F6d Iaop9Xga2XLJk/okoECprtGYovshzNQ2ju85E/aKRw5+IRMqM1+q867osQynyE8K1T0Ry0LXT OxIAszMbmXBnTRWViedHLRhWC54m0tpQ2w26mI8SqDO2fK7RyyE3jsPnMNaEocMILUGQ+hTxk egLHmH0JhSPS/PEumYbci3Xc4Xm1npOZXkoL4hTAAQWNMDDBaElo70zMEXWIoEZJqLKM47vrQ ZaqAvVVZUxRGlVmTRDpY/wHuXlsLIsvTB5zTs3f6fTystOzNzqC2xOpL1zox3J//miiRJgN6w 1OQ/pXgBPQ/C9hmGqy3EkDdGMMiO+bpfvLWawHn/qvQrGpxGmGlS21ycwg9KbUiiHqRuiXcAv SBFxzIBWer/VjW7mpIVfMsHuzbNS/YGKGPHCjciAEMG1GdYbGaL5uVxJJh/ISJGG1W68JlKYo tVVXn5q/6uLeJPWY91Jw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are two 'struct timeval' fields in 'struct rusage'. Unfortunately the definition of timeval is now ambiguous when used in user space with a libc that has a 64-bit time_t, and this also changes the 'rusage' definition in user space in a way that is incompatible with the system call interface. While there is no good solution to avoid all ambiguity here, change the definition in the kernel headers to be compatible with the kernel ABI, using __kernel_old_timeval as an unambiguous base type. In previous discussions, there was also a plan to add a replacement for rusage based on 64-bit timestamps and nanosecond resolution, i.e. 'struct __kernel_timespec'. I have patches for that as well, if anyone thinks we should do that. Signed-off-by: Arnd Bergmann --- Question: should we also rename 'struct rusage' into 'struct __kernel_rusage' here, to make them completely unambiguous? --- arch/alpha/kernel/osf_sys.c | 2 +- include/uapi/linux/resource.h | 4 ++-- kernel/sys.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) -- 2.20.0 Reviewed-by: Cyrill Gorcunov diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index bf497b8b0ec6..bbe7a0da6264 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c @@ -963,7 +963,7 @@ put_tv32(struct timeval32 __user *o, struct timespec64 *i) } static inline long -put_tv_to_tv32(struct timeval32 __user *o, struct timeval *i) +put_tv_to_tv32(struct timeval32 __user *o, struct __kernel_old_timeval *i) { return copy_to_user(o, &(struct timeval32){ .tv_sec = i->tv_sec, diff --git a/include/uapi/linux/resource.h b/include/uapi/linux/resource.h index cc00fd079631..74ef57b38f9f 100644 --- a/include/uapi/linux/resource.h +++ b/include/uapi/linux/resource.h @@ -22,8 +22,8 @@ #define RUSAGE_THREAD 1 /* only the calling thread */ struct rusage { - struct timeval ru_utime; /* user time used */ - struct timeval ru_stime; /* system time used */ + struct __kernel_old_timeval ru_utime; /* user time used */ + struct __kernel_old_timeval ru_stime; /* system time used */ __kernel_long_t ru_maxrss; /* maximum resident set size */ __kernel_long_t ru_ixrss; /* integral shared memory size */ __kernel_long_t ru_idrss; /* integral unshared data size */ diff --git a/kernel/sys.c b/kernel/sys.c index a611d1d58c7d..d3aef31e24dc 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -1763,8 +1763,8 @@ void getrusage(struct task_struct *p, int who, struct rusage *r) unlock_task_sighand(p, &flags); out: - r->ru_utime = ns_to_timeval(utime); - r->ru_stime = ns_to_timeval(stime); + r->ru_utime = ns_to_kernel_old_timeval(utime); + r->ru_stime = ns_to_kernel_old_timeval(stime); if (who != RUSAGE_CHILDREN) { struct mm_struct *mm = get_task_mm(p); From patchwork Fri Nov 8 21:12:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178974 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3289333ilf; Fri, 8 Nov 2019 13:15:33 -0800 (PST) X-Google-Smtp-Source: APXvYqw96zzHm8yXoPCSFJMomkUExCDf5KUYnyRaPH6k+o0eLS2rMxzonB65Fw6Z0Jclz8/oCSq3 X-Received: by 2002:a50:f403:: with SMTP id r3mr8210644edm.275.1573247733015; Fri, 08 Nov 2019 13:15:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247733; cv=none; d=google.com; s=arc-20160816; b=FgQVK9TUU9urPngtUcCu4fxcNxuLNxslNoJo8MskkB3nQXuw0S6aT0+MEf0rt0f4Ph G9LlKYg/pM4PTljgvHbl82duPOEGPxuhNgnXpbRFwb1Wz6vlKOq6sOUn+KoP1fWFz1vN HzIiXWgvex0Wr3TEgpp+AHOh71E+74IauLhFyjr8epddbMxN56WNNs5v7tpS1I18yy2D JlvoR9aiYa8coVroac4VkIbr2/DfrubsGbSN/x5Lw83ceKvWCUnk8UdXTg92yLVnMW0n WGrt7/UAbq3Lfn6ZfbL0XK6KJs+JN+jGtJvSyboRh4ZMpL5OgyBDg//1jU6IkiDSLjQ7 3/EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=tiep25j4BmxLrRocudG1TvmUh1G+D3OO7kQbcf388A0=; b=NztonzYtX6to5eAku8LUv6kpU/773U9Dmbg5iI/1gg4pW2htjpdfkEBAQ0FnZzfjMa SOT06sL4kkHN/wJ2786403kPz4koSp+qvQHPNrHHGzUCG2FBXukVxH/uNP0wnDt0ba49 V6yZDJBKP9fl0bNwaLAJDASdRXjZKBJfae9Od5eAgO1eWrtPDAfGmnDoKMfxU+zoIePd LPJbjPLrYvgIt8RCvuwdpgnIFHK0WU9RBLQRE0qayPFGmWFpUAZXcWsJfaifZUPPXHSU S9a/8YwGgkahjFWVzF7B7McNfAMvwexPdBkI0BVd43D/kMCiIdjqW5ogcYqlA4x8OcYO Q+ig== 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 b27si5291428ede.48.2019.11.08.13.15.32; Fri, 08 Nov 2019 13:15:33 -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 S1732887AbfKHVPa (ORCPT + 26 others); Fri, 8 Nov 2019 16:15:30 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:46059 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732425AbfKHVP3 (ORCPT ); Fri, 8 Nov 2019 16:15:29 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MWjUc-1iQvSV0sdk-00X7z7; Fri, 08 Nov 2019 22:15:15 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, "David S. Miller" Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Deepa Dinamani , Willem de Bruijn , Thomas Gleixner , netdev@vger.kernel.org Subject: [PATCH 13/23] y2038: socket: remove timespec reference in timestamping Date: Fri, 8 Nov 2019 22:12:12 +0100 Message-Id: <20191108211323.1806194-4-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:IYjzYvve4HwgUd3LWF3hcYp3XGsNmdTj+aFo75G76y0fsDG/owT ArX9Fi9VGH6tv0x2woDwVeV2R1dyaK92WLIrAqWENK5veUYsaDwJLWeK+JhypYxcISRcRJC cjsePdvza6eEmh7shkRvT11+XeE7Jl86ZUT3hXuYyPzgHwwInuDwicN5DrCsWFhJKtCuPjh Lj4cBfFfvsY9G33VIjgMg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:JlPu9h1gens=:OPJRztXUGTZz2MC1IDn4A0 suSnrJB6u9/B1GtIPFzBJHmgAdvL1Ct0kLw5rVLgbNe47vdnDYTiED7S0hvkBpgaiQzWUt9Ip ArswN/3rSOq7zFwVqlEVHIbP8d1BuiAHsyN8e5RindxJOiycaVSaS5Y1oi32Os/qbDSIkkuyK sjRLh0S4aQrFAqwpgD/7HZ31JUu+hXWwpuQmgYDFO+5Oq2fQTaiIDPJKbcnwBUfzbPIpEQGvO +FhnKSj8eztpH5p5pZ8YqN8n7PrVujwmZ/xWiV3ZVLFUaN5Z8H7RDPq8+KaXaCyWR1inurjel qfA9vXCz7LaCygipg5Mu6BQNgHEkyr2ykhEYce7S3bd0fQdlvRQsrWBf54nRfGnAfuv1QzPSn IQnplaQckYXxGOp7fAXNZHyND4yIGxQsOiBmKpShA4rbqt2xnUt4N6o9mp1eaQ6L6SrKcUCCZ 8cy5eeTJypxnGCop2Q7rR8oKvS3WGPBfiNifrh+hLaeYFQLAiuHeUQnAwUj2oKFkNyhZqswTk driyMfXxKWergCWqDajaV4fEwBIiay2ni+WsHR5BMPVxguf7j9YhQE3Qg2u5gSKWl2N/1JKYj r/VPkNJXvNAoqY2eDo04u4k9QjOW5nabavScLniw7jFoH9rtmDQ/XpyKX2CVmD4vSvux2fl2V PAQL+KTlL3Dqaa0gijc2BT2Aw1RHLMexVwKfAaHELJj5dH0p3V6hndkwLHoUjnRVQeEZIeuj8 DNrnzhYmF0hLP4xMa375H6hJeDfTtbeHQzNltykTUCMTaRo/aii/4J4tLhM7seeBDbGA8ag+p RPvMp7BA6rRrvkZRXDcmQkb6omOI8f/hRxqsxjnXZfzNB8LKJI5oRPfP/tyZKC6FccGPlUMll 1f4KMOnfZr+BcbtIkimw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to remove the 'struct timespec' definition and the timespec64_to_timespec() helper function, change over the in-kernel definition of 'struct scm_timestamping' to use the __kernel_old_timespec replacement and open-code the assignment. Signed-off-by: Arnd Bergmann --- include/uapi/linux/errqueue.h | 7 +++++++ net/core/scm.c | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) -- 2.20.0 Acked-by: Deepa Dinamani diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h index 28491dac074b..0cca19670fd2 100644 --- a/include/uapi/linux/errqueue.h +++ b/include/uapi/linux/errqueue.h @@ -37,9 +37,16 @@ struct sock_extended_err { * The timestamping interfaces SO_TIMESTAMPING, MSG_TSTAMP_* * communicate network timestamps by passing this struct in a cmsg with * recvmsg(). See Documentation/networking/timestamping.txt for details. + * User space sees a timespec definition that matches either + * __kernel_timespec or __kernel_old_timespec, in the kernel we + * require two structure definitions to provide both. */ struct scm_timestamping { +#ifdef __KERNEL__ + struct __kernel_old_timespec ts[3]; +#else struct timespec ts[3]; +#endif }; struct scm_timestamping64 { diff --git a/net/core/scm.c b/net/core/scm.c index 31a38239c92f..dc6fed1f221c 100644 --- a/net/core/scm.c +++ b/net/core/scm.c @@ -268,8 +268,10 @@ void put_cmsg_scm_timestamping(struct msghdr *msg, struct scm_timestamping_inter struct scm_timestamping tss; int i; - for (i = 0; i < ARRAY_SIZE(tss.ts); i++) - tss.ts[i] = timespec64_to_timespec(tss_internal->ts[i]); + for (i = 0; i < ARRAY_SIZE(tss.ts); i++) { + tss.ts[i].tv_sec = tss_internal->ts[i].tv_sec; + tss.ts[i].tv_nsec = tss_internal->ts[i].tv_nsec; + } put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMPING_OLD, sizeof(tss), &tss); } From patchwork Fri Nov 8 21:12:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178975 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3289397ilf; Fri, 8 Nov 2019 13:15:35 -0800 (PST) X-Google-Smtp-Source: APXvYqwyk2t6IkkSHvIXN37UKsl5JPcxfvrhghRYky3nWd7x1HwNiVWS9SKVzcvUZ+5Ea2w9bT/D X-Received: by 2002:a50:8264:: with SMTP id 91mr12671515edf.69.1573247735502; Fri, 08 Nov 2019 13:15:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247735; cv=none; d=google.com; s=arc-20160816; b=hEBJTQryUzw2dkqRkxcW0LwA+2GGz6xixHLGML1F8JYURUisXUbR0HUouD3KLSUFKf Ge6ZGwt5hb0T9VheJDbuMTfyQkblo7SSc29syXdg0JaKIzZ5LlCK4vcBBfDtaDxlmrvh iAk7t9ZwiWRIJJoo4B4IxwSmo9PH375ACzqItGaCLZdS5txAZirFz4wmWcSRsSaRyao8 +CikOmOauSB1BZkt0Ve7wGj525je4XWQVbvjHBa9johTWXldNtzSQy8KvCS6njnb59D4 hAacvUeKfKEUJ3zSYs0Q9FPkzBw2do3OhvzTuEXYDeRdHcJoSXWNi57kJzw+kWS6bAtX 4UxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=BhYVVh+mekxV9wZb0Cqw+E9oNUJt6mVwCfjxrra34AY=; b=PY1CBXSvqsnrSCjZ7r04C1JzycGIc27o4LqoQ7sCkQqD7++xk9ESoeryxDQ5eH3lCh +Dw1I9W+jYNjrFKP8FUXykJ/yJClb9WPWo9jGjwPStFdlxq6lSGdEWDdSN6uAycFsWnr mkwauvOa2sjgcPD+ht72u1l/1HEeXGySaF4DotgHii8UXhOMJpJE9V991D6h5VdjjxZU v5GnxKU9V416hqG7YHQXMgfT8zlOQZrGoAxl+0tLx7TUPk9L1O46F27X3ySEm2djtciR O84beHYtImNWwB0O5g5Rs4n5oht6AnDvXhtN5/7iKF3GICUW8WqVeb0v4vbF+5+Kp1rZ 6dAA== 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 b27si5291428ede.48.2019.11.08.13.15.35; Fri, 08 Nov 2019 13:15:35 -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 S1732914AbfKHVPd (ORCPT + 26 others); Fri, 8 Nov 2019 16:15:33 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:33779 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732101AbfKHVPc (ORCPT ); Fri, 8 Nov 2019 16:15:32 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1N3bCH-1hlI2n3QdX-010fBS; Fri, 08 Nov 2019 22:15:26 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Deepa Dinamani , Catalin Marinas , Andrew Morton , Oleg Nesterov Subject: [PATCH 14/23] y2038: make ns_to_compat_timeval use __kernel_old_timeval Date: Fri, 8 Nov 2019 22:12:13 +0100 Message-Id: <20191108211323.1806194-5-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Pfme16M9JKU/1lQYMjSUnUlUlunFko9yGD1/qMR1+QbuE78z4pf ZHI88gH+wz2J6OBPQID1DtDxbizptVLZT1jhAxDXEzsVfN7ghgDqvT96Hx+hRxj+0iznIqt /PVpStGxYFsdM5EoOazNF0V9hzc3ECTCD9sJDscIIwFm3LzbpdHtOT9CepwMwhnnRp1dkgh bgsEBYh4LC7QcFloIaBXw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:BXLkiyXx/ek=:6ux6MXiobQDoYSdUr8teJu Qdu+4y/M2l60Hz+zNN940bfImgo3biC7NDpp6eKqPDDRzYbC71KWA7Hofa/py/3EpjDnbZTVL hyl8IuisupTzJvHQ9dtiFcGhn7gNrAduwMr24dNU/3NYUpiqpaiFN2oamfbtvbXkQstLty5ev DVKLexf7lAzU24EiE9thHI8iU54ku+p4C2kHt0ocPp9mHDm/zCvb34TrqLDnC8cCcbsVZ/NbF lVyLegS3fhlsHkVaAUUuYjFsGpg0hl9MfmfdcGh4QtJ1q0SlOwFny8quFBhuy9anyyiLd7Tyy 1RP/STEVAqsEXCOr9O0frVj38AbbWYAJ6ynQ002lStuq1uq03mzUq4faqi8nm7lRB2LYj8975 3qPOLAL2Gk/kh3ZulEQNHXtaGefQ9j09PYYI9rENTnMIAsLn5IjymW4cR73UBWw7sdtWDpaP/ hg47QQSK8cXXbl/jKBPiPCy3TpgOo7T1L9DAALv71cYgRk2mUhR9sc0On1enZS5IcJwKpwM4f aXGKhyE5IUPWFeEKn72L3yQs83CdLkqF2pG9gOxbGP7gdYKk032Nme0eKNZKue4Xi3Lzt76J5 8pUhtsrOmdPBrXgi1EjrQ1T+Qy431V6ptjBBYO9iAgxK+epkMXJaOdlHUsrNkksM7g/qQyDIK Xrcil36hElxlcsPhlGe2PP1vWGDp0FKgWVMI6jo3eciulj4QUes7ERrPc81OkzB/fpWzXIxOn WveEHEHcg2Q+e+gGmHwxeVHyM6h4SaOLX4KBA9AxaZ1TU0tHIjL1CZeW7P6c8Jez3+o7w78A/ 81zzirRiIYllZL+9/ABM92Za7yx/GU5Ywl5mpUSpDbRjlkPNcpQmX7To9iWb0A+L+6hwrWSzM KCrNO2bIVQpTWZ2nGtHw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This gets us one step closer to removing 'struct timeval' from the kernel. We still keep __kernel_old_timeval for interfaces that we cannot fix otherwise, and ns_to_compat_timeval() is provably safe for interfaces that are legitimate users of __kernel_old_timeval on native kernels, so this is an obvious change. Signed-off-by: Arnd Bergmann --- include/linux/compat.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.20.0 diff --git a/include/linux/compat.h b/include/linux/compat.h index 16dafd9f4b86..3735a22bfbc0 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -937,10 +937,10 @@ static inline bool in_compat_syscall(void) { return is_compat_task(); } */ static inline struct old_timeval32 ns_to_old_timeval32(s64 nsec) { - struct timeval tv; + struct __kernel_old_timeval tv; struct old_timeval32 ctv; - tv = ns_to_timeval(nsec); + tv = ns_to_kernel_old_timeval(nsec); ctv.tv_sec = tv.tv_sec; ctv.tv_usec = tv.tv_usec; From patchwork Fri Nov 8 21:12:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178977 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3290361ilf; Fri, 8 Nov 2019 13:16:15 -0800 (PST) X-Google-Smtp-Source: APXvYqyMbIH3wwswQsrYnFQXLNNvSRSHl5tQvBH9vhp79IWT8qLdCSYAAYWrExbXjbaY58/w5WXy X-Received: by 2002:a17:906:3b07:: with SMTP id g7mr10850141ejf.114.1573247774989; Fri, 08 Nov 2019 13:16:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247774; cv=none; d=google.com; s=arc-20160816; b=0W3e2OM/y07qWzryOaiC7qOpQx8Ap7FcgreIC0vsdDdhImFvqmLjRMH62wOSwvNMR3 ynHXmDGv11mrUARdxKfsndH3no3oeOdBAk6sKKOCuCtbSGSMMUYGnxNDaWky0jIhEZmS 1rX65c/9N0qBWeRVt2hIpuUAMPLaaxaT2wRj3pYJf/ARRgxTVxPyorPpHaMGdZihprS4 hD/Dnymae29aXr7yd8TbAdhpfjuR28W/GqQLQ+O95yxdBDwgfh5Xg+hb7FSJ5KJUDl9q My9dburTyH3WzANnBAFZ/cdkxDoTTMNfe8JSLzp4CnNIEfAtE9GpVyTXTM2ipN+aKgol RGGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=hTQyeABqY4EPfTNGBMPuduXUDeYdQFltgBXyQX0YtD0=; b=Pdn2PuTjZ6E7npMfiN0Vdp9fiz67N9WzGtM/LcrISUfi0XFnO50iAMsJR1tS1oX3g2 MktTOWzxwNk3BQ5b/pCxied7V8MZUq41eYUTcjQiu/Z7j/PduiBVH8I5zValsbztCtJF Teb4ZbsM1rLutrMPbgi0/kRVj9HSGA38ofoQOskmb7MpCkzYVO0tWgLmP/UARlB68XUU wlrWAhcmQnkUgFNfWFuebe0Xnr1DbftoAcmddOhDtYrHgCftH10p+9SL4UzoTnaC12ap MPXCZWemj34yqcymLLMRI5rV0JNI6ALMQts8D6bQjAM7e/Rnsm6/gZQbyyZU9YKzLFaG GW8Q== 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 c53si5207479eda.396.2019.11.08.13.16.14; Fri, 08 Nov 2019 13:16:14 -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 S1732994AbfKHVQM (ORCPT + 26 others); Fri, 8 Nov 2019 16:16:12 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:49463 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731181AbfKHVQL (ORCPT ); Fri, 8 Nov 2019 16:16:11 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MCsDe-1ic1JZ3Rz6-008poH; Fri, 08 Nov 2019 22:16:01 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Ralf Baechle , Paul Burton , James Hogan , Alexander Viro Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Andrew Morton , Alexey Dobriyan , linux-mips@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 15/23] y2038: elfcore: Use __kernel_old_timeval for process times Date: Fri, 8 Nov 2019 22:12:14 +0100 Message-Id: <20191108211323.1806194-6-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:jJojK3GiEOpLM7nwlbXZNSOESRosCVwj5pL0X9lm4+C8cBKFL1S Dgm24ZnjpoaIvukTU6X4jJfn96PXIzcY6MP6bjF62TfoHkAeQgzH49ROujOrn1fpIsoM09/ HKTa02uW1U4TPcKiz4g9gPFN0Fa+heEeG/9P/EZq+4emvnDDomoY5uqxCtc8uZ30umxaNar ZBjGfTscleMnAJ5MoAZEw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:z4ZvUmxYbvk=:tdMp3SjJI1NixeGmYbfJi1 FjhwWRH2/gb/09RHbThSA8EWr9HJj33qjeVhZwnt/bGUO7te3W9PkAy2rOO5/fyC6ObdbEytF tXdZ/OglNAHLMt+mdK5/3ayYW7Wo1VlFf1X7+bUshD0Gg8vRXSjPvhYJXxCg42V0rgb4DSK+P 9pw6S6Pz4T+fsw5ArKd1S97W3cpScnh8YItd65tyvbQV6cqqgUMQB3o2I3/P2NrzW8TKy21yT GIkNg6cnTALOmJgixhpr60A0W3V0LokMsZhOFFhlipifv63toB2cLBgC2S+0+rWBby3B429GJ FBMQCmgQ4xpvBVswkV+AVCVJ22DbC+4aWihAwqH1kmJbK0dXsH/YC/kjO6V2Ld8P8uBx+VWaU Sv0pg9mh8S2EdoailtDfaPxIP08cryt5pbM1jSFUUnA5NzRN0x0Dx1cHV3BxZnimCvE/4lfWy gMUF2olUoIIRGg9DKSXyyRa9/CC2Qo4sB3owLaZoa90zbnXwPvIUy1xkqCA4+M3w176fA7j19 HnMbSCB5fHJwkAzND9qhijd9AZgGIAFHsCyZRk0QboVJQAqaPDlHlIiLIo89U2aaCv4a3aBlA 7cvcsSV2v+KYGc8EPn0ffryoObhQT/u7aRhYQnPLKo/vsRw/bfb2reWRad7eGbY7D+rhz+x9Z f6px8k300Q4cNH/UFOQO9GJoyTknzJEIlnGjwhgsXU4+gabUlKojJU/BnPL3IyHucwiXq1bde JZyBcT2IxQJTiY9RnxAE3vi15RScKIqutA0/jGROBiyrxYrJMsxOxIucHd+bg7/xsiC2B96Bl SammEu9W73fW1aNQrtZJkaDfe8mm2Vk/HDHulH9O8C96BQQT1YXlj3adbprjoTCK7mTq2lbKX xk7TJfpJIXabV0bRrP4Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We store elapsed time for a crashed process in struct elf_prstatus using 'timeval' structures. Once glibc starts using 64-bit time_t, this becomes incompatible with the kernel's idea of timeval since the structure layout no longer matches on 32-bit architectures. This changes the definition of the elf_prstatus structure to use __kernel_old_timeval instead, which is hardcoded to the currently used binary layout. There is no risk of overflow in y2038 though, because the time values are all relative times, and can store up to 68 years of process elapsed time. There is a risk of applications breaking at build time when they use the new kernel headers and expect the type to be exactly 'timeval' rather than a structure that has the same fields as before. Those applications have to be modified to deal with 64-bit time_t anyway. Signed-off-by: Arnd Bergmann --- arch/mips/kernel/binfmt_elfn32.c | 4 ++-- arch/mips/kernel/binfmt_elfo32.c | 4 ++-- fs/binfmt_elf.c | 12 ++++++------ fs/binfmt_elf_fdpic.c | 12 ++++++------ fs/compat_binfmt_elf.c | 4 ++-- include/uapi/linux/elfcore.h | 8 ++++---- 6 files changed, 22 insertions(+), 22 deletions(-) -- 2.20.0 diff --git a/arch/mips/kernel/binfmt_elfn32.c b/arch/mips/kernel/binfmt_elfn32.c index 7a12763d553a..6ee3f7218c67 100644 --- a/arch/mips/kernel/binfmt_elfn32.c +++ b/arch/mips/kernel/binfmt_elfn32.c @@ -100,7 +100,7 @@ jiffies_to_old_timeval32(unsigned long jiffies, struct old_timeval32 *value) #undef TASK_SIZE #define TASK_SIZE TASK_SIZE32 -#undef ns_to_timeval -#define ns_to_timeval ns_to_old_timeval32 +#undef ns_to_kernel_old_timeval +#define ns_to_kernel_old_timeval ns_to_old_timeval32 #include "../../../fs/binfmt_elf.c" diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c index e6db06a1d31a..6dd103d3cebb 100644 --- a/arch/mips/kernel/binfmt_elfo32.c +++ b/arch/mips/kernel/binfmt_elfo32.c @@ -103,7 +103,7 @@ jiffies_to_old_timeval32(unsigned long jiffies, struct old_timeval32 *value) #undef TASK_SIZE #define TASK_SIZE TASK_SIZE32 -#undef ns_to_timeval -#define ns_to_timeval ns_to_old_timeval32 +#undef ns_to_kernel_old_timeval +#define ns_to_kernel_old_timeval ns_to_old_timeval32 #include "../../../fs/binfmt_elf.c" diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index c5642bcb6b46..5372eabd276a 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1489,18 +1489,18 @@ static void fill_prstatus(struct elf_prstatus *prstatus, * group-wide total, not its individual thread total. */ thread_group_cputime(p, &cputime); - prstatus->pr_utime = ns_to_timeval(cputime.utime); - prstatus->pr_stime = ns_to_timeval(cputime.stime); + prstatus->pr_utime = ns_to_kernel_old_timeval(cputime.utime); + prstatus->pr_stime = ns_to_kernel_old_timeval(cputime.stime); } else { u64 utime, stime; task_cputime(p, &utime, &stime); - prstatus->pr_utime = ns_to_timeval(utime); - prstatus->pr_stime = ns_to_timeval(stime); + prstatus->pr_utime = ns_to_kernel_old_timeval(utime); + prstatus->pr_stime = ns_to_kernel_old_timeval(stime); } - prstatus->pr_cutime = ns_to_timeval(p->signal->cutime); - prstatus->pr_cstime = ns_to_timeval(p->signal->cstime); + prstatus->pr_cutime = ns_to_kernel_old_timeval(p->signal->cutime); + prstatus->pr_cstime = ns_to_kernel_old_timeval(p->signal->cstime); } static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p, diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index d86ebd0dcc3d..240f66663543 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c @@ -1359,17 +1359,17 @@ static void fill_prstatus(struct elf_prstatus *prstatus, * group-wide total, not its individual thread total. */ thread_group_cputime(p, &cputime); - prstatus->pr_utime = ns_to_timeval(cputime.utime); - prstatus->pr_stime = ns_to_timeval(cputime.stime); + prstatus->pr_utime = ns_to_kernel_old_timeval(cputime.utime); + prstatus->pr_stime = ns_to_kernel_old_timeval(cputime.stime); } else { u64 utime, stime; task_cputime(p, &utime, &stime); - prstatus->pr_utime = ns_to_timeval(utime); - prstatus->pr_stime = ns_to_timeval(stime); + prstatus->pr_utime = ns_to_kernel_old_timeval(utime); + prstatus->pr_stime = ns_to_kernel_old_timeval(stime); } - prstatus->pr_cutime = ns_to_timeval(p->signal->cutime); - prstatus->pr_cstime = ns_to_timeval(p->signal->cstime); + prstatus->pr_cutime = ns_to_kernel_old_timeval(p->signal->cutime); + prstatus->pr_cstime = ns_to_kernel_old_timeval(p->signal->cstime); prstatus->pr_exec_fdpic_loadmap = p->mm->context.exec_fdpic_loadmap; prstatus->pr_interp_fdpic_loadmap = p->mm->context.interp_fdpic_loadmap; diff --git a/fs/compat_binfmt_elf.c b/fs/compat_binfmt_elf.c index b7f9ffa1d5f1..aaad4ca1217e 100644 --- a/fs/compat_binfmt_elf.c +++ b/fs/compat_binfmt_elf.c @@ -48,8 +48,8 @@ #define elf_prstatus compat_elf_prstatus #define elf_prpsinfo compat_elf_prpsinfo -#undef ns_to_timeval -#define ns_to_timeval ns_to_old_timeval32 +#undef ns_to_kernel_old_timeval +#define ns_to_kernel_old_timeval ns_to_old_timeval32 /* * To use this file, asm/elf.h must define compat_elf_check_arch. diff --git a/include/uapi/linux/elfcore.h b/include/uapi/linux/elfcore.h index 0b2c9e16e345..baf03562306d 100644 --- a/include/uapi/linux/elfcore.h +++ b/include/uapi/linux/elfcore.h @@ -53,10 +53,10 @@ struct elf_prstatus pid_t pr_ppid; pid_t pr_pgrp; pid_t pr_sid; - struct timeval pr_utime; /* User time */ - struct timeval pr_stime; /* System time */ - struct timeval pr_cutime; /* Cumulative user time */ - struct timeval pr_cstime; /* Cumulative system time */ + struct __kernel_old_timeval pr_utime; /* User time */ + struct __kernel_old_timeval pr_stime; /* System time */ + struct __kernel_old_timeval pr_cutime; /* Cumulative user time */ + struct __kernel_old_timeval pr_cstime; /* Cumulative system time */ #if 0 long pr_instr; /* Current instruction */ #endif From patchwork Fri Nov 8 21:12:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178978 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3290755ilf; Fri, 8 Nov 2019 13:16:34 -0800 (PST) X-Google-Smtp-Source: APXvYqy92Vn4sknaJP4mbWUDNC4kTMYtk9XnMa3DCBPbvsO7e40ct3AUPyapZPm+vHveAzdZqO1+ X-Received: by 2002:a50:e605:: with SMTP id y5mr12244436edm.12.1573247794208; Fri, 08 Nov 2019 13:16:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247794; cv=none; d=google.com; s=arc-20160816; b=u+Xr1NpyPrY84pAZHmznXCJ13rvYei4yb68ndZ+WrS71gTYNDzjihGU1m1Pz9ikWDw KBiiQLaaEWqk4qL/kd5c9wFlV7cbHB7QX73kl3RunbGPNrlV5Xj2BxIC0pns+gxpsRli rYj1fNP03K8x64vuWx2cW69LIRFA77f1jKl1+m/hMx14bsoiQrOIuKeEKlA+cxs0XMKr DYa15rp7NYJljynzVvVJXbUEjdGQjS0Csd17pEUji2H0nqCsY13+4XkVAshmTxpQh3Wd WGMLsSNKMu9RUbEMX0n5SBOAiAnTQkz3yL/uN6zyTVPjqUz3LgKmnxDz792vuevRZuk/ EXJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=nQFh6BmoLFLnYVdHYhKM0ClrCwCLi/z3RY7uAO+pCF8=; b=mhCyFTpckK8R2bq14M9PcSRIXkpg5cQTHjDEpDT9IeduD/tVySQG4DwYrsDbnAT3jr cwRJmpHuNwMRxpOqL6ZdDuaVPTCL0t9QUFCfVNFA83DJGM7xqzc8BfJxFYBX/V76cYOk kD3ZX45YlVSZXRguEYhDy0psNP2GumXw4WnkdHvM2q3nUSXQCANhrSMrqO0ep5k5cwje B9i2tKuTKW0qoh8GOY0H+WnLggK2JiLG8URcJri7CipsFA6V3LgiQrHNTq1Eh9+4pguM ywlQG/Hmqk2/1XEZgIXYe3GI9OiIBQyHqE5oDUE8MoEVdTJ/h4BVxoGL4MdOOQJ2qDHY 7lLw== 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 x37si5832653edd.228.2019.11.08.13.16.33; Fri, 08 Nov 2019 13:16:34 -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 S1733015AbfKHVQc (ORCPT + 26 others); Fri, 8 Nov 2019 16:16:32 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:58299 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731181AbfKHVQb (ORCPT ); Fri, 8 Nov 2019 16:16:31 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1M4JVv-1iSuV33qcL-000H5U; Fri, 08 Nov 2019 22:16:21 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Thomas Gleixner , Alexander Viro Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Catalin Marinas , "Peter Zijlstra (Intel)" , Sebastian Andrzej Siewior , Anna-Maria Gleixner , linux-fsdevel@vger.kernel.org Subject: [PATCH 16/23] y2038: timerfd: Use timespec64 internally Date: Fri, 8 Nov 2019 22:12:15 +0100 Message-Id: <20191108211323.1806194-7-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:f99ERCJnaEP6l1FjibSXxcsOLJa++GmL0I70TNMWQOU34Uv4PDX 4k8qz4hBKqfkFDCXzllbDhvO4JPGsO4Gyq0ZmO2QqnY5gw94EUNCLWlqFqVqavgc4qxeQOy 1Vm9PZMeYtelGu9Cd9ZSuw+suaPXoCYxh2IF8qUpjaSvm57fdogUtXtLxVNtn/k+dTYz/qq 5G4Oue57/1o4PI/8aR1KA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:OkS73SaoqFM=:S+wceWhB+XNIMJ5HNqWit5 Q3+TZe+gn6GOOFrvUfbvpDgm0Hhkc+dotB+2We9f20vQcgSdkXSa50DZXK0YA4mzI89+fC5nB cLo8flDUnLvtMmYSmqres7JtqLmpQFpZX8cj070PDVFCkebnoszEa5034Y8FW6eu9PH4e0gj4 2zxiOCWw+Bx2BjpBhiuJC4jRoNbakTqLFqlw+ULkkUL7YD7Z/nKB3RKpkWBdJ9ALo9/w3qupN xBnCoDpVkjSSx24S5136GIctdOgTIAUCoxx0cu36TIO6pTnhH3kAA+H+14GcMaSrY5FKbtnkr JcDCBpKiNRGOrlvSfHe14Ctrl3c4Gg8hiU8j00U/kqDmWwEd1MW14NyzcNJVyCxB+5HW/U/wA COp6thxQBXwYUmqGskKaqH3myKOMgSKwk3HoL56m71vcePLblIy5QZJCBiLnw2XfC46MBoWYx 1BMdaCnB0f+fWDWCn9qRdW+WXHDqJf+UASmsbn6o5UJKJNM3E4eWosOg+f4yqG8Yq7wRAtfK2 Khhhge+dZhERKGj9Qm6tVOJjrHbHYM7e/llhGOX3dZy4XOIhYzDKndv+bBKr1zKYKKNa/SR4y UBxbe6qY/Xvj7P7deT3+XrTIeG76lTaXqn1Oqpc1jhSEvEqucK8FrZfYRO2kfLT60cw+XgFX2 YlugG/Wky/czeO/7hd+wNB2V/9fSpapLTiP9Rk+0uiYjhk9Xukk2XNtHAZljSOtsNBZfayOXQ QC2oDE4+CAReHgKBjYHnoomccIouL9Ib8ssHuwDd6Dvr56Aymrc7VKz3xvxy4GYp3FdVh5S7m OXtwykXFhcmiy8Kr8PxH9WXJ8x3oju+NozZ8bMGVzuthp/ZUuEb77ViqksNFBaj3edaowHO7I LqNutc85Y4X02TS+66GQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org timerfd_show() uses a 'struct itimerspec' internally, but that is deprecated because of the time_t overflow and a conflict with the glibc type of the same name that is now incompatible in user space. Use a pair of timespec64 variables instead as a simple replacement. As this removes the last use of itimerspec from the kernel, allowing the removal of the definition from the uapi headers along with timespec and timeval later. Signed-off-by: Arnd Bergmann --- fs/timerfd.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.20.0 Reviewed-by: Thomas Gleixner diff --git a/fs/timerfd.c b/fs/timerfd.c index 48305ba41e3c..ac7f59a58f94 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c @@ -302,11 +302,11 @@ static ssize_t timerfd_read(struct file *file, char __user *buf, size_t count, static void timerfd_show(struct seq_file *m, struct file *file) { struct timerfd_ctx *ctx = file->private_data; - struct itimerspec t; + struct timespec64 value, interval; spin_lock_irq(&ctx->wqh.lock); - t.it_value = ktime_to_timespec(timerfd_get_remaining(ctx)); - t.it_interval = ktime_to_timespec(ctx->tintv); + value = ktime_to_timespec64(timerfd_get_remaining(ctx)); + interval = ktime_to_timespec64(ctx->tintv); spin_unlock_irq(&ctx->wqh.lock); seq_printf(m, @@ -318,10 +318,10 @@ static void timerfd_show(struct seq_file *m, struct file *file) ctx->clockid, (unsigned long long)ctx->ticks, ctx->settime_flags, - (unsigned long long)t.it_value.tv_sec, - (unsigned long long)t.it_value.tv_nsec, - (unsigned long long)t.it_interval.tv_sec, - (unsigned long long)t.it_interval.tv_nsec); + (unsigned long long)value.tv_sec, + (unsigned long long)value.tv_nsec, + (unsigned long long)interval.tv_sec, + (unsigned long long)interval.tv_nsec); } #else #define timerfd_show NULL From patchwork Fri Nov 8 21:12:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178979 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3291571ilf; Fri, 8 Nov 2019 13:17:11 -0800 (PST) X-Google-Smtp-Source: APXvYqwCQ377hu/Y1g+KZ1dED/8yejozQbvE8RqNv05cJl/tmoxWryP7Qwq5+M/h5mlcmSYe5/wv X-Received: by 2002:a17:906:1342:: with SMTP id x2mr11040167ejb.304.1573247831722; Fri, 08 Nov 2019 13:17:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247831; cv=none; d=google.com; s=arc-20160816; b=eas8VWLETbtwHFMACt0dEnvNTtjRUfelPHW4Zgohdg8ALs4bnCRX1dFKFi93rfBT73 e1hPr9hGNkILgrRk3H+XV2Ft8Qd38lU0UvVHWfp19kulvxDb+xMwtEWOSWaYsqUwKbP8 tKuP4EObE5kAHB4TUt5uM13cgzX3G00ynM1GB/hrLuijO9HQhTHgfHaxTiDaMj0T5/S4 GbZ2bINpOaX/88BibGyQNPpcImqPSEOgxV1Uc60Tvs9dOiJDHGMz5DSVWO5kqtDlEvyE gSZnKsy7o2BkSuyFnkG0fs5OFJV3iFHBDUWtBO0mPHm7X/L+7yT5n8sgmlTUQr3QphpT Q+Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=gm5ELPhda9ajzvVS7bGQYJZrE8QTmm4r5OLMvHnx2IQ=; b=hkYUPn+7uc+uymsQ99ylFBzjv4D2/5X1adC41nDrM72whDQmQETsKiGc3elzO9PQMI Buzbton2K1wZvdp2vWlFPshbhKuI7JGNcMQtKXk91kGliLjxOQPFg/KJaDhtANcLj/zk 7gxsvqfE2hS/PYe+QUmN4Xyl6THokjuLkokFysvZl4N3op188fqA3uJj/+zszm2j2+PO VrXZmaDME+Moa1GDL/26FPr6vRiOsl4oDjyEhE8WZy+FazJM6z9HnE2UmMu+2rY5I2qX upWitPuVRdpzYRTzcd5pmPtBfycEMjqUYumVP2xN6cG8ixF8qDEqx5sZKuLkdwNARrNP Td+A== 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 t6si4563093eji.80.2019.11.08.13.17.11; Fri, 08 Nov 2019 13:17:11 -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 S1732713AbfKHVRJ (ORCPT + 26 others); Fri, 8 Nov 2019 16:17:09 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:39767 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729617AbfKHVRJ (ORCPT ); Fri, 8 Nov 2019 16:17:09 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MPGiR-1iGill2Ewf-00Pfj2; Fri, 08 Nov 2019 22:16:44 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, John Stultz , Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Stephen Boyd , David Howells , Al Viro , Deepa Dinamani , Christian Brauner , Jens Axboe , Ingo Molnar , Corey Minyard , zhengbin , Li RongQing , linux-api@vger.kernel.org Subject: [PATCH 17/23] y2038: time: avoid timespec usage in settimeofday() Date: Fri, 8 Nov 2019 22:12:16 +0100 Message-Id: <20191108211323.1806194-8-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:wVshbT+Rs8/VikEWMEyXeLpYFujcte2DKlRU0hq3zkGqSD7/ggC ygDEdVeGORYn8F1DRnmVs0ye4ZRZyC8WZ/oJHMj80QAM40h9DuovvRJCygRfF0NwTkUVUkc VXWiX8cyr522zIOPoE7TvSpz8nKEF8mVO/9HuXPoD3sh+O598eVubO6C2QnEWdYannsiPFb VmZ9O7pmhM+NyMWqgEdAQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:W0d6/OZZjqs=:Lbeg5117r3XMRKTKmdlxk5 1dxvM9R7+omevXsmSib0qdI+f2YGTdsEjwSm5vQ4e6493tRiVH5jvvgJtwWrfoL+dqrVXx4vk ELndXVbDDmS+PvmQ2GZVpXBPITzV1TiMwK1g73synyWXG277DBTJmR3MDoHGMZyj8ONCdnjGU YP1U7hREnmQ6aqfuSUm9zc/ZTNsPxOthF4ZinfgqvXGDgyMz/qCI2Ix8HL8t5oDkEaAdTqvCt c6mQoz9isAPifqiEBPuIV9uZpsycHnVV7Y2xKMEOg6U63YDb2ZZO9UiLtAVeJwUaZsiVEASoA Td2aAzVWivAHFDvycrFs3mhbZenqi6ZD3vU0rpk1q6PRyG+zIs9orqDnQs87G/hYMevPgv7Wd RIen7H5toNquKzyCQ5zTmNCyU5DM0zLKNZ7X73c0LfIPaErVxuPUspl10Ix0sX2Em1xOs/wIs HYOmOlJ9kNUfw12zmIHNSdBcz7oe6frliHbiNVW1nDhK2MGABOp9BZXPRZYzGsVtgIO/+2kCj qNte92VkmzjYU9aEoIgUo7YLMkOS5JZJLGMVWPyvZfh0Tu+xvr1Bzcsvd1GdACxxnbQE3KVfV QNGUdF24YEkGSZsHCwC7GzuRxt9RmZtw0+E/vwlEITefGw/9fGCH1AefXm5wxfCuhibNLKFxh nuAR/MzDCUJ3HVd49mKFbq0VQ2MlBrTvcOZ/qKWabpweS5h9ronRECXNl+HOItiyxLKX4TrX/ ugzVjBiUYdCNUzTRLV1iR1WxbekWHeOauVBEr4HhHBmpcSsnjRRJfIlrO50Zozpci7gRJ2Bke ZZg63CgHNX2Ajjj3wpMr5XK8kRi/lMK+NuMbEJ+iCiom1lKQAu4+z3C6PGvdEz3X3HAKb59vN FGHT6NNw6qywPEc3JeDA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The compat_get_timeval() and timeval_valid() interfaces are deprecated and getting removed along with the definition of struct timeval itself. Change the two implementations of the settimeofday() system call to open-code these helpers and completely avoid references to timeval. Signed-off-by: Arnd Bergmann --- include/linux/syscalls.h | 2 +- kernel/time/time.c | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) -- 2.20.0 diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index e665920fa359..d0391cc2dae9 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -734,7 +734,7 @@ asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct g /* kernel/time.c */ asmlinkage long sys_gettimeofday(struct __kernel_old_timeval __user *tv, struct timezone __user *tz); -asmlinkage long sys_settimeofday(struct timeval __user *tv, +asmlinkage long sys_settimeofday(struct __kernel_old_timeval __user *tv, struct timezone __user *tz); asmlinkage long sys_adjtimex(struct __kernel_timex __user *txc_p); asmlinkage long sys_adjtimex_time32(struct old_timex32 __user *txc_p); diff --git a/kernel/time/time.c b/kernel/time/time.c index bc114f0be8f1..6bfbe640fd3b 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c @@ -196,22 +196,21 @@ int do_sys_settimeofday64(const struct timespec64 *tv, const struct timezone *tz return 0; } -SYSCALL_DEFINE2(settimeofday, struct timeval __user *, tv, +SYSCALL_DEFINE2(settimeofday, struct __kernel_old_timeval __user *, tv, struct timezone __user *, tz) { struct timespec64 new_ts; - struct timeval user_tv; struct timezone new_tz; if (tv) { - if (copy_from_user(&user_tv, tv, sizeof(*tv))) + if (get_user(new_ts.tv_sec, &tv->tv_sec) || + get_user(new_ts.tv_nsec, &tv->tv_usec)) return -EFAULT; - if (!timeval_valid(&user_tv)) + if (tv->tv_usec > USEC_PER_SEC) return -EINVAL; - new_ts.tv_sec = user_tv.tv_sec; - new_ts.tv_nsec = user_tv.tv_usec * NSEC_PER_USEC; + new_ts.tv_nsec *= NSEC_PER_USEC; } if (tz) { if (copy_from_user(&new_tz, tz, sizeof(*tz))) @@ -245,18 +244,17 @@ COMPAT_SYSCALL_DEFINE2(settimeofday, struct old_timeval32 __user *, tv, struct timezone __user *, tz) { struct timespec64 new_ts; - struct timeval user_tv; struct timezone new_tz; if (tv) { - if (compat_get_timeval(&user_tv, tv)) + if (get_user(new_ts.tv_sec, &tv->tv_sec) || + get_user(new_ts.tv_nsec, &tv->tv_usec)) return -EFAULT; - if (!timeval_valid(&user_tv)) + if (new_ts.tv_nsec > USEC_PER_SEC) return -EINVAL; - new_ts.tv_sec = user_tv.tv_sec; - new_ts.tv_nsec = user_tv.tv_usec * NSEC_PER_USEC; + new_ts.tv_nsec *= NSEC_PER_USEC; } if (tz) { if (copy_from_user(&new_tz, tz, sizeof(*tz))) From patchwork Fri Nov 8 21:12:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178980 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3291723ilf; Fri, 8 Nov 2019 13:17:18 -0800 (PST) X-Google-Smtp-Source: APXvYqwTj7rzEHs2lRfQtujk9aPP6UVGSl45GhVDV4BNEmTkXyM9X2y26UJ7noNXde6vJT1DplEV X-Received: by 2002:a05:6402:1718:: with SMTP id y24mr12496071edu.220.1573247838640; Fri, 08 Nov 2019 13:17:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247838; cv=none; d=google.com; s=arc-20160816; b=SigYGdDIcfNkmte5k3/OxSWFL0kZMHu2/RnOsTsL+RQJ2pO9pi42QI6rtgjdXPdpBH 8iMnEzLfFurWR8BG5gNVvY0VJZ19KjvkU/1dkJNNbtuDQtETiHqjWz4EW7DeHwQ+j+4t tknModome8IvgM2F6Shx8VdWbBBmYCQc3f4wyeV9wUYEnTEwBUtmW89e0j7KSgx+9nym 1S7g1E344pTdc58jp5N019OU526NtcdwrrMlSwPkHmnMb/tEtXTfnRgq471F9OpypdTb XQX3ZdvZInxYRorrh0vFlijHnDJw3iAi4V9e4Nh5lbZFIh5aSlI4hoKJGoZtIv7wDEYy yxVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=tSF1SghEOxhVmPHfrhRRHFnrC7z1pmEE3scDTb9LEos=; b=l37cbubjmNzMaGVQMHQLoye9/hyMqB3toENNtNuir06w55lyxvOhY5MekiZJsz/fFj thpEKocLNbbeQnuJjOaypQ/RmlLT1YyxUL1pVDpsOn9p1O281zxtrUpEmVYBqCTfimir j5agVnUvYMY67zFLcYIAr/s5CU/lbDsf9k/DYt0/htBM8njrlVdSxqV0KgyUd0W+XwYS 3qydimxblRP+RQmNbW24d2zJwUiW/TXWgTb7NnyDvos2X8CI8eMrdADe4UGvUjkZPss/ 7V8O3f2f3JHSJKooQTC0esMp44F0EhESUEQ93jCPYYTxovm+gWVoa/JD/bu2X8fD3eij RJhQ== 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 t6si4563093eji.80.2019.11.08.13.17.18; Fri, 08 Nov 2019 13:17:18 -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 S1733018AbfKHVRR (ORCPT + 26 others); Fri, 8 Nov 2019 16:17:17 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:45351 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726095AbfKHVRR (ORCPT ); Fri, 8 Nov 2019 16:17:17 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MOzjW-1iGzrf2lB6-00POk9; Fri, 08 Nov 2019 22:17:03 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Deepa Dinamani , Catalin Marinas , Oleg Nesterov , Frederic Weisbecker , Corey Minyard , Sebastian Andrzej Siewior , Anna-Maria Gleixner Subject: [PATCH 18/23] y2038: itimer: compat handling to itimer.c Date: Fri, 8 Nov 2019 22:12:17 +0100 Message-Id: <20191108211323.1806194-9-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:sKTu+aehkLi4mpZI9L51qCcvfZPOune5jAXYr+8eQpsLlW4QCre AVECqXdKoJqyYpWVKN5iXyYkggKuyzdskAvwx8c4fwEmHcSu598+x8PAkTdgBJOBRnYqTiR PH+RnasU01ZA26yDcU8PEJjbQHUI5HU6q6gSAX+Q37nxirWx4WqKLScIcCuhV0mJJTFcamx nISOXSw3iMogw3k1mEYsw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:uvnbtfCZiDE=:4YmbQmmwUOQ/w+FbyCswVu mruEkV4ksyGYF2Wu8gnWUkwzudEIDy4wq+pbB4+3QyIplB63BQ5WRn+97jbzGVXAsWUyh0BxN 6Qy+ysJ3jADC9pPdAOvmxDrfRVQ5ydD4QzLUrE7CfhWDeHD95qFU9SQV4pNMWxC7HAj/S838W /1eS/NklDw8dcQaZE36FWBWMNkoj9LJB1vKlFzfH6pH2Oxk4W0xy7npLbHZPCSO6zHjVr8q1q dp8fzePlbsSKDmTq4eafi83UMR12F8aBX+y+egCYZVMeGsWgELXjn6JBLkkflr3QB8P2J0nv9 PGFBOKFSocsMxwU9l5CeCod/JgQKSMUC2bYUUIfPfNnZaIbZVz89061SC2mS1v1w0EqA4yvXW cHRuZ23ZgBUIgKtrY0UMQLPAqPk4+cQQi/B6nmtkzRIwDAmF2IPZCkh9sIjsb7K3OVQEpBJ4D 626GAT4vUoG4NIqKlfXy8ZIXkvVbSIoYje51i4DLocCZty205Ajj2ZYRh6IVcWSlfP43dhxvl rNz2uTc2i8r0G9Eu5HbyI4aIPOrPaW1uJblP46P8D8YB8owNddFsv1++PN5DtiUnl/zgxjVSi xkzDyjmheWVp6BXDXAO5yb/Bl0xLV98qMR8GIZpaY7pxC9MJ0H/dmXGwmpvHTx6MR0z2n9ZyE jdpA3sy3QJPsn6irjY6SuALBKERFn9dPbD10onbCOSm0P4tka4PRu0gjAqTVX52PvlE0GbcvE 0NTzmeSkUIat5+blFmquysTD68xx1rU1H9gXQU4ghIgQajGQsBNb1R8OokZG4c+KZczxkQcvf RlRlIaIOXTDawO8IaBMw5cSRJ5kNFGm67W8Xs2JI8CyZQJ6j3gMAGwRZ5dzPu5GqZITXz9Wjt BSv8IH0PdOpaFI/oHY0A== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The structure is only used in one place, moving it there simplifies the interface and helps with later changes to this code. Rename it to match the other time32 structures in the process. Signed-off-by: Arnd Bergmann --- include/linux/compat.h | 15 ++++----------- kernel/compat.c | 24 ------------------------ kernel/time/itimer.c | 42 +++++++++++++++++++++++++++++++++++------- 3 files changed, 39 insertions(+), 42 deletions(-) -- 2.20.0 Reviewed-by: Thomas Gleixner diff --git a/include/linux/compat.h b/include/linux/compat.h index 3735a22bfbc0..906a0ea933cd 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -116,14 +116,7 @@ typedef __compat_gid32_t compat_gid_t; struct compat_sel_arg_struct; struct rusage; -struct compat_itimerval { - struct old_timeval32 it_interval; - struct old_timeval32 it_value; -}; - -struct itimerval; -int get_compat_itimerval(struct itimerval *, const struct compat_itimerval __user *); -int put_compat_itimerval(struct compat_itimerval __user *, const struct itimerval *); +struct old_itimerval32; struct compat_tms { compat_clock_t tms_utime; @@ -668,10 +661,10 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, /* kernel/itimer.c */ asmlinkage long compat_sys_getitimer(int which, - struct compat_itimerval __user *it); + struct old_itimerval32 __user *it); asmlinkage long compat_sys_setitimer(int which, - struct compat_itimerval __user *in, - struct compat_itimerval __user *out); + struct old_itimerval32 __user *in, + struct old_itimerval32 __user *out); /* kernel/kexec.c */ asmlinkage long compat_sys_kexec_load(compat_ulong_t entry, diff --git a/kernel/compat.c b/kernel/compat.c index a2bc1d6ceb57..95005f849c68 100644 --- a/kernel/compat.c +++ b/kernel/compat.c @@ -90,30 +90,6 @@ int compat_put_timespec(const struct timespec *ts, void __user *uts) } EXPORT_SYMBOL_GPL(compat_put_timespec); -int get_compat_itimerval(struct itimerval *o, const struct compat_itimerval __user *i) -{ - struct compat_itimerval v32; - - if (copy_from_user(&v32, i, sizeof(struct compat_itimerval))) - return -EFAULT; - o->it_interval.tv_sec = v32.it_interval.tv_sec; - o->it_interval.tv_usec = v32.it_interval.tv_usec; - o->it_value.tv_sec = v32.it_value.tv_sec; - o->it_value.tv_usec = v32.it_value.tv_usec; - return 0; -} - -int put_compat_itimerval(struct compat_itimerval __user *o, const struct itimerval *i) -{ - struct compat_itimerval v32; - - v32.it_interval.tv_sec = i->it_interval.tv_sec; - v32.it_interval.tv_usec = i->it_interval.tv_usec; - v32.it_value.tv_sec = i->it_value.tv_sec; - v32.it_value.tv_usec = i->it_value.tv_usec; - return copy_to_user(o, &v32, sizeof(struct compat_itimerval)) ? -EFAULT : 0; -} - #ifdef __ARCH_WANT_SYS_SIGPROCMASK /* diff --git a/kernel/time/itimer.c b/kernel/time/itimer.c index 77f1e5635cc1..c52ebb40b60b 100644 --- a/kernel/time/itimer.c +++ b/kernel/time/itimer.c @@ -112,19 +112,34 @@ SYSCALL_DEFINE2(getitimer, int, which, struct itimerval __user *, value) } #ifdef CONFIG_COMPAT +struct old_itimerval32 { + struct old_timeval32 it_interval; + struct old_timeval32 it_value; +}; + +static int put_old_itimerval32(struct old_itimerval32 __user *o, const struct itimerval *i) +{ + struct old_itimerval32 v32; + + v32.it_interval.tv_sec = i->it_interval.tv_sec; + v32.it_interval.tv_usec = i->it_interval.tv_usec; + v32.it_value.tv_sec = i->it_value.tv_sec; + v32.it_value.tv_usec = i->it_value.tv_usec; + return copy_to_user(o, &v32, sizeof(struct old_itimerval32)) ? -EFAULT : 0; +} + COMPAT_SYSCALL_DEFINE2(getitimer, int, which, - struct compat_itimerval __user *, it) + struct old_itimerval32 __user *, it) { struct itimerval kit; int error = do_getitimer(which, &kit); - if (!error && put_compat_itimerval(it, &kit)) + if (!error && put_old_itimerval32(it, &kit)) error = -EFAULT; return error; } #endif - /* * The timer is automagically restarted, when interval != 0 */ @@ -310,15 +325,28 @@ SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, value, } #ifdef CONFIG_COMPAT +static int get_old_itimerval32(struct itimerval *o, const struct old_itimerval32 __user *i) +{ + struct old_itimerval32 v32; + + if (copy_from_user(&v32, i, sizeof(struct old_itimerval32))) + return -EFAULT; + o->it_interval.tv_sec = v32.it_interval.tv_sec; + o->it_interval.tv_usec = v32.it_interval.tv_usec; + o->it_value.tv_sec = v32.it_value.tv_sec; + o->it_value.tv_usec = v32.it_value.tv_usec; + return 0; +} + COMPAT_SYSCALL_DEFINE3(setitimer, int, which, - struct compat_itimerval __user *, in, - struct compat_itimerval __user *, out) + struct old_itimerval32 __user *, in, + struct old_itimerval32 __user *, out) { struct itimerval kin, kout; int error; if (in) { - if (get_compat_itimerval(&kin, in)) + if (get_old_itimerval32(&kin, in)) return -EFAULT; } else { memset(&kin, 0, sizeof(kin)); @@ -327,7 +355,7 @@ COMPAT_SYSCALL_DEFINE3(setitimer, int, which, error = do_setitimer(which, &kin, out ? &kout : NULL); if (error || !out) return error; - if (put_compat_itimerval(out, &kout)) + if (put_old_itimerval32(out, &kout)) return -EFAULT; return 0; } From patchwork Fri Nov 8 21:12:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178981 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3292646ilf; Fri, 8 Nov 2019 13:17:59 -0800 (PST) X-Google-Smtp-Source: APXvYqyVaUJl6ICQyYPYMhwVCJrIWglJbvqBnRSRow5HqjVrYs+Sth7h2W8/QvpWEPJOdf4U1pQN X-Received: by 2002:a50:984b:: with SMTP id h11mr13021927edb.248.1573247879325; Fri, 08 Nov 2019 13:17:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247879; cv=none; d=google.com; s=arc-20160816; b=GdPaUBbDdownumvXaHz7dilaEepDEzLivVqEi7rXtdpv9xD2R+t5Q7o1t/LjjYW3QC qVSZgq5BRtN3HV/cJPgnwO0ltCU6mnl/sE6Ye5OTKukl81lFmBIaZ9fMTPdTL2ruP8HK ki3ZSG8QRp8YfX6HwbjdFLI1ag+yjA4PPES77wxLkcpZJBNhg/efcA21tb80aokhaclm zuAMyPxcUFYgfa+1Q+6nA430cEhVslQ6l17WWE4Lp/5bhOGCLz0dDJCkC63qRiQ2HKyW FAWBbeKstMI9gmFfUjFxHmOtaMg89sUVRIeOJYuwI812LmlnvJLzTkbiYvLZwV62sF4E 63Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=IbNCTd862VGuK0DrUd8n9NXxZPRR+75LJYnI4w5K0Do=; b=RxZxO46LUzJCnGejnYvgMBa/52atHmPJ2g9UvcVrQVO5SEx3OYcoWC6ifyp2bcLnZB N7ingPI8jFMnLd08GHZZEuWbxl1KqGtBiGZZJJlfJONIr1rcHid5n/B0baHJ9y9oLE2P g2LYwiSMH5aVoFED7woQ6eKdcMQXtPPl8Q1TTdG0wZNY8TJ1loRrTmAZB8gaUTnQ5vO8 PECEc0xH+tjnfPCGy2ZFUmNmXyZSH/C3qdSGfDx4uSvGPZgSloyQ0+g9Na7rhZfUReZ8 hSwfSnHf6Dd04/br+y2ho6slAv/JPqbSQhtzGD+FxBbh191H1gJLNebzb7LPVfygu6a0 cP5w== 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 b14si5669224edv.216.2019.11.08.13.17.58; Fri, 08 Nov 2019 13:17:59 -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 S1733079AbfKHVR4 (ORCPT + 26 others); Fri, 8 Nov 2019 16:17:56 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:45817 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726095AbfKHVRz (ORCPT ); Fri, 8 Nov 2019 16:17:55 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MwgOK-1hjJ0r0tOk-00yBGN; Fri, 08 Nov 2019 22:17:39 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Richard Henderson , Ivan Kokshaysky , Matt Turner , Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Deepa Dinamani , Christian Brauner , Heiko Carstens , Anna-Maria Gleixner , linux-alpha@vger.kernel.org Subject: [PATCH 19/23] y2038: use compat_{get,set}_itimer on alpha Date: Fri, 8 Nov 2019 22:12:18 +0100 Message-Id: <20191108211323.1806194-10-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:E3gQKHDY/P5Y9zeE38VfQQ9wJ3KSPGVX2xBd4RGUHKVBkeQ3cnh IkqObZNllWa36SZ83QqDO/3CSSqK5L1RxS4HiP7Gz1x9tR5rNAkZqcsi1zd97to4Urku7br wOB5TOqXT1CjZTRrO9u4pIvL/sKlKt0CEF8I4WVxfmUUkcu3jXo/fbLhOpTLguvEuaXNDuu IwKMBcMOQlfd8/jxNENKw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:e/W+TxPQhaM=:ml/G9/qCjz5DPXfgmu4Q4t yZe2Hg0nRciRf2WuBQZW/Os8at/YT+JfAVd8YSPJobZaGTAYEdkdNZ8QjbXRD4RU9n+FIKPYi 7UwA2pXMgUWD3YqOuKCyHXYf7c/TMD0AEKjHm2CGb+P6bGSQkFY9JVHfyfa/uooG6du+p4kTi /+Czem+gkKCBl2npeJeRYC+9myim/rmPn3tRAwHtUWcVUxQyZTL+LEDtPRWrkit1u8ucjFz2o /uzORPNSEPTgi+yBTiBgb6rPAacISnj8GhYslwR9xV5O4rhrZt/o0knlvqJ1OOHRHr7YGgAkt 2e7XN4C918xz/sStEaWB0WUwsBpFoXbwZ4eVkIEYsnlgrBEytl4mM3mGQS5nQwRFblH1/4t1r TZCIlc+mhWGQMAkMNWF56ETeL9+0Pv4ycy2UJrtXDVOoEwkCEujRWdRJj6nbi9PVrP8FwWSu0 6fLrkR34CMHqE9UJxdud/zddxZeLF5D8oJp/LBeKqiLSnlnCZFzMw2jIyR3ZtBo7eNyckaFOO K81KuQ85Dg+q+hukG9UrVDDsqI3mBV8o+iI2SgLa82qIJM0pYgg4PYJRbRJ4bF//AXW5QvrAo 2WpYGNn81uIU6NoSfveSz+6t5DuP7FkMF3nM9z3+0ZOmABNidQI9dPGZkrD+66boSLJDoDbrH HlvqmkedrVT5W0cOkd9cfOz8zxTDLWctcT5BqJ6X0imQRlZnvB30Ui9eYNGI3RQVJirnu3dj9 LbCh36iw3QSump2JYcsCSduGbRTQZ5mo0Vhvu2mbq4jUwf9caYjIQyOasgoFdWtf/Wk79yW7j 7OtWtCjpQLM6DDnwJBinuRAUNxOu95fI9kVSzywIoQ912E9IGurxNTfOsreC1IUMlgn5UDFEB 67TnwtzMWoelIJ6k7u6w== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The itimer handling for the old alpha osf_setitimer/osf_getitimer system calls is identical to the compat version of getitimer/setitimer, so just use those directly. Signed-off-by: Arnd Bergmann --- arch/alpha/kernel/osf_sys.c | 65 -------------------------- arch/alpha/kernel/syscalls/syscall.tbl | 4 +- kernel/time/itimer.c | 4 +- 3 files changed, 4 insertions(+), 69 deletions(-) -- 2.20.0 diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index bbe7a0da6264..94e4cde8071a 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c @@ -971,30 +971,6 @@ put_tv_to_tv32(struct timeval32 __user *o, struct __kernel_old_timeval *i) sizeof(struct timeval32)); } -static inline long -get_it32(struct itimerval *o, struct itimerval32 __user *i) -{ - struct itimerval32 itv; - if (copy_from_user(&itv, i, sizeof(struct itimerval32))) - return -EFAULT; - o->it_interval.tv_sec = itv.it_interval.tv_sec; - o->it_interval.tv_usec = itv.it_interval.tv_usec; - o->it_value.tv_sec = itv.it_value.tv_sec; - o->it_value.tv_usec = itv.it_value.tv_usec; - return 0; -} - -static inline long -put_it32(struct itimerval32 __user *o, struct itimerval *i) -{ - return copy_to_user(o, &(struct itimerval32){ - .it_interval.tv_sec = o->it_interval.tv_sec, - .it_interval.tv_usec = o->it_interval.tv_usec, - .it_value.tv_sec = o->it_value.tv_sec, - .it_value.tv_usec = o->it_value.tv_usec}, - sizeof(struct itimerval32)); -} - static inline void jiffies_to_timeval32(unsigned long jiffies, struct timeval32 *value) { @@ -1039,47 +1015,6 @@ SYSCALL_DEFINE2(osf_settimeofday, struct timeval32 __user *, tv, asmlinkage long sys_ni_posix_timers(void); -SYSCALL_DEFINE2(osf_getitimer, int, which, struct itimerval32 __user *, it) -{ - struct itimerval kit; - int error; - - if (!IS_ENABLED(CONFIG_POSIX_TIMERS)) - return sys_ni_posix_timers(); - - error = do_getitimer(which, &kit); - if (!error && put_it32(it, &kit)) - error = -EFAULT; - - return error; -} - -SYSCALL_DEFINE3(osf_setitimer, int, which, struct itimerval32 __user *, in, - struct itimerval32 __user *, out) -{ - struct itimerval kin, kout; - int error; - - if (!IS_ENABLED(CONFIG_POSIX_TIMERS)) - return sys_ni_posix_timers(); - - if (in) { - if (get_it32(&kin, in)) - return -EFAULT; - } else - memset(&kin, 0, sizeof(kin)); - - error = do_setitimer(which, &kin, out ? &kout : NULL); - if (error || !out) - return error; - - if (put_it32(out, &kout)) - return -EFAULT; - - return 0; - -} - SYSCALL_DEFINE2(osf_utimes, const char __user *, filename, struct timeval32 __user *, tvs) { diff --git a/arch/alpha/kernel/syscalls/syscall.tbl b/arch/alpha/kernel/syscalls/syscall.tbl index 728fe028c02c..8e13b0b2928d 100644 --- a/arch/alpha/kernel/syscalls/syscall.tbl +++ b/arch/alpha/kernel/syscalls/syscall.tbl @@ -89,10 +89,10 @@ 80 common setgroups sys_setgroups 81 common osf_old_getpgrp sys_ni_syscall 82 common setpgrp sys_setpgid -83 common osf_setitimer sys_osf_setitimer +83 common osf_setitimer compat_sys_setitimer 84 common osf_old_wait sys_ni_syscall 85 common osf_table sys_ni_syscall -86 common osf_getitimer sys_osf_getitimer +86 common osf_getitimer compat_sys_getitimer 87 common gethostname sys_gethostname 88 common sethostname sys_sethostname 89 common getdtablesize sys_getdtablesize diff --git a/kernel/time/itimer.c b/kernel/time/itimer.c index c52ebb40b60b..4664c6addf69 100644 --- a/kernel/time/itimer.c +++ b/kernel/time/itimer.c @@ -111,7 +111,7 @@ SYSCALL_DEFINE2(getitimer, int, which, struct itimerval __user *, value) return error; } -#ifdef CONFIG_COMPAT +#if defined(CONFIG_COMPAT) || defined(CONFIG_ALPHA) struct old_itimerval32 { struct old_timeval32 it_interval; struct old_timeval32 it_value; @@ -324,7 +324,7 @@ SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, value, return 0; } -#ifdef CONFIG_COMPAT +#if defined(CONFIG_COMPAT) || defined(CONFIG_ALPHA) static int get_old_itimerval32(struct itimerval *o, const struct old_itimerval32 __user *i) { struct old_itimerval32 v32; From patchwork Fri Nov 8 21:12:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178982 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3293612ilf; Fri, 8 Nov 2019 13:18:50 -0800 (PST) X-Google-Smtp-Source: APXvYqyXh6w89m7m7XJjnU2X+AScFXUCGtajtqE8i49W1IpmFzXtQQSbPbih0M5MiUnS2MwpR30+ X-Received: by 2002:a50:fa83:: with SMTP id w3mr12590718edr.272.1573247930183; Fri, 08 Nov 2019 13:18:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247930; cv=none; d=google.com; s=arc-20160816; b=IY4nyG6vZs+S7VKJo2bxiPMo/RrGn3/T9UjhP59yvdoULJd7BDRSvyHOvxRVwSYDuN BsPYrbFa4gnVGPm2QgFk8oSFCYVWTFXcP7AY9bt5Bgqto90qAQmthP82T52SFemJ/NeI +5dunqTJdgvy08ekrynAwkaadKv6kMemXm3r2kjaVYlMETvTckVSEwAGfPpALz54lE+Z Gj5EXsCeiFyayIRGyS6uOh1r0T3xf6Ce3HHh1OXNqHIqZuzpsVcFUz0CgXcYvNcsOvP+ 3bsqttPQmRIqSypZxLv+TIUqabcxNmzcXOQ6Z3a/EHtuBGgEQJskOvqcmVgPESmFbjUn unWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=tJOebbddoVLK2BWaxg4NfDCLUovpEDVFDxGsTGc7qeM=; b=zfZGGMariL4u5vrkU6ICnxbBDMdpgv/yUBFyFPBn5BKa574OJzbRuBrtVJSE3ahGul 2sW20+W+/uAW9dKSf0b7FSKQ2KY8P5YHK3vh3c0YunnAyG45dOIjEgXa7fPCHdEzIeRb O7n7iMKYty8oh3NAT7BQL8HtAlwmLg6T7PtiSeB9ZyLAvY6Mn19PjwTcjSirjOnnDHvm 2miC94Lgz6mUMHuoqBdpKswbNle2Pb42s/xIgheRxPPdug7hiNTRRRygesLMQLmrOkTa aXsNhK+nyQdKM0lTJHGKILnWELwxqHcPiUxWBlDZh6LzU1rS7GEySiAF6qxKQ44ngT7B ijEA== 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 r12si6674419edi.272.2019.11.08.13.18.49; Fri, 08 Nov 2019 13:18:50 -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 S1729832AbfKHVSr (ORCPT + 26 others); Fri, 8 Nov 2019 16:18:47 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:44607 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726819AbfKHVSr (ORCPT ); Fri, 8 Nov 2019 16:18:47 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1M7bJ5-1iYOAj2BGX-0080Jg; Fri, 08 Nov 2019 22:18:12 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, John Stultz , Thomas Gleixner , Paul Moore , Stephen Smalley , Eric Paris Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Stephen Boyd , Sebastian Andrzej Siewior , Ingo Molnar , Anna-Maria Gleixner , Al Viro , Ondrej Mosnacek , selinux@vger.kernel.org Subject: [PATCH 20/23] y2038: move itimer reset into itimer.c Date: Fri, 8 Nov 2019 22:12:19 +0100 Message-Id: <20191108211323.1806194-11-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:cftdQ2oVdyPSduyUoNgNl7M3dzVudAM9sTy5LloysVNTgOb6AnF rWXqgtgdMd4tNJEO8Zptvt6Ij2R8xkhKKyx8MAw0emvUWvRDDzLVMiXiGc0I0Ak8jDONE2Y l5AOm3FG0hq9BgEFNNf9atKgw9RpMbzswxCdlNS7MU/Qa8TAuhE5a379xft8BHVxVDKJOOr 6MDtEPF3z3KPkkPP8Negw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:pumRZ9ygdRQ=:mAfvNHDsRdbjS5FtIwu5tO XmueAej5h3fWLZhrNU75if+MPBoZdFuYGvQoZHcgCcCNb+i2lVUU7yhNGH9iZAC/84ir0vRV2 8E/4uxZG3slPA1Ho4sjlYHj4uv2+w/lWIpRFw0SB6VHBYH4WdSdU7RHySejUKJ0182g6VDcfC SRcB0Ix8XkIz64A45fmdM8vyW6Wv5Eoa5hQMHE8+O5fQvZmOtzuHXQrztCAyELsVgBksXeXde RnehV0RRxZivXcsa2G1PW3RsKSHKitz87yswPv8WxX8mt4rrk4whGbIL/XQsJO5vOF86YRylN mX9Y6TMgL2OcAmDD1sU3bxv1wr7t3QRbSgHMk4BtRMsGLSCiF5i3D0100MTkyHfR2qcPxmXjh PJzWDyEOmi48jC0cc6p/Ae1eXEHlRAidvjv/TZK+GdCHzMXE/ciADdM9E/rDgDB+Qyi0Uk6Cl 1zyGlaTfNMFcq/hj8CkTBEJNWRJB3UUJoafDzyMV5qy7YT47k/qUfWIKfTrssB8dgR5KGTz4e dMkLSFs+vU5H1DHKdyYRHlAy9MwfNF7yu9kqWP7D9PbubJiOImgYbm4BfqoORUiwF5t0MtB7p xruKDEOC/DYAezaRkqvTDRd17X+QqgAlzOCGUM8kJ5QDbFWPrjvB82AVCvXEIYWBB2fhb9dbc u7ouRVmtKSxrwz6KqdDeaCcl0IZfa6Kfuwx4flu+JHZLqNncL7UbOkzKe9HeJMLbwZZ37RtuZ ao1nf8cJ70MH1W5hFNkxyc2ltMpHz3PzISPaIKE/xCcZxJ5v61manKOmFAY96Rmi36vSaKKbw tM3TtAxv4y+lceSoYyeq4YO2Pn0U+IO3iiQcIXrsN6OSVZ/nFSTwsT8icbbYhzUuM/bi7YaCY HRW0OOtSH66GYFVyfwlg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Preparing for a change to the itimer internals, stop using the do_setitimer() symbol and instead use a new higher-level interface. The do_getitimer()/do_setitimer functions can now be made static, allowing the compiler to potentially produce better object code. Signed-off-by: Arnd Bergmann --- include/linux/time.h | 9 +++++---- kernel/time/itimer.c | 15 +++++++++++++-- security/selinux/hooks.c | 10 +++------- 3 files changed, 21 insertions(+), 13 deletions(-) -- 2.20.0 Reviewed-by: Thomas Gleixner diff --git a/include/linux/time.h b/include/linux/time.h index 27d83fd2ae61..0760a4f5a15c 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -35,10 +35,11 @@ extern time64_t mktime64(const unsigned int year, const unsigned int mon, extern u32 (*arch_gettimeoffset)(void); #endif -struct itimerval; -extern int do_setitimer(int which, struct itimerval *value, - struct itimerval *ovalue); -extern int do_getitimer(int which, struct itimerval *value); +#ifdef CONFIG_POSIX_TIMERS +extern void clear_itimer(void); +#else +static inline void clear_itimer(void) {} +#endif extern long do_utimes(int dfd, const char __user *filename, struct timespec64 *times, int flags); diff --git a/kernel/time/itimer.c b/kernel/time/itimer.c index 4664c6addf69..ce9cd19ce72e 100644 --- a/kernel/time/itimer.c +++ b/kernel/time/itimer.c @@ -73,7 +73,7 @@ static void get_cpu_itimer(struct task_struct *tsk, unsigned int clock_id, value->it_interval = ns_to_timeval(interval); } -int do_getitimer(int which, struct itimerval *value) +static int do_getitimer(int which, struct itimerval *value) { struct task_struct *tsk = current; @@ -197,7 +197,7 @@ static void set_cpu_itimer(struct task_struct *tsk, unsigned int clock_id, #define timeval_valid(t) \ (((t)->tv_sec >= 0) && (((unsigned long) (t)->tv_usec) < USEC_PER_SEC)) -int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) +static int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) { struct task_struct *tsk = current; struct hrtimer *timer; @@ -249,6 +249,17 @@ int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) return 0; } +#ifdef CONFIG_SECURITY_SELINUX +void clear_itimer(void) +{ + struct itimerval v = {}; + int i; + + for (i = 0; i < 3; i++) + do_setitimer(i, &v, NULL); +} +#endif + #ifdef __ARCH_WANT_SYS_ALARM /** diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 9625b99e677f..c3f2e89acb87 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -2549,9 +2549,8 @@ static void selinux_bprm_committing_creds(struct linux_binprm *bprm) static void selinux_bprm_committed_creds(struct linux_binprm *bprm) { const struct task_security_struct *tsec = selinux_cred(current_cred()); - struct itimerval itimer; u32 osid, sid; - int rc, i; + int rc; osid = tsec->osid; sid = tsec->sid; @@ -2569,11 +2568,8 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm) rc = avc_has_perm(&selinux_state, osid, sid, SECCLASS_PROCESS, PROCESS__SIGINH, NULL); if (rc) { - if (IS_ENABLED(CONFIG_POSIX_TIMERS)) { - memset(&itimer, 0, sizeof itimer); - for (i = 0; i < 3; i++) - do_setitimer(i, &itimer, NULL); - } + if (IS_ENABLED(CONFIG_POSIX_TIMERS)) + clear_itimer(); spin_lock_irq(¤t->sighand->siglock); if (!fatal_signal_pending(current)) { flush_sigqueue(¤t->pending); From patchwork Fri Nov 8 21:12:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178983 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3293982ilf; Fri, 8 Nov 2019 13:19:12 -0800 (PST) X-Google-Smtp-Source: APXvYqzRuroEvVMy8IkZdBF/+UVpPEEGjqZf7uQUvr0DuWAcf5M4/RI+tdQUaj5wiGWbJkaDk+vH X-Received: by 2002:a05:6402:1850:: with SMTP id v16mr12901991edy.301.1573247952041; Fri, 08 Nov 2019 13:19:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247952; cv=none; d=google.com; s=arc-20160816; b=SEGIzexJPfoI+uZu5tVTN6kooHMSFO6XtFVT7845Vwfw6kChTyUYcAkPasi7kar1Xd 7vV4glSpSNCCrlxx1LWAwd+9mKlAT1mSptpkyEjWKHXK9yBTOO/UMsCtd2X6ZgU6P0ED OXj6hoYtiybfMO5Ya2BkaJB5c0se8HPolRnbCpuZXnjjuuJHxgngd/0TnGBGZDtDO6e/ qTkSpG1KvQHyvkxOUjCSpqQ9pta04aMoAnpe1Q0DPjN87C+oUgSct/bBp4PMzFZ41ukV oseYA9F2jraofB5hrT5CgVPkT2mZxWdp/SEWuAzp7/Vcukl5KrKwn+xy79em68BwLooA Bg0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=gLW/+n6sYjUVq2dM3MUux3QaDBkKPeu1jZtoUReyIa4=; b=aul2+oNm9ccS4fjpR71ZFgr59PMT7wsyluPESRR29e70XlRWQcbYlrdQYhMyjItlQ+ cd5enJYnlEHG1liAapF1w4iFgrqc4O5GoD3YIKr2y1nOr03/WAQpYwdw5u+gSd8cvSDw jb35wnqkKVu80Rkws1bqstEB6TI3wsFkf0RQuiWxzWdT7lU3hCX3Z2tlEPca/l41KRHk /IJbAhr/zPsyAiG8u01o6JEJkdap6d/pqBVPej+/32g7Sc/6u+O9dFHbWI5hpq2RH1Oi wC9kgB9WUwqp88e1sAlqP6OY8koGuP5WqSpILqe0MpWXl4aDN/Xw1pf5Ul99TN7d0VHh 5GMA== 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 r12si6674419edi.272.2019.11.08.13.19.11; Fri, 08 Nov 2019 13:19:12 -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 S1732846AbfKHVTK (ORCPT + 26 others); Fri, 8 Nov 2019 16:19:10 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:38719 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728265AbfKHVTJ (ORCPT ); Fri, 8 Nov 2019 16:19:09 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MILru-1ifJ81154m-00EM7J; Fri, 08 Nov 2019 22:18:25 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Steven Rostedt , Ingo Molnar , Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Anna-Maria Gleixner , Frederic Weisbecker , "Peter Zijlstra (Intel)" , Kees Cook Subject: [PATCH 21/23] y2038: itimer: change implementation to timespec64 Date: Fri, 8 Nov 2019 22:12:20 +0100 Message-Id: <20191108211323.1806194-12-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:4WkMuoICC5cesI0C2ij5Gho0hUchtCPLguOrWCvkT18I3mUYApK mIyxo/O5FNWkF8GSg0X4w8Ww98ksKCmv8ZLnT/hZr85GXFsa3pozz8/14suHv+84Hzu6eSR UcPUzijDUs6fudfytij27jIyG1UkCiwCm9xWpM+dIquYzGp/AEgwoRztv/4mtIWSuUe1grY JKuiwc7WcoJkqNKWjP3yA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:/zzQfwu0qCU=:bPvyytG05KOYtyFomJc9AT PTH/9UC/fN81cwpu/nHj2Q+fmPkG6Iy9RC7xLjg/sZPFIojpOfNaO9gcKOt/NslUOCCHzP+H+ beXp9U97yPrHOACl1wlavSW+P3KcWUmG8rk64VXWejc5G1i0Hh70GKOlCOBnYz0sx5cx0rOWB /H4xcaZoni3XI/qYyKihjDPP322u9Q5ur4UaBAE0VjEydeTrmC+bSHmU7l2MMfKIXJor7qwXl AdDewFSDyDVHM9oeswrymeeZQkGTSmr9HPWK8kVbmECU4TygxO6G/QjilxqsLzi0198SlarEv noPhuuo2ySVefKKVrY15UH8ulei9gaqVm5jC3ZX6GKLQWzoAMWsIpkkqWAJkOouF8EDDR0yQr PA7u2OKSGrxjVf16zHdP50xBVOrgMkGGMHPY+zojvwSeBZVe3P345pwti53gNusZD1MyZX2js kYsjddcJY6p1O7OD2cK1VWYLuyq8Sjqr4f48P687HAiTaC03T6lkGjIUyfaLl+kV2WysDQx7H 0GEDXf3PNSEDDi650xywVXIDIz5HCifBtMtUG0vmBmpQl0LN3jdbdVMT01S5SnkqUHHZrTmqg bDEd4uSy+GNNDQatje69cA/Vjt+Yb+SBE4GHyzI+ooIfWzkasQ/KApHjg5exDP2fKOj8mcQ0U yzYOOsK+N7b/2SJT4ESQancNYS/aUUW6RxF8UiSKixljUkYI6BHXDeih68nBDeYds5wozL0EH KkbqjwCEknBHJcTTVvkldCLv/V60u0I+tvJzVd5Sos/ynVlCIjO0q6IH77KCQcYKjqVhs5yTK hMYbpQQDA3hJD76gkfP/mccWii8orVmSvfoqo9wX57hq46d/1JByLcJL5ROgJM6E1eZwNYlrw Tqsq5uUyTrFHnZ7V6ikQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is no 64-bit version of getitimer/setitimer since that is not actually needed. However, the implementation is built around the deprecated 'struct timeval' type. Change the code to use timespec64 internally to reduce the dependencies on timeval and associated helper functions. Minor adjustments in the code are needed to make the native and compat version work the same way, and to keep the range check working after the conversion. Signed-off-by: Arnd Bergmann --- include/trace/events/timer.h | 8 +- kernel/time/itimer.c | 158 +++++++++++++++++++++-------------- 2 files changed, 100 insertions(+), 66 deletions(-) -- 2.20.0 diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h index b7a904825e7d..939cbfc80015 100644 --- a/include/trace/events/timer.h +++ b/include/trace/events/timer.h @@ -303,7 +303,7 @@ DEFINE_EVENT(hrtimer_class, hrtimer_cancel, */ TRACE_EVENT(itimer_state, - TP_PROTO(int which, const struct itimerval *const value, + TP_PROTO(int which, const struct itimerspec64 *const value, unsigned long long expires), TP_ARGS(which, value, expires), @@ -321,12 +321,12 @@ TRACE_EVENT(itimer_state, __entry->which = which; __entry->expires = expires; __entry->value_sec = value->it_value.tv_sec; - __entry->value_usec = value->it_value.tv_usec; + __entry->value_usec = value->it_value.tv_nsec / NSEC_PER_USEC; __entry->interval_sec = value->it_interval.tv_sec; - __entry->interval_usec = value->it_interval.tv_usec; + __entry->interval_usec = value->it_interval.tv_nsec / NSEC_PER_USEC; ), - TP_printk("which=%d expires=%llu it_value=%ld.%ld it_interval=%ld.%ld", + TP_printk("which=%d expires=%llu it_value=%ld.%06ld it_interval=%ld.%06ld", __entry->which, __entry->expires, __entry->value_sec, __entry->value_usec, __entry->interval_sec, __entry->interval_usec) diff --git a/kernel/time/itimer.c b/kernel/time/itimer.c index ce9cd19ce72e..5872db9bd5f7 100644 --- a/kernel/time/itimer.c +++ b/kernel/time/itimer.c @@ -26,7 +26,7 @@ * Returns the delta between the expiry time and now, which can be * less than zero or 1usec for an pending expired timer */ -static struct timeval itimer_get_remtime(struct hrtimer *timer) +static struct timespec64 itimer_get_remtime(struct hrtimer *timer) { ktime_t rem = __hrtimer_get_remaining(timer, true); @@ -41,11 +41,11 @@ static struct timeval itimer_get_remtime(struct hrtimer *timer) } else rem = 0; - return ktime_to_timeval(rem); + return ktime_to_timespec64(rem); } static void get_cpu_itimer(struct task_struct *tsk, unsigned int clock_id, - struct itimerval *const value) + struct itimerspec64 *const value) { u64 val, interval; struct cpu_itimer *it = &tsk->signal->it[clock_id]; @@ -69,11 +69,11 @@ static void get_cpu_itimer(struct task_struct *tsk, unsigned int clock_id, spin_unlock_irq(&tsk->sighand->siglock); - value->it_value = ns_to_timeval(val); - value->it_interval = ns_to_timeval(interval); + value->it_value = ns_to_timespec64(val); + value->it_interval = ns_to_timespec64(interval); } -static int do_getitimer(int which, struct itimerval *value) +static int do_getitimer(int which, struct itimerspec64 *value) { struct task_struct *tsk = current; @@ -82,7 +82,7 @@ static int do_getitimer(int which, struct itimerval *value) spin_lock_irq(&tsk->sighand->siglock); value->it_value = itimer_get_remtime(&tsk->signal->real_timer); value->it_interval = - ktime_to_timeval(tsk->signal->it_real_incr); + ktime_to_timespec64(tsk->signal->it_real_incr); spin_unlock_irq(&tsk->sighand->siglock); break; case ITIMER_VIRTUAL: @@ -97,17 +97,26 @@ static int do_getitimer(int which, struct itimerval *value) return 0; } +static int put_itimerval(struct itimerval __user *o, + const struct itimerspec64 *i) +{ + struct itimerval v; + + v.it_interval.tv_sec = i->it_interval.tv_sec; + v.it_interval.tv_usec = i->it_interval.tv_nsec / NSEC_PER_USEC; + v.it_value.tv_sec = i->it_value.tv_sec; + v.it_value.tv_usec = i->it_value.tv_nsec / NSEC_PER_USEC; + return copy_to_user(o, &v, sizeof(struct itimerval)) ? -EFAULT : 0; +} + + SYSCALL_DEFINE2(getitimer, int, which, struct itimerval __user *, value) { - int error = -EFAULT; - struct itimerval get_buffer; + struct itimerspec64 get_buffer; + int error = do_getitimer(which, &get_buffer); - if (value) { - error = do_getitimer(which, &get_buffer); - if (!error && - copy_to_user(value, &get_buffer, sizeof(get_buffer))) - error = -EFAULT; - } + if (!error && put_itimerval(value, &get_buffer)) + error = -EFAULT; return error; } @@ -117,24 +126,25 @@ struct old_itimerval32 { struct old_timeval32 it_value; }; -static int put_old_itimerval32(struct old_itimerval32 __user *o, const struct itimerval *i) +static int put_old_itimerval32(struct old_itimerval32 __user *o, + const struct itimerspec64 *i) { struct old_itimerval32 v32; v32.it_interval.tv_sec = i->it_interval.tv_sec; - v32.it_interval.tv_usec = i->it_interval.tv_usec; + v32.it_interval.tv_usec = i->it_interval.tv_nsec / NSEC_PER_USEC; v32.it_value.tv_sec = i->it_value.tv_sec; - v32.it_value.tv_usec = i->it_value.tv_usec; + v32.it_value.tv_usec = i->it_value.tv_nsec / NSEC_PER_USEC; return copy_to_user(o, &v32, sizeof(struct old_itimerval32)) ? -EFAULT : 0; } COMPAT_SYSCALL_DEFINE2(getitimer, int, which, - struct old_itimerval32 __user *, it) + struct old_itimerval32 __user *, value) { - struct itimerval kit; - int error = do_getitimer(which, &kit); + struct itimerspec64 get_buffer; + int error = do_getitimer(which, &get_buffer); - if (!error && put_old_itimerval32(it, &kit)) + if (!error && put_old_itimerval32(value, &get_buffer)) error = -EFAULT; return error; } @@ -156,8 +166,8 @@ enum hrtimer_restart it_real_fn(struct hrtimer *timer) } static void set_cpu_itimer(struct task_struct *tsk, unsigned int clock_id, - const struct itimerval *const value, - struct itimerval *const ovalue) + const struct itimerspec64 *const value, + struct itimerspec64 *const ovalue) { u64 oval, nval, ointerval, ninterval; struct cpu_itimer *it = &tsk->signal->it[clock_id]; @@ -166,8 +176,8 @@ static void set_cpu_itimer(struct task_struct *tsk, unsigned int clock_id, * Use the to_ktime conversion because that clamps the maximum * value to KTIME_MAX and avoid multiplication overflows. */ - nval = ktime_to_ns(timeval_to_ktime(value->it_value)); - ninterval = ktime_to_ns(timeval_to_ktime(value->it_interval)); + nval = timespec64_to_ns(&value->it_value); + ninterval = timespec64_to_ns(&value->it_interval); spin_lock_irq(&tsk->sighand->siglock); @@ -186,8 +196,8 @@ static void set_cpu_itimer(struct task_struct *tsk, unsigned int clock_id, spin_unlock_irq(&tsk->sighand->siglock); if (ovalue) { - ovalue->it_value = ns_to_timeval(oval); - ovalue->it_interval = ns_to_timeval(ointerval); + ovalue->it_value = ns_to_timespec64(oval); + ovalue->it_interval = ns_to_timespec64(ointerval); } } @@ -197,19 +207,13 @@ static void set_cpu_itimer(struct task_struct *tsk, unsigned int clock_id, #define timeval_valid(t) \ (((t)->tv_sec >= 0) && (((unsigned long) (t)->tv_usec) < USEC_PER_SEC)) -static int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) +static int do_setitimer(int which, struct itimerspec64 *value, + struct itimerspec64 *ovalue) { struct task_struct *tsk = current; struct hrtimer *timer; ktime_t expires; - /* - * Validate the timevals in value. - */ - if (!timeval_valid(&value->it_value) || - !timeval_valid(&value->it_interval)) - return -EINVAL; - switch (which) { case ITIMER_REAL: again: @@ -218,7 +222,7 @@ static int do_setitimer(int which, struct itimerval *value, struct itimerval *ov if (ovalue) { ovalue->it_value = itimer_get_remtime(timer); ovalue->it_interval - = ktime_to_timeval(tsk->signal->it_real_incr); + = ktime_to_timespec64(tsk->signal->it_real_incr); } /* We are sharing ->siglock with it_real_fn() */ if (hrtimer_try_to_cancel(timer) < 0) { @@ -226,10 +230,10 @@ static int do_setitimer(int which, struct itimerval *value, struct itimerval *ov hrtimer_cancel_wait_running(timer); goto again; } - expires = timeval_to_ktime(value->it_value); + expires = timespec64_to_ktime(value->it_value); if (expires != 0) { tsk->signal->it_real_incr = - timeval_to_ktime(value->it_interval); + timespec64_to_ktime(value->it_interval); hrtimer_start(timer, expires, HRTIMER_MODE_REL); } else tsk->signal->it_real_incr = 0; @@ -252,7 +256,7 @@ static int do_setitimer(int which, struct itimerval *value, struct itimerval *ov #ifdef CONFIG_SECURITY_SELINUX void clear_itimer(void) { - struct itimerval v = {}; + struct itimerspec64 v = {}; int i; for (i = 0; i < 3; i++) @@ -276,15 +280,15 @@ void clear_itimer(void) */ static unsigned int alarm_setitimer(unsigned int seconds) { - struct itimerval it_new, it_old; + struct itimerspec64 it_new, it_old; #if BITS_PER_LONG < 64 if (seconds > INT_MAX) seconds = INT_MAX; #endif it_new.it_value.tv_sec = seconds; - it_new.it_value.tv_usec = 0; - it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0; + it_new.it_value.tv_nsec = 0; + it_new.it_interval.tv_sec = it_new.it_interval.tv_nsec = 0; do_setitimer(ITIMER_REAL, &it_new, &it_old); @@ -292,8 +296,8 @@ static unsigned int alarm_setitimer(unsigned int seconds) * We can't return 0 if we have an alarm pending ... And we'd * better return too much than too little anyway */ - if ((!it_old.it_value.tv_sec && it_old.it_value.tv_usec) || - it_old.it_value.tv_usec >= 500000) + if ((!it_old.it_value.tv_sec && it_old.it_value.tv_nsec) || + it_old.it_value.tv_nsec >= 500000) it_old.it_value.tv_sec++; return it_old.it_value.tv_sec; @@ -310,15 +314,35 @@ SYSCALL_DEFINE1(alarm, unsigned int, seconds) #endif +static int get_itimerval(struct itimerspec64 *o, const struct itimerval __user *i) +{ + struct itimerval v; + + if (copy_from_user(&v, i, sizeof(struct itimerval))) + return -EFAULT; + + /* Validate the timevals in value. */ + if (!timeval_valid(&v.it_value) || + !timeval_valid(&v.it_interval)) + return -EINVAL; + + o->it_interval.tv_sec = v.it_interval.tv_sec; + o->it_interval.tv_nsec = v.it_interval.tv_usec * NSEC_PER_USEC; + o->it_value.tv_sec = v.it_value.tv_sec; + o->it_value.tv_nsec = v.it_value.tv_usec * NSEC_PER_USEC; + return 0; +} + SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, value, struct itimerval __user *, ovalue) { - struct itimerval set_buffer, get_buffer; + struct itimerspec64 set_buffer, get_buffer; int error; if (value) { - if(copy_from_user(&set_buffer, value, sizeof(set_buffer))) - return -EFAULT; + error = get_itimerval(&set_buffer, value); + if (error) + return error; } else { memset(&set_buffer, 0, sizeof(set_buffer)); printk_once(KERN_WARNING "%s calls setitimer() with new_value NULL pointer." @@ -330,43 +354,53 @@ SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, value, if (error || !ovalue) return error; - if (copy_to_user(ovalue, &get_buffer, sizeof(get_buffer))) + if (put_itimerval(ovalue, &get_buffer)) return -EFAULT; return 0; } #if defined(CONFIG_COMPAT) || defined(CONFIG_ALPHA) -static int get_old_itimerval32(struct itimerval *o, const struct old_itimerval32 __user *i) +static int get_old_itimerval32(struct itimerspec64 *o, const struct old_itimerval32 __user *i) { struct old_itimerval32 v32; if (copy_from_user(&v32, i, sizeof(struct old_itimerval32))) return -EFAULT; + + /* Validate the timevals in value. */ + if (!timeval_valid(&v32.it_value) || + !timeval_valid(&v32.it_interval)) + return -EINVAL; + o->it_interval.tv_sec = v32.it_interval.tv_sec; - o->it_interval.tv_usec = v32.it_interval.tv_usec; + o->it_interval.tv_nsec = v32.it_interval.tv_usec * NSEC_PER_USEC; o->it_value.tv_sec = v32.it_value.tv_sec; - o->it_value.tv_usec = v32.it_value.tv_usec; + o->it_value.tv_nsec = v32.it_value.tv_usec * NSEC_PER_USEC; return 0; } COMPAT_SYSCALL_DEFINE3(setitimer, int, which, - struct old_itimerval32 __user *, in, - struct old_itimerval32 __user *, out) + struct old_itimerval32 __user *, value, + struct old_itimerval32 __user *, ovalue) { - struct itimerval kin, kout; + struct itimerspec64 set_buffer, get_buffer; int error; - if (in) { - if (get_old_itimerval32(&kin, in)) - return -EFAULT; + if (value) { + error = get_old_itimerval32(&set_buffer, value); + if (error) + return error; } else { - memset(&kin, 0, sizeof(kin)); + memset(&set_buffer, 0, sizeof(set_buffer)); + printk_once(KERN_WARNING "%s calls setitimer() with new_value NULL pointer." + " Misfeature support will be removed\n", + current->comm); } - error = do_setitimer(which, &kin, out ? &kout : NULL); - if (error || !out) + error = do_setitimer(which, &set_buffer, ovalue ? &get_buffer : NULL); + if (error || !ovalue) return error; - if (put_old_itimerval32(out, &kout)) + if (put_old_itimerval32(ovalue, &get_buffer)) return -EFAULT; return 0; } From patchwork Fri Nov 8 21:12:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178985 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3294289ilf; Fri, 8 Nov 2019 13:19:28 -0800 (PST) X-Google-Smtp-Source: APXvYqxpxFqWAl4QHth45411XJ0PxaCB29hzU8WAfrUYFaWNb/PuATCpgQQefy5UvYck25+M5njN X-Received: by 2002:a50:da4b:: with SMTP id a11mr12663308edk.17.1573247968611; Fri, 08 Nov 2019 13:19:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247968; cv=none; d=google.com; s=arc-20160816; b=1JXp2xmKIHnVGq+hNxoF9NHplXQ9F6dVv4MoVqI17e5jqrSVC1UgUntCFzwx6xTQ+t GTXAxPOnk+XSaIjH5dtLtLDr7Pb3DMrxWsZ7kRTGxdk5kf/BDeL50V5XUYBTbeBh6WoS gLmHzxJv5KTCX/eFNAPvIr5NxBfWWCRnqs3LKESxcNYVEWHSgkg7vJMzN6CxzL5xgonH 9UqzoN6KZi1Db6M0yXjy8v/uf5691flhyaKJdCXFI4Zb+/rPBivtlDjTCbu25QOEjM4V emlLPYNExB4nMVEmENSnKvpDUGBu9PF/dVph5yizq2bCI1LTexdh3Ol9mWawW52IknL5 mXBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=36MR6tjIpLOxJu+d78jXPmSqLvQs963O6pXHDzLl+Z4=; b=ke0oy6m1qQcDya5G467NRxaq6WoLcVspopVTUK026SeS0zZLF+rQhOOL2B9R+uJl95 h9sSyW6X1P2Tptzd5OULEG7bc9V5uo8oCdd5kGGq3htPdkZ176uNbTiTnm6b3QWutU1o Lqb9JB/KhKvSNbmRCC9L2E5Vx/+OP1h0gkw3pnEP7otdZNLJwA9GJdvQ3v0v7lzw/Xd+ uXV4We2RPCh4s/WgROFD9x4W531MgX0myTIqGdiBsJey2AMktbXxBFVues9frHp6WXIq 5ILkU4a1va2pyXYybDl+Fa88MUIdOBeqr968p6dF1xEtD2y4SPVcbyKlnBazcc1S8YYb Mtmg== 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 d14si4764705ejc.72.2019.11.08.13.19.28; Fri, 08 Nov 2019 13:19:28 -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 S2387596AbfKHVT0 (ORCPT + 26 others); Fri, 8 Nov 2019 16:19:26 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:59767 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387457AbfKHVTZ (ORCPT ); Fri, 8 Nov 2019 16:19:25 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MYN7M-1iPHeH0u6U-00VTIJ; Fri, 08 Nov 2019 22:18:39 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Steven Rostedt , Ingo Molnar , Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Anna-Maria Gleixner , Frederic Weisbecker , John Stultz , Nicolas Pitre Subject: [PATCH 22/23] [RFC] y2038: itimer: use ktime_t internally Date: Fri, 8 Nov 2019 22:12:21 +0100 Message-Id: <20191108211323.1806194-13-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:bM7Nq5CQwuGoA1BzdrxI+2VwSoMwQ74iQFLFgEinkzmGc+wlBQZ V318kOnZNRgaZA/puj1HIUZcWO4Ad6LjJnpaADk4UeLJEXxeMOXwQnM8Q1bg3xCgBc3OPkr wJ5SqoGUya06OdD55aZ08FKQ82G8L9N3iJsnzU0J7Jb29WzFDhqexRvR9515GOzVdTX9xke fEoghTmTy8yjmJwhOwfOA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:DrQ+rs5qJwo=:r0wIZdZ918c2vkhwfd6m0T J8RH6yELp3vSCjEg0mTtvZwZdqVASeKkTXX+nqi4pCnTdytolxdHOtmJ8eRpjAPFaGQFI4kZ/ 5MaKwvx0T2sHlYYEj8i23z0SLmrFttzs43cP9s1dBIdl8JeoyhYfoh36yuXBSe5Rm54ikNRRs r5NR+dJFxkfx9I7LMWTPhmZOWBZjkYn3q5xtTgXsB+DM5HTXeOV49LlqMAZG+3w73/n0dBRAn PO+W0kPZ4Zio/Ty56VJsGpk8XD/krjSwrtn3XQSFCXNUz5upsbsrYxf4rNkD85UQfnZ1gnEHF dclDtemsKkR05wgGMayYQMfphAMlVx575TZkO7EPfOxgO2I6JQcdYSLdpdXegQCrtEy7C4MWt E5Oe98FbMKBYJHoKsHmqZl1ZP3UFxEukCoL85MNmtbV0BouHee4IykTlfGztW0M9l8qRkHkto ezCsWSNz9ciR/k9aogSpc0s95yKAm0mVRMKgOsZjZgnDu6K1XWnsTT2Ut6ZPGoshEmZ6oug/W 7DZToa2Fg34wJ8scRpeREb8hELiWpiIC38hRK3nkmTJwRgYB2q/a61X+GGenVoerY8IivVij9 J/VzzVq4I3g1ZXRJ6qiPrylfuMQDkPscBj4b8IDutXO9MTp5dYqlWo5UAoQecFSrPdn6cnrcL opzPgtoaDERVpK1CIHSsKQnef78GkVCAvOhdzULSbV8vtPglihgGdVEUFfqy372CZYDaYvbS1 GkBtof09S6GreNdI06B3GSKHAK7HtYL+QBtY078EPnw4SnFkSbW5/YVeLgDNADwyPEmCbqsni Xpt5OJr1hnkaWNdxx4JDm7PUN+wJkw7eL1wj9zYq4aZjBbl7q7O9CAfityg9eh0PcT8lpgbEj 0d9yU7k/42n51ZuVnvGQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Avoid the intermediate step going from timeval to timespec64 to ktime_t and back by using ktime_t throughout the code. I was going back and forth between the two implementations. This patch is optional: if we want it, it could be folded into the patch converting to itimerspec64. On an arm32 build, this version actually produces 10% larger code than the timespec64 version, while on x86-64 it's the same as before, and the number of source lines stays the same as well. Signed-off-by: Arnd Bergmann --- include/trace/events/timer.h | 29 ++--- kernel/time/itimer.c | 229 ++++++++++++++++++----------------- 2 files changed, 129 insertions(+), 129 deletions(-) -- 2.20.0 diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h index 939cbfc80015..021733a49f10 100644 --- a/include/trace/events/timer.h +++ b/include/trace/events/timer.h @@ -297,39 +297,36 @@ DEFINE_EVENT(hrtimer_class, hrtimer_cancel, /** * itimer_state - called when itimer is started or canceled * @which: name of the interval timer - * @value: the itimers value, itimer is canceled if value->it_value is - * zero, otherwise it is started + * @interval: the itimers value + * @interval: the itimers interval * @expires: the itimers expiry time */ TRACE_EVENT(itimer_state, - TP_PROTO(int which, const struct itimerspec64 *const value, - unsigned long long expires), + TP_PROTO(int which, ktime_t value, ktime_t interval, unsigned long long expires), - TP_ARGS(which, value, expires), + TP_ARGS(which, value, interval, expires), TP_STRUCT__entry( __field( int, which ) __field( unsigned long long, expires ) - __field( long, value_sec ) - __field( long, value_usec ) - __field( long, interval_sec ) - __field( long, interval_usec ) + __field( time64_t, value_sec ) + __field( u32, value_nsec ) + __field( time64_t, interval_sec ) + __field( u32, interval_nsec ) ), TP_fast_assign( __entry->which = which; __entry->expires = expires; - __entry->value_sec = value->it_value.tv_sec; - __entry->value_usec = value->it_value.tv_nsec / NSEC_PER_USEC; - __entry->interval_sec = value->it_interval.tv_sec; - __entry->interval_usec = value->it_interval.tv_nsec / NSEC_PER_USEC; + __entry->value_sec = div_u64_rem(value, NSEC_PER_SEC, &__entry->value_nsec); + __entry->interval_sec = div_u64_rem(interval, NSEC_PER_SEC, &__entry->interval_nsec); ), - TP_printk("which=%d expires=%llu it_value=%ld.%06ld it_interval=%ld.%06ld", + TP_printk("which=%d expires=%llu it_value=%lld.%09d it_interval=%lld.%09d", __entry->which, __entry->expires, - __entry->value_sec, __entry->value_usec, - __entry->interval_sec, __entry->interval_usec) + __entry->value_sec, __entry->value_nsec, + __entry->interval_sec, __entry->interval_nsec) ); /** diff --git a/kernel/time/itimer.c b/kernel/time/itimer.c index 5872db9bd5f7..707f73054d76 100644 --- a/kernel/time/itimer.c +++ b/kernel/time/itimer.c @@ -26,7 +26,7 @@ * Returns the delta between the expiry time and now, which can be * less than zero or 1usec for an pending expired timer */ -static struct timespec64 itimer_get_remtime(struct hrtimer *timer) +static ktime_t itimer_get_remtime(struct hrtimer *timer) { ktime_t rem = __hrtimer_get_remaining(timer, true); @@ -41,11 +41,11 @@ static struct timespec64 itimer_get_remtime(struct hrtimer *timer) } else rem = 0; - return ktime_to_timespec64(rem); + return rem; } static void get_cpu_itimer(struct task_struct *tsk, unsigned int clock_id, - struct itimerspec64 *const value) + ktime_t *ovalue, ktime_t *ointerval) { u64 val, interval; struct cpu_itimer *it = &tsk->signal->it[clock_id]; @@ -69,27 +69,26 @@ static void get_cpu_itimer(struct task_struct *tsk, unsigned int clock_id, spin_unlock_irq(&tsk->sighand->siglock); - value->it_value = ns_to_timespec64(val); - value->it_interval = ns_to_timespec64(interval); + *ovalue = ns_to_ktime(val); + *ointerval = ns_to_ktime(interval); } -static int do_getitimer(int which, struct itimerspec64 *value) +static int do_getitimer(int which, ktime_t *value, ktime_t *interval) { struct task_struct *tsk = current; switch (which) { case ITIMER_REAL: spin_lock_irq(&tsk->sighand->siglock); - value->it_value = itimer_get_remtime(&tsk->signal->real_timer); - value->it_interval = - ktime_to_timespec64(tsk->signal->it_real_incr); + *value = itimer_get_remtime(&tsk->signal->real_timer); + *interval = tsk->signal->it_real_incr; spin_unlock_irq(&tsk->sighand->siglock); break; case ITIMER_VIRTUAL: - get_cpu_itimer(tsk, CPUCLOCK_VIRT, value); + get_cpu_itimer(tsk, CPUCLOCK_VIRT, value, interval); break; case ITIMER_PROF: - get_cpu_itimer(tsk, CPUCLOCK_PROF, value); + get_cpu_itimer(tsk, CPUCLOCK_PROF, value, interval); break; default: return(-EINVAL); @@ -98,26 +97,31 @@ static int do_getitimer(int which, struct itimerspec64 *value) } static int put_itimerval(struct itimerval __user *o, - const struct itimerspec64 *i) + ktime_t value, ktime_t interval) { struct itimerval v; - - v.it_interval.tv_sec = i->it_interval.tv_sec; - v.it_interval.tv_usec = i->it_interval.tv_nsec / NSEC_PER_USEC; - v.it_value.tv_sec = i->it_value.tv_sec; - v.it_value.tv_usec = i->it_value.tv_nsec / NSEC_PER_USEC; + struct timespec64 ts; + + ts = ktime_to_timespec64(interval); + v.it_interval.tv_sec = ts.tv_sec; + v.it_interval.tv_usec = ts.tv_nsec / NSEC_PER_USEC; + ts = ktime_to_timespec64(value); + v.it_value.tv_sec = ts.tv_sec; + v.it_value.tv_usec = ts.tv_nsec / NSEC_PER_USEC; return copy_to_user(o, &v, sizeof(struct itimerval)) ? -EFAULT : 0; } -SYSCALL_DEFINE2(getitimer, int, which, struct itimerval __user *, value) +SYSCALL_DEFINE2(getitimer, int, which, struct itimerval __user *, it) { - struct itimerspec64 get_buffer; - int error = do_getitimer(which, &get_buffer); + ktime_t value, interval; + int error; + + error = do_getitimer(which, &value, &interval); + if (error) + return error; - if (!error && put_itimerval(value, &get_buffer)) - error = -EFAULT; - return error; + return put_itimerval(it, value, interval); } #if defined(CONFIG_COMPAT) || defined(CONFIG_ALPHA) @@ -127,26 +131,31 @@ struct old_itimerval32 { }; static int put_old_itimerval32(struct old_itimerval32 __user *o, - const struct itimerspec64 *i) + ktime_t value, ktime_t interval) { struct old_itimerval32 v32; - - v32.it_interval.tv_sec = i->it_interval.tv_sec; - v32.it_interval.tv_usec = i->it_interval.tv_nsec / NSEC_PER_USEC; - v32.it_value.tv_sec = i->it_value.tv_sec; - v32.it_value.tv_usec = i->it_value.tv_nsec / NSEC_PER_USEC; + struct timespec64 ts; + + ts = ktime_to_timespec64(interval); + v32.it_interval.tv_sec = ts.tv_sec; + v32.it_interval.tv_usec = ts.tv_nsec / NSEC_PER_USEC; + ts = ktime_to_timespec64(value); + v32.it_value.tv_sec = ts.tv_sec; + v32.it_value.tv_usec = ts.tv_nsec / NSEC_PER_USEC; return copy_to_user(o, &v32, sizeof(struct old_itimerval32)) ? -EFAULT : 0; } COMPAT_SYSCALL_DEFINE2(getitimer, int, which, - struct old_itimerval32 __user *, value) + struct old_itimerval32 __user *, it) { - struct itimerspec64 get_buffer; - int error = do_getitimer(which, &get_buffer); + ktime_t value, interval; + int error; - if (!error && put_old_itimerval32(value, &get_buffer)) - error = -EFAULT; - return error; + error = do_getitimer(which, &value, &interval); + if (error) + return error; + + return put_old_itimerval32(it, value, interval); } #endif @@ -166,86 +175,78 @@ enum hrtimer_restart it_real_fn(struct hrtimer *timer) } static void set_cpu_itimer(struct task_struct *tsk, unsigned int clock_id, - const struct itimerspec64 *const value, - struct itimerspec64 *const ovalue) + ktime_t value, ktime_t interval, + ktime_t *ovalue, ktime_t *ointerval) { - u64 oval, nval, ointerval, ninterval; + u64 oval, nval; struct cpu_itimer *it = &tsk->signal->it[clock_id]; - /* - * Use the to_ktime conversion because that clamps the maximum - * value to KTIME_MAX and avoid multiplication overflows. - */ - nval = timespec64_to_ns(&value->it_value); - ninterval = timespec64_to_ns(&value->it_interval); + nval = value; spin_lock_irq(&tsk->sighand->siglock); oval = it->expires; - ointerval = it->incr; + if (ointerval) + *ointerval = it->incr; + if (oval || nval) { if (nval > 0) nval += TICK_NSEC; set_process_cpu_timer(tsk, clock_id, &nval, &oval); } + it->expires = nval; - it->incr = ninterval; + it->incr = interval; + trace_itimer_state(clock_id == CPUCLOCK_VIRT ? - ITIMER_VIRTUAL : ITIMER_PROF, value, nval); + ITIMER_VIRTUAL : ITIMER_PROF, value, interval, nval); spin_unlock_irq(&tsk->sighand->siglock); - if (ovalue) { - ovalue->it_value = ns_to_timespec64(oval); - ovalue->it_interval = ns_to_timespec64(ointerval); - } + if (ovalue) + *ovalue = oval; } -/* - * Returns true if the timeval is in canonical form - */ #define timeval_valid(t) \ (((t)->tv_sec >= 0) && (((unsigned long) (t)->tv_usec) < USEC_PER_SEC)) -static int do_setitimer(int which, struct itimerspec64 *value, - struct itimerspec64 *ovalue) +static int do_setitimer(int which, ktime_t value, ktime_t interval, + ktime_t *ovalue, ktime_t *ointerval) { struct task_struct *tsk = current; struct hrtimer *timer; - ktime_t expires; switch (which) { case ITIMER_REAL: again: spin_lock_irq(&tsk->sighand->siglock); timer = &tsk->signal->real_timer; - if (ovalue) { - ovalue->it_value = itimer_get_remtime(timer); - ovalue->it_interval - = ktime_to_timespec64(tsk->signal->it_real_incr); - } + if (ovalue) + *ovalue = itimer_get_remtime(timer); + if (ointerval) + *ointerval = tsk->signal->it_real_incr; /* We are sharing ->siglock with it_real_fn() */ if (hrtimer_try_to_cancel(timer) < 0) { spin_unlock_irq(&tsk->sighand->siglock); hrtimer_cancel_wait_running(timer); goto again; } - expires = timespec64_to_ktime(value->it_value); - if (expires != 0) { - tsk->signal->it_real_incr = - timespec64_to_ktime(value->it_interval); - hrtimer_start(timer, expires, HRTIMER_MODE_REL); + if (value != 0) { + tsk->signal->it_real_incr = interval; + hrtimer_start(timer, value, HRTIMER_MODE_REL); } else tsk->signal->it_real_incr = 0; - trace_itimer_state(ITIMER_REAL, value, 0); + trace_itimer_state(ITIMER_REAL, value, interval, 0); spin_unlock_irq(&tsk->sighand->siglock); break; case ITIMER_VIRTUAL: - set_cpu_itimer(tsk, CPUCLOCK_VIRT, value, ovalue); + set_cpu_itimer(tsk, CPUCLOCK_VIRT, value, interval, + ovalue, ointerval); break; case ITIMER_PROF: - set_cpu_itimer(tsk, CPUCLOCK_PROF, value, ovalue); + set_cpu_itimer(tsk, CPUCLOCK_PROF, value, interval, + ovalue, ointerval); break; default: return -EINVAL; @@ -256,11 +257,10 @@ static int do_setitimer(int which, struct itimerspec64 *value, #ifdef CONFIG_SECURITY_SELINUX void clear_itimer(void) { - struct itimerspec64 v = {}; int i; for (i = 0; i < 3; i++) - do_setitimer(i, &v, NULL); + do_setitimer(i, 0, 0, NULL, NULL); } #endif @@ -280,27 +280,23 @@ void clear_itimer(void) */ static unsigned int alarm_setitimer(unsigned int seconds) { - struct itimerspec64 it_new, it_old; + ktime_t old; #if BITS_PER_LONG < 64 if (seconds > INT_MAX) seconds = INT_MAX; #endif - it_new.it_value.tv_sec = seconds; - it_new.it_value.tv_nsec = 0; - it_new.it_interval.tv_sec = it_new.it_interval.tv_nsec = 0; - do_setitimer(ITIMER_REAL, &it_new, &it_old); + do_setitimer(ITIMER_REAL, ktime_set(seconds, 0), 0, &old, NULL); /* * We can't return 0 if we have an alarm pending ... And we'd * better return too much than too little anyway */ - if ((!it_old.it_value.tv_sec && it_old.it_value.tv_nsec) || - it_old.it_value.tv_nsec >= 500000) - it_old.it_value.tv_sec++; + if (old > 0 && old < NSEC_PER_SEC) + return 1; - return it_old.it_value.tv_sec; + return div_u64(old + (NSEC_PER_SEC / 2), NSEC_PER_SEC); } /* @@ -314,7 +310,8 @@ SYSCALL_DEFINE1(alarm, unsigned int, seconds) #endif -static int get_itimerval(struct itimerspec64 *o, const struct itimerval __user *i) +static int get_itimerval(ktime_t *value, ktime_t *interval, + const struct itimerval __user *i) { struct itimerval v; @@ -326,41 +323,45 @@ static int get_itimerval(struct itimerspec64 *o, const struct itimerval __user * !timeval_valid(&v.it_interval)) return -EINVAL; - o->it_interval.tv_sec = v.it_interval.tv_sec; - o->it_interval.tv_nsec = v.it_interval.tv_usec * NSEC_PER_USEC; - o->it_value.tv_sec = v.it_value.tv_sec; - o->it_value.tv_nsec = v.it_value.tv_usec * NSEC_PER_USEC; + *interval = ktime_set(v.it_interval.tv_sec, + v.it_interval.tv_usec * NSEC_PER_USEC); + *value = ktime_set(v.it_value.tv_sec, + v.it_value.tv_usec * NSEC_PER_USEC); + return 0; } -SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, value, - struct itimerval __user *, ovalue) + +SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, in, + struct itimerval __user *, out) { - struct itimerspec64 set_buffer, get_buffer; + ktime_t value = 0, interval = 0; + ktime_t ovalue, ointerval; int error; - if (value) { - error = get_itimerval(&set_buffer, value); + if (in) { + error = get_itimerval(&value, &interval, in); if (error) return error; } else { - memset(&set_buffer, 0, sizeof(set_buffer)); printk_once(KERN_WARNING "%s calls setitimer() with new_value NULL pointer." " Misfeature support will be removed\n", current->comm); } - error = do_setitimer(which, &set_buffer, ovalue ? &get_buffer : NULL); - if (error || !ovalue) + if (!out) + return do_setitimer(which, value, interval, NULL, NULL); + + error = do_setitimer(which, value, interval, &ovalue, &ointerval); + if (error) return error; - if (put_itimerval(ovalue, &get_buffer)) - return -EFAULT; - return 0; + return put_itimerval(out, ovalue, ointerval); } #if defined(CONFIG_COMPAT) || defined(CONFIG_ALPHA) -static int get_old_itimerval32(struct itimerspec64 *o, const struct old_itimerval32 __user *i) +static int get_old_itimerval32(ktime_t *value, ktime_t *interval, + const struct old_itimerval32 __user *i) { struct old_itimerval32 v32; @@ -372,36 +373,38 @@ static int get_old_itimerval32(struct itimerspec64 *o, const struct old_itimerva !timeval_valid(&v32.it_interval)) return -EINVAL; - o->it_interval.tv_sec = v32.it_interval.tv_sec; - o->it_interval.tv_nsec = v32.it_interval.tv_usec * NSEC_PER_USEC; - o->it_value.tv_sec = v32.it_value.tv_sec; - o->it_value.tv_nsec = v32.it_value.tv_usec * NSEC_PER_USEC; + *interval = ktime_set(v32.it_interval.tv_sec, + v32.it_interval.tv_usec * NSEC_PER_USEC); + *value = ktime_set(v32.it_value.tv_sec, + v32.it_value.tv_usec * NSEC_PER_USEC); + return 0; } COMPAT_SYSCALL_DEFINE3(setitimer, int, which, - struct old_itimerval32 __user *, value, - struct old_itimerval32 __user *, ovalue) + struct old_itimerval32 __user *, in, + struct old_itimerval32 __user *, out) { - struct itimerspec64 set_buffer, get_buffer; + ktime_t value = 0, interval = 0; + ktime_t ovalue, ointerval; int error; - if (value) { - error = get_old_itimerval32(&set_buffer, value); + if (in) { + error = get_old_itimerval32(&value, &interval, in); if (error) return error; } else { - memset(&set_buffer, 0, sizeof(set_buffer)); printk_once(KERN_WARNING "%s calls setitimer() with new_value NULL pointer." " Misfeature support will be removed\n", current->comm); } - error = do_setitimer(which, &set_buffer, ovalue ? &get_buffer : NULL); - if (error || !ovalue) + if (!out) + return do_setitimer(which, value, interval, NULL, NULL); + + error = do_setitimer(which, value, interval, &ovalue, &ointerval); + if (error) return error; - if (put_old_itimerval32(ovalue, &get_buffer)) - return -EFAULT; - return 0; + return put_old_itimerval32(out, ovalue, ointerval); } #endif From patchwork Fri Nov 8 21:12:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178984 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3294152ilf; Fri, 8 Nov 2019 13:19:21 -0800 (PST) X-Google-Smtp-Source: APXvYqyWqCNqSdLMn6hH924SQZZAb3W/KGNvzHlxrKR1A/5ha92lUs4MxHnqmYTvilYSpFqCyOzB X-Received: by 2002:a50:fd03:: with SMTP id i3mr12965265eds.70.1573247961408; Fri, 08 Nov 2019 13:19:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573247961; cv=none; d=google.com; s=arc-20160816; b=Ylt+vvG8PbH47xkD52SeJP7EKsNk2XWZaD/h1XUjqzqfrAfBx8Abp1pB5cbTw8x+kv dlaeGm7p0Fw5RjwXPoeGMQSgwCcftkfLSR+LkeBKc4DEoG4GvoYN1ob8Umr5+9FC83Qs Ya5qbSJOv59A/h2ymqqUkz1olDaarSAkkGu+VyV3rSbky3NdtXT+bMlbd3gIO2+vdQY1 Mp+hwUPbDs1aOkByFTgrvAllsZRROft4PnIGDEGLDvtvgYoSBXUuYYnUDvFjBebH9qCb bJ46sE1+SWCScRhMVYRibA02NoGQZYF1DLo2UeG3xXa58HxlGfMwJGqLq+00kLwvH68t URDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=MupR6n2V74tQKX9WQ4N/obcoZ+wJ1AwghA9ekGjbfYU=; b=IljT3wiAsUkxYlFAiOoCDLcPC9I6BznupMEfoMAEVDu73PoYA5VyFtyBH4l8DqCPZ5 FRQFeQysq/XwqhTpANYXtM23dpBAr9Z+EZ7dMYsaOCjg7oigzfZ87J5LyTildeIWpGQi U+HZJ8AYszCofkKCSTS+UR+gq5tQqwOGMHMKRLJ5m2fptNpWHMNZWYKBMr1bwErkh5Xg R00iK+akilBEVKrZjTmMI4FjMbdbKrWBctTTG9/F5Ga6HhnQ7hGOyVpNYLDrOc/7U1sT d5+4mY+7SokSNu0wcRVzcY+595zfLCKmQIajTjLxNeW4Pkqv9R2+Ei4Qx0tVBbJ0gpIJ Av3g== 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 u6si4640455ejr.410.2019.11.08.13.19.21; Fri, 08 Nov 2019 13:19:21 -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 S2387450AbfKHVTS (ORCPT + 26 others); Fri, 8 Nov 2019 16:19:18 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:58599 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732900AbfKHVTR (ORCPT ); Fri, 8 Nov 2019 16:19:17 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MBV2f-1idO8m32wp-00CyPO; Fri, 08 Nov 2019 22:19:03 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Geert Uytterhoeven , Christian Brauner , linux-api@vger.kernel.org Subject: [PATCH 23/23] y2038: allow disabling time32 system calls Date: Fri, 8 Nov 2019 22:12:22 +0100 Message-Id: <20191108211323.1806194-14-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108210236.1296047-1-arnd@arndb.de> References: <20191108210236.1296047-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:8kgYmNQ9FQSllSkEOIPxyYOL2e1TJIU6BTRoAdURd2aYBpXFJhd 409Fe05T9SdzWJBV9ZMaytQs0D1F/noKiyW+cBwL6Mq+wqcALiUG5OQbIPZYgcTmtSeEFGK Vwwsqnwq0U+WDi1bkb2BlASWPv0v0gPnlTh1U8aXTHIwdNUyuE9MptbSqctOps1MhDWqx/e XV/Lm4FFZPIxUbZ6YjATA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:hJ2TEM4EV1Y=:iSp181kxBetQ1yK6nXykii 8LC4sZ/lqSN2IvVz1A4FjxKMqpPsXPuBLsHuFxF+Af3XKM/RH5eRCj5mB9JnboRPLuNZW6Imm p8gH5ipo/xtrA/puj9L9eRyF0SKsKFmkO+0+pcQpMQymBcZJ2+GfXbh73qhWNlIqkpcTopxDr Gyub9NXs61nhCgRyvtXiXMVCuor2+SOmAKlG6O38HyRoXY1+7nhjZ2xmaRAeSdVDfUz9SaeTq G2SrWhULxo2y0G8iFy7mWuIceR3DmorBlplFI898D3PsK09A4O6iUWDwUsPz/7aPPL0jFYUwe 60PT6plnvm8t2E6oIRBVCckbNi2Nuq/cLdsH9KxqbvRzc6m2K7mMPts77STA5dy8Q4PlreGnC +cwSpRcleKAeuta7i4T3Gs2AEMCzYiwLNTFAfA6NFB8nE3MIaJ2DTso1H3yUVu6DzprtsCnCf B31sgAaFJPbr7I3iFZxA4ziyE6rLHClmT/a1sRJ3N2Qd1yUFKsgO95RARL1+khYXkZtB2rE6k 9wsOk2p9ftdVQKjjCwm7nFHPKELK08fkGUEjQsmAuDNt44WrNMF/VKbF+DoXPzaygm1dsvYKU wVvM9/RKg8PxVCZ9h9tprN6dxYEdMxabGs9fbclBwxzGjRcIuY00h4LSg99LB3fVX1LPCVREa /0OVhjGQZzgZmS0xj1ALFlM//5NdX8n7Xqh7IocWowZlIyajNmKzJJbrEMI5lvV3DhEABvg9V LlVKJVKI0Tf9pIqpaj4Y1rRMEUm2hfrmrLbnV2zIihBUOFomUUViAyGyyA6aUu9T6oKe778d5 STTcmwByYrkPJc94TyeKOIteL7oqz4fLjujgUG+Svt8o64+z2a1dpRWNApdIr5SegsFh/jst9 Oeuvc/763VC7LMrYwGSQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At the moment, the compilation of the old time32 system calls depends purely on the architecture. As systems with new libc based on 64-bit time_t are getting deployed, even architectures that previously supported these (notably x86-32 and arm32 but also many others) no longer depend on them, and removing them from a kernel image results in a smaller kernel binary, the same way we can leave out many other optional system calls. More importantly, on an embedded system that needs to keep working beyond year 2038, any user space program calling these system calls is likely a bug, so removing them from the kernel image does provide an extra debugging help for finding broken applications. I've gone back and forth on hiding this option unless CONFIG_EXPERT is set. This version leaves it visible based on the logic that eventually it will be turned off indefinitely. Signed-off-by: Arnd Bergmann --- arch/Kconfig | 3 ++- kernel/sys_ni.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) -- 2.20.0 Acked-by: Christian Brauner diff --git a/arch/Kconfig b/arch/Kconfig index 0e1fded2940e..1203955ed4d0 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -797,7 +797,8 @@ config COMPAT_OLD_SIGACTION bool config COMPAT_32BIT_TIME - def_bool !64BIT || COMPAT + bool "Provide system calls for 32-bit time_t" + default !64BIT || COMPAT help This enables 32 bit time_t support in addition to 64 bit time_t support. This is relevant on all 32-bit architectures, and 64-bit architectures diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c index 34b76895b81e..3b69a560a7ac 100644 --- a/kernel/sys_ni.c +++ b/kernel/sys_ni.c @@ -410,6 +410,29 @@ COND_SYSCALL(send); COND_SYSCALL(bdflush); COND_SYSCALL(uselib); +/* optional: time32 */ +COND_SYSCALL(time32); +COND_SYSCALL(stime32); +COND_SYSCALL(utime32); +COND_SYSCALL(adjtimex_time32); +COND_SYSCALL(sched_rr_get_interval_time32); +COND_SYSCALL(nanosleep_time32); +COND_SYSCALL(rt_sigtimedwait_time32); +COND_SYSCALL_COMPAT(rt_sigtimedwait_time32); +COND_SYSCALL(timer_settime32); +COND_SYSCALL(timer_gettime32); +COND_SYSCALL(clock_settime32); +COND_SYSCALL(clock_gettime32); +COND_SYSCALL(clock_getres_time32); +COND_SYSCALL(clock_nanosleep_time32); +COND_SYSCALL(utimes_time32); +COND_SYSCALL(futimesat_time32); +COND_SYSCALL(pselect6_time32); +COND_SYSCALL_COMPAT(pselect6_time32); +COND_SYSCALL(ppoll_time32); +COND_SYSCALL_COMPAT(ppoll_time32); +COND_SYSCALL(utimensat_time32); +COND_SYSCALL(clock_adjtime32); /* * The syscalls below are not found in include/uapi/asm-generic/unistd.h