From patchwork Mon Aug 27 19:45:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145203 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp332992ljw; Mon, 27 Aug 2018 12:46:34 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbSUoDYQiuCn+9mfkscnNKKyF3QNE2S2icmP/+Hxs7FV0WvVo1kWYBCdRHsuIO6krURBK3r X-Received: by 2002:a62:9b46:: with SMTP id r67-v6mr15614497pfd.105.1535399194004; Mon, 27 Aug 2018 12:46:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399193; cv=none; d=google.com; s=arc-20160816; b=pZktwh0GDf8c9l+0R1kaK9kWOqVyS0Vc/1oIhWnxzcRQvxZx53rRrB63Q+bE98bupT q0u9LvpUT8LO/ehHdN0h+0YsKFiEQsZVH9riuwtFXQAgXBe0gqJ25Zz5z85QTohevFzf CR7rO/XDZ/xW7aPk0qC6p5yO1B+wbDumnDsni783v6mBU7F/p4ShDUP63TNFFxfLs7XU STKmRAv2FFxh7hM8wwCPeH0SFt+vFh5oNtfvc/bVrcpOdMaUD/wWCw5daoZJGNoirGQB Sm9p2PWLt+YmKTFdgdAQRBxAX7GOgXjC+9e7YMkX/trMcuPckceuCHcCi8T78eHAxDSf s/tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=rzg/E7H2tG0f0md7Bd8lG/JN2GlNunuHN2clgu/yMNQ=; b=TZwtz3PMbiStFIf8jAZp0S+bmp71NPp9j5pWQ1ZnOuTFfFL2R3LrtcpWWLyFFln2O4 BexwZM7L52QeDJjGbIfMkgHjI+tr2CVzqrSrU5tzZ35DzJd/wpTlTRrCvC3pi6x1tH/V 5JakKQMFH+dNy2R5NnDi9tEcAj2L/vNpHMFklEmAuu/SguvC7xIIjG/T6XQhPFAILLuf d4vx0iGcpMfsrmc0Vuv0px+7GQTqlTZ5fa0o/LyMF8clpu6EQ3agLZJjPRLOBqWA2dDO nzpxa19Dz4QPMJHSve0Cu55Jwtgu8VQRljZ35Ul5x7NMbTEah3Xuo9zG1m0AKNIYaKbg jBsw== 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 q12-v6si103196pfc.349.2018.08.27.12.46.33; Mon, 27 Aug 2018 12:46:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; 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 S1727582AbeH0Xdr (ORCPT + 32 others); Mon, 27 Aug 2018 19:33:47 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:46339 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726826AbeH0Xdq (ORCPT ); Mon, 27 Aug 2018 19:33:46 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0MZljq-1gDYzh3UKM-00LZLh; Mon, 27 Aug 2018 21:45:35 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, linux-api@vger.kernel.org, Christoph Hellwig , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, deepa.kernel@gmail.com, linux-arch@vger.kernel.org, Arnd Bergmann Subject: [PATCH 01/14] y2038: Remove unused time interfaces Date: Mon, 27 Aug 2018 21:45:18 +0200 Message-Id: <20180827194531.3796559-2-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827194531.3796559-1-arnd@arndb.de> References: <20180827194531.3796559-1-arnd@arndb.de> X-Provags-ID: V03:K1:l9pGtEXy1VJl8YSXRlfHMeRcd21+uBL57ojDLqzrsbSNEdodMPu wRM+cgro+ox9QO6MSThrmojQwWSX5z1wDhF5/IU3mRzDPQMOFGmFE15UcKgdufaz+dZ8pEq 0pzWkh1vq7Fxgn/QfIq6fHKrFEpqy1zqcAEd7wMbdRq8oExZPkdKxW/pFtq5nXlwXuO1eJM 1dRcCPvvM6itA3b74ijVQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:Mt5D8JkHFCw=:lpowqU3NLfdNL9Rp+EPizm St4wXoEud4ZGPnEtiI1BUpOsj8MV/uiAujcqk8Y9J74KAOKgJP8wr7gxNLSPDl3Z4+DgSSFx9 biv85KUZPVa4h2xTXBeBWs2mYpKn4+H3PWk5JZ1AFk0Pj5mtInFKioFF33JLxtQVmphLhx9o/ DUIAcIF8j+qZhE/CXlq44ISWsUOh6oH4S+ohpSHnsEV+ZF7PMcdGweschGIo8xA3VT5+BZkd6 y0XIeEwt0WdnPB8LTJqzSBJeBYD8KtCGBFHjeCpBlKBrXh1LN90NFtOig1BGMhlHgF7h5IwhG i+fOYo5g1gtogZ/gSpzHIRWeqFOBBb8N8KG2UcuQ/FmN4qtJbL3f46n7LVxP2eqw0WqeaJFHs rmf6yiyRfEg5B/pOrTKSU7juKMF19gqMS3uhoc16/Yd5rHcpCtpxPfsG3ajVK3YO+2zlZeYAA 3QrXiiyRS3RdOY1+uE6Dh9iereDSnBT5JiM5clO7bY5telzKPh+6GK1NqrUh0IfFDNUGm+A5G Q4DsI0WALnEvGgkFOqNrtNfisK7JXCVAuEIIafCOkjVGb2d6WXpE+TRHW+YEtv03ctSZwD80z i1M9NTdAH9cChIESrbiGXg1IZJnPykeZH6n5GQ6QHXnzhj/3hnaSg2RdUxfy2e83Z9Nd9OGUy NWKFOOHr6GTgxeehHZ1uCO0xbcOambvHBOBhE37svGLMgL2KwpdxouLFhKmZ8WW/LL7g= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After many small patches, at least some of the deprecated interfaces have no remaining users any more and can be removed: current_kernel_time do_settimeofday get_monotonic_boottime get_monotonic_boottime64 get_monotonic_coarse get_monotonic_coarse64 getrawmonotonic64 ktime_get_real_ts timekeeping_clocktai timespec_trunc timespec_valid_strict time_to_tm For many of the remaining time functions, we are missing one or two patches that failed to make it into 4.19, they will be removed in the following merge window. The replacement functions for the removed interfaces are documented in Documentation/core-api/timekeeping.rst. Signed-off-by: Arnd Bergmann --- include/linux/time32.h | 25 ------------------ include/linux/timekeeping.h | 12 --------- include/linux/timekeeping32.h | 50 ----------------------------------- kernel/time/time.c | 24 ----------------- 4 files changed, 111 deletions(-) -- 2.18.0 diff --git a/include/linux/time32.h b/include/linux/time32.h index d1ae43c13e25..92c0ca092d93 100644 --- a/include/linux/time32.h +++ b/include/linux/time32.h @@ -105,16 +105,6 @@ static inline bool timespec_valid(const struct timespec *ts) return true; } -static inline bool timespec_valid_strict(const struct timespec *ts) -{ - if (!timespec_valid(ts)) - return false; - /* Disallow values that could overflow ktime_t */ - if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX) - return false; - return true; -} - /** * timespec_to_ns - Convert timespec to nanoseconds * @ts: pointer to the timespec variable to be converted @@ -149,19 +139,6 @@ static __always_inline void timespec_add_ns(struct timespec *a, u64 ns) a->tv_nsec = ns; } -/** - * time_to_tm - converts the calendar time to local broken-down time - * - * @totalsecs the number of seconds elapsed since 00:00:00 on January 1, 1970, - * Coordinated Universal Time (UTC). - * @offset offset seconds adding to totalsecs. - * @result pointer to struct tm variable to receive broken-down time - */ -static inline void time_to_tm(time_t totalsecs, int offset, struct tm *result) -{ - time64_to_tm(totalsecs, offset, result); -} - static inline unsigned long mktime(const unsigned int year, const unsigned int mon, const unsigned int day, const unsigned int hour, const unsigned int min, @@ -183,8 +160,6 @@ static inline bool timeval_valid(const struct timeval *tv) return true; } -extern struct timespec timespec_trunc(struct timespec t, unsigned int gran); - /** * timeval_to_ns - Convert timeval to nanoseconds * @ts: pointer to the timeval variable to be converted diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 5d738804e3d6..3faba06411aa 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -266,9 +266,6 @@ extern int update_persistent_clock64(struct timespec64 now); * deprecated aliases, don't use in new code */ #define getnstimeofday64(ts) ktime_get_real_ts64(ts) -#define get_monotonic_boottime64(ts) ktime_get_boottime_ts64(ts) -#define getrawmonotonic64(ts) ktime_get_raw_ts64(ts) -#define timekeeping_clocktai64(ts) ktime_get_clocktai_ts64(ts) static inline struct timespec64 current_kernel_time64(void) { @@ -279,13 +276,4 @@ static inline struct timespec64 current_kernel_time64(void) return ts; } -static inline struct timespec64 get_monotonic_coarse64(void) -{ - struct timespec64 ts; - - ktime_get_coarse_ts64(&ts); - - return ts; -} - #endif diff --git a/include/linux/timekeeping32.h b/include/linux/timekeeping32.h index 8762c2f45f8b..a4a4991160fb 100644 --- a/include/linux/timekeeping32.h +++ b/include/linux/timekeeping32.h @@ -9,26 +9,6 @@ extern void do_gettimeofday(struct timeval *tv); unsigned long get_seconds(void); -static inline struct timespec current_kernel_time(void) -{ - struct timespec64 ts64; - - ktime_get_coarse_real_ts64(&ts64); - - return timespec64_to_timespec(ts64); -} - -/** - * Deprecated. Use do_settimeofday64(). - */ -static inline int do_settimeofday(const struct timespec *ts) -{ - struct timespec64 ts64; - - ts64 = timespec_to_timespec64(*ts); - return do_settimeofday64(&ts64); -} - static inline void getnstimeofday(struct timespec *ts) { struct timespec64 ts64; @@ -45,14 +25,6 @@ static inline void ktime_get_ts(struct timespec *ts) *ts = timespec64_to_timespec(ts64); } -static inline void ktime_get_real_ts(struct timespec *ts) -{ - struct timespec64 ts64; - - ktime_get_real_ts64(&ts64); - *ts = timespec64_to_timespec(ts64); -} - static inline void getrawmonotonic(struct timespec *ts) { struct timespec64 ts64; @@ -61,15 +33,6 @@ static inline void getrawmonotonic(struct timespec *ts) *ts = timespec64_to_timespec(ts64); } -static inline struct timespec get_monotonic_coarse(void) -{ - struct timespec64 ts64; - - ktime_get_coarse_ts64(&ts64); - - return timespec64_to_timespec(ts64); -} - static inline void getboottime(struct timespec *ts) { struct timespec64 ts64; @@ -78,19 +41,6 @@ static inline void getboottime(struct timespec *ts) *ts = timespec64_to_timespec(ts64); } -/* - * Timespec interfaces utilizing the ktime based ones - */ -static inline void get_monotonic_boottime(struct timespec *ts) -{ - *ts = ktime_to_timespec(ktime_get_boottime()); -} - -static inline void timekeeping_clocktai(struct timespec *ts) -{ - *ts = ktime_to_timespec(ktime_get_clocktai()); -} - /* * Persistent clock related interfaces */ diff --git a/kernel/time/time.c b/kernel/time/time.c index ccdb351277ee..712543011106 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c @@ -342,30 +342,6 @@ unsigned int jiffies_to_usecs(const unsigned long j) } EXPORT_SYMBOL(jiffies_to_usecs); -/** - * timespec_trunc - Truncate timespec to a granularity - * @t: Timespec - * @gran: Granularity in ns. - * - * Truncate a timespec to a granularity. Always rounds down. gran must - * not be 0 nor greater than a second (NSEC_PER_SEC, or 10^9 ns). - */ -struct timespec timespec_trunc(struct timespec t, unsigned gran) -{ - /* Avoid division in the common cases 1 ns and 1 s. */ - if (gran == 1) { - /* nothing */ - } else if (gran == NSEC_PER_SEC) { - t.tv_nsec = 0; - } else if (gran > 1 && gran < NSEC_PER_SEC) { - t.tv_nsec -= t.tv_nsec % gran; - } else { - WARN(1, "illegal file time granularity: %u", gran); - } - return t; -} -EXPORT_SYMBOL(timespec_trunc); - /* * mktime64 - Converts date to seconds. * Converts Gregorian date to seconds since 1970-01-01 00:00:00. From patchwork Mon Aug 27 19:45:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145195 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp332332ljw; Mon, 27 Aug 2018 12:45:49 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbFApTczPT4MwgW9GsLkivtcLARLTJDSJ/R3TCB9coJSlhYvzPSyF8yG/MvvpDOLRJMD1Oz X-Received: by 2002:a17:902:7b97:: with SMTP id w23-v6mr14405504pll.66.1535399149341; Mon, 27 Aug 2018 12:45:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399149; cv=none; d=google.com; s=arc-20160816; b=fmZy3tPPFL+eVE6xSaqW5jTsvyiG8rytQCAwGvbW7vAvgXY+kaZgz/cqYGEpnYx3y0 x2iCcMQCJ+lxzSZeYUYKd2VrPpnoc0JyZ1ZUE2hTGYoG1ZS4Hz+hPdY6VK8iNMx4AbC9 UwBJUSjqWJjiIU1/q2s7bdCNFefhC6owmG6TwHjTTNDNNIFq+yCYTfoRMxRr5CtADppQ tn3w1R3rjh7prJ7YAIhlPE8MTAAO6UXYCOgHG4QbnaNBb4jh3s2YGqqr7aUocc04Hoca hVrBpW15jt4I6Ju0U/kyojjKwPxISKHOw2rDGxUqJF8aUxpQMe9urB3rTocqqw0AFg7z CT3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=5pg7Z5zydFRKF4c+BuF+MA5k3zOWhazs0uG5GdzG6M8=; b=ZtctEq+I3VnZbD5j7J20MY8c9l8DtMrOjTgAt7ZoEpv6cwyCVEeMUQa0r2z3FzMcuB oILYkPMvM6yne4qUtd1m1A4ntTk0xooK56+8QSH/g+5Fj5PJ73tVJaU2C7MoTVUEvrsq uRz0z/XxlYYhgeDik/U2Bb1m5YVz4ZKSgD35X0eA+GMcUuEfM5b41UraebpsA8iYc5Jp gID6GvzxwctR38X4kh1kol5bbNN2iCvmdiXrBgCibaPiYNt3W+Koz9jIv4Uc/nIV34wI VRQyiOiFdaEBhPzg6FVsArDvm57I/O8SXhI18430QE8k2RsMNw3+/DTkkZclttfm6tLR ADKQ== 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 r3-v6si101330plb.221.2018.08.27.12.45.48; Mon, 27 Aug 2018 12:45:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; 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 S1727556AbeH0Xdq (ORCPT + 32 others); Mon, 27 Aug 2018 19:33:46 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:45271 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726895AbeH0Xdp (ORCPT ); Mon, 27 Aug 2018 19:33:45 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0M3C4d-1fcZQF0p8B-00szIC; Mon, 27 Aug 2018 21:45:36 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, linux-api@vger.kernel.org, Christoph Hellwig , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, deepa.kernel@gmail.com, linux-arch@vger.kernel.org, Arnd Bergmann Subject: [PATCH 02/14] y2038: Make do_gettimeofday() and get_seconds() inline Date: Mon, 27 Aug 2018 21:45:19 +0200 Message-Id: <20180827194531.3796559-3-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827194531.3796559-1-arnd@arndb.de> References: <20180827194531.3796559-1-arnd@arndb.de> X-Provags-ID: V03:K1:ZKEuasSY6qBIJl4zp5+4KIsKGtK2ldyYHmcFAwK4NsZcBWRneDq TCRRFam+NkSbu5cVboFYQdk9iO/8ixZz2Q+neyUrL8aNm1o57NYoQKEjC6vSHQk8tZlWLxz j/HeQAdMbD0+t4hkjvMfJX3rpqi+14nZDELzD+Ge4mceN153aZTP4frxbiyy8YUT5DK4uUn M+yf2SJp7IiCu4ZqHm4KA== X-UI-Out-Filterresults: notjunk:1; V01:K0:Kplm45ZfzPY=:iyPj1VALJCMelqM4mSLnmk zGRAs+FyDkRSnyOZD+J+htlMsUWcFLcuSPSzouqtcPCQE5P/64/CEt2IZWztYG0TZdS2fFb+b ccbnwptjuo1rGxieeOOPAh5xs28yZRmKMHWY2mepheAER8G9EsdSJ5l4MUryWCLxhtVmqYM70 NGmTvd4PZt8GK0vXI55ayFJFTmOyG2q6ryPpKGhLU2SRGOHXtsP/OhcF0CJXkT5UQQtyb5t3N MjVrzrtcGuuwr9m5yROTEAjGPK6uNZU3JNk6tpTs+lXDKfc9ULTG+dW6r+Vt8tDDGrU/7oziG vPmv6wn7ClN3pjjyAYnDlZiNV0DQRzRK6icN+vABR2Gw+DV7jCfa9A67aYLu3b7ph4v9MMV8i 3RPD8F3ht7xw5ZVBTcDp746ig2wc3KHVrsgORvglXztWYcljqDoU21Qe7JXbEsuNeRLKHZc0J b2t6LyyUB8/0cO+Cdu/9K4nq4lL9eQRhyz33osC4mHPPIB5rAUiejAV+UDL/dc3WsFVa3ec07 lR9VQsJAUpy3yfajKVurSycXVTl+zncoMMq4YgblDXkngKBRWyagZUOx8pd1ZWMLhgROEX3bb +14JG2XVsyHaW3x/+aO33QWnWT82uKva359AHB99t2AjRbxBOtyzbLTYslrRnuuuopNwIuXVU 8vFLNcLhckaSKvxhr4SuN0dq1GKcEEToJnFZwCpIVTbijEV8faLW/axN8K17mLzihnJ8= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org get_seconds() and do_gettimeofday() are only used by a few modules now any more (waiting for the respective patches to get accepted), and they are among the last holdouts of code that is not y2038 safe in the core kernel. Move the implementation into the timekeeping32.h header to clean up the core kernel and isolate the old interfaces further. Signed-off-by: Arnd Bergmann --- include/linux/timekeeping32.h | 15 +++++++++++++-- kernel/time/time.c | 15 +++++++++------ kernel/time/timekeeping.c | 24 ------------------------ 3 files changed, 22 insertions(+), 32 deletions(-) -- 2.18.0 diff --git a/include/linux/timekeeping32.h b/include/linux/timekeeping32.h index a4a4991160fb..a502616f7e1c 100644 --- a/include/linux/timekeeping32.h +++ b/include/linux/timekeeping32.h @@ -6,8 +6,19 @@ * over time so we can remove the file here. */ -extern void do_gettimeofday(struct timeval *tv); -unsigned long get_seconds(void); +static inline void do_gettimeofday(struct timeval *tv) +{ + struct timespec64 now; + + ktime_get_real_ts64(&now); + tv->tv_sec = now.tv_sec; + tv->tv_usec = now.tv_nsec/1000; +} + +static inline unsigned long get_seconds(void) +{ + return ktime_get_real_seconds(); +} static inline void getnstimeofday(struct timespec *ts) { diff --git a/kernel/time/time.c b/kernel/time/time.c index 712543011106..de332250d6fa 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c @@ -144,9 +144,11 @@ SYSCALL_DEFINE2(gettimeofday, struct timeval __user *, tv, struct timezone __user *, tz) { if (likely(tv != NULL)) { - struct timeval ktv; - do_gettimeofday(&ktv); - if (copy_to_user(tv, &ktv, sizeof(ktv))) + struct timespec64 ts; + + ktime_get_real_ts64(&ts); + if (put_user(ts.tv_sec, &tv->tv_sec) || + put_user(ts.tv_nsec / 1000, &tv->tv_usec)) return -EFAULT; } if (unlikely(tz != NULL)) { @@ -227,10 +229,11 @@ COMPAT_SYSCALL_DEFINE2(gettimeofday, struct compat_timeval __user *, tv, struct timezone __user *, tz) { if (tv) { - struct timeval ktv; + struct timespec64 ts; - do_gettimeofday(&ktv); - if (compat_put_timeval(&ktv, tv)) + ktime_get_real_ts64(&ts); + if (put_user(ts.tv_sec, &tv->tv_sec) || + put_user(ts.tv_nsec / 1000, &tv->tv_usec)) return -EFAULT; } if (tz) { diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index f3b22f456fac..2d110c948805 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1211,22 +1211,6 @@ int get_device_system_crosststamp(int (*get_time_fn) } EXPORT_SYMBOL_GPL(get_device_system_crosststamp); -/** - * do_gettimeofday - Returns the time of day in a timeval - * @tv: pointer to the timeval to be set - * - * NOTE: Users should be converted to using getnstimeofday() - */ -void do_gettimeofday(struct timeval *tv) -{ - struct timespec64 now; - - getnstimeofday64(&now); - tv->tv_sec = now.tv_sec; - tv->tv_usec = now.tv_nsec/1000; -} -EXPORT_SYMBOL(do_gettimeofday); - /** * do_settimeofday64 - Sets the time of day. * @ts: pointer to the timespec64 variable containing the new time @@ -2174,14 +2158,6 @@ void getboottime64(struct timespec64 *ts) } EXPORT_SYMBOL_GPL(getboottime64); -unsigned long get_seconds(void) -{ - struct timekeeper *tk = &tk_core.timekeeper; - - return tk->xtime_sec; -} -EXPORT_SYMBOL(get_seconds); - void ktime_get_coarse_real_ts64(struct timespec64 *ts) { struct timekeeper *tk = &tk_core.timekeeper; From patchwork Mon Aug 27 19:45:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145199 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp332402ljw; Mon, 27 Aug 2018 12:45:54 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbEgyhizE+C9fo4JVx0T6fVSAN6O/EYzNAtg7iLWHzIqLqd8qxmI8fApOBsJYZu7IaNYef6 X-Received: by 2002:a63:f206:: with SMTP id v6-v6mr13695282pgh.319.1535399154350; Mon, 27 Aug 2018 12:45:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399154; cv=none; d=google.com; s=arc-20160816; b=Cj7jl8Mm+K3prjnJKhh0JMZgqrUWcqqXrWrX8kBREfgCcDFLAdT5aTda8PMZRRQi0P /8ToPsoQi6p7zXYOhxSIdFEgqDu/SBA5YSpPJjvQGw1bnDBcPgcKIwj02PzJuSNUQZhk SRydxCJu2W7QzPYaHbtOwsu0XssMISDMhytsSRnpKEYTYBRiUd8pYk48qv3prx+b4HPr 66cHxJuYwkEzbqXGmvO3lX22ALt8O0R1SWXY63TBvdmXQUfztCmpMa3HHcOgfpEMxbwZ 8zS6dr96Xed1b5X0wxHADf4jaxLhF6UwXcvvNBdcZuflveigAnY+lTVAe61osmHHLHsC m1lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=J1/TODq7MvQjg0IKXkRJw9dEBhGMJaiggng9siIOtW4=; b=nAuEhL5xAfTOf5f4BEJ7DYlB/zGGbYXQWEa8c8zvFq7fciiFCHDySwr9G8x3CdfUny pPbug7QdKnMsF26fLyHrjkor4YOk6aRyM8VpA3frW3/RuveQ0w8w8Aip2R1HtK4pzFOG CyAdSci7Ju5gZ7E0w19Az1e/5WcLJnJtw/zdCndBMx3exsvBXh03dRqs6Ltk1ZZ3rsLP E3AOTjF6WXi4FCEdR+gxyAIQAtbsBTjK+2Lg4R6TIhHYkg2bKY7Y9Ife3aB6QRHnW6KY fRPiYglhF59yV8LnCH8Mb1sORGZG5xICmRH7zFGAk62qqex6GY1l07NaNBtzDE5fc2nV c8hQ== 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 o126-v6si110454pga.294.2018.08.27.12.45.54; Mon, 27 Aug 2018 12:45:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; 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 S1727720AbeH0Xdv (ORCPT + 32 others); Mon, 27 Aug 2018 19:33:51 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:34647 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727027AbeH0Xdv (ORCPT ); Mon, 27 Aug 2018 19:33:51 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0Lecog-1faBn42LMc-00qNwD; Mon, 27 Aug 2018 21:45:36 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, linux-api@vger.kernel.org, Christoph Hellwig , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, deepa.kernel@gmail.com, linux-arch@vger.kernel.org, Arnd Bergmann Subject: [PATCH 03/14] y2038: Globally rename compat_time to old_time32 Date: Mon, 27 Aug 2018 21:45:20 +0200 Message-Id: <20180827194531.3796559-4-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827194531.3796559-1-arnd@arndb.de> References: <20180827194531.3796559-1-arnd@arndb.de> X-Provags-ID: V03:K1:ip4TsXMtducD93n9Cn5lsuOjEChTgHXqr0NoeiejhTLT3MzpsSo 8V2PIQPy94iBswInFAoteGOzH/n9m4Sstfr97WxpYU2ERE3QipMJtKziY0UgGKU059OKE6z MBtBnzmziuUdlwXyxz8qU0RwJZvzJ3Opm9OeCcO3GTkspUm4mIZ9jDYCDBNEPxnE3HCg71C DgFpqIja7v5aVfrJyfZ+Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:wU6arxbbFD0=:9x/dlUdyBJQqas8hGe8xB/ ScuecfuIFjSHmXxH0xEK03d7dnauCg2FzwB5livXU1xbaEoy/YPd6AtY5tMm6ANSD7f0fhaTi lT6+9fSORp9HQT+uwSs88qRE0iva9lrfT4XeJ3vqA2HfLM+pf94xeYZYk+VSgv4bejW/e1WpZ DyovPZpCaEQUBuHbZGLA7c+ca37bl5jEb1RJxfgEv4x0b1AUQzu4Kag8K2+zD0RA/27rIoVg5 /ow+ofg9QojPLkeGnPKMUtfN5rBOsuh5xKIhnjfUNUQGr6JcrZhT7ECQxxuH3P1vBlW8Ymz+T +YzfrXG8pIA/JaR7Hyai2mAQH86G3f/DGj4TFev3KwHRHm7ZEgM2Tg8AgEmUMBsRbKn/1Wfjj lm7gCONFd3QjuTJzT01LZ7ROTT9bqjUwErJd0t3X+XvWmlq7NO3/x6u3gQDUdajmfNJ1sBnSP ++Lg1gTafLvLjDx5bYsgLGjyKTOGyG8wUVNCPeGTtbQu41z0NLafAF9NwMiaTI84X6EvLKa0X 2AN9qlxwyq4BLrUNHdOZavHCL/kBb3bgYA+GMiGsJdYkzcx0XGRyHJ6C8NxTNWNhP1+pe+Eaq a0tc0woqkNZKIr39YaUOVWyzolOHbUNAucI0GR+2hK/2rmNbU4h1cMrQxi6ibCJUeTDN3qdhe DGRqWF+BFbfoNPtVvwRnaP+tfcuygKCuTfBah5CmCd91zwAUkE0WyodHX3WrPDUIirM4= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christoph Hellwig suggested a slightly different path for handling backwards compatibility with the 32-bit time_t based system calls: Rather than simply reusing the compat_sys_* entry points on 32-bit architectures unchanged, we get rid of those entry points and the compat_time types by renaming them to something that makes more sense on 32-bit architectures (which don't have a compat mode otherwise), and then share the entry points under the new name with the 64-bit architectures that use them for implementing the compatibility. The following types and interfaces are renamed here, and moved from linux/compat_time.h to linux/time32.h: old new --- --- compat_time_t old_time32_t struct compat_timeval struct old_timeval32 struct compat_timespec struct old_timespec32 struct compat_itimerspec struct old_itimerspec32 ns_to_compat_timeval() ns_to_old_timeval32() get_compat_itimerspec64() get_old_itimerspec32() put_compat_itimerspec64() put_old_itimerspec32() compat_get_timespec64() get_old_timespec32() compat_put_timespec64() put_old_timespec32() As we already have aliases in place, this patch addresses only the instances that are relevant to the system call interface in particular, not those that occur in device drivers and other modules. Those will get handled separately, while providing the 64-bit version of the respective interfaces. I'm not renaming the timex, rusage and itimerval structures, as we are still debating what the new interface will look like, and whether we will need a replacement at all. This also doesn't change the names of the syscall entry points, which can be done more easily when we actually switch over the 32-bit architectures to use them, at that point we need to change COMPAT_SYSCALL_DEFINEx to SYSCALL_DEFINEx with a new name, e.g. with a _time32 suffix. Suggested-by: Christoph Hellwig Link: https://lore.kernel.org/lkml/20180705222110.GA5698@infradead.org/ Signed-off-by: Arnd Bergmann --- arch/arm64/include/asm/compat.h | 6 +- arch/arm64/include/asm/stat.h | 2 +- arch/mips/include/asm/compat.h | 6 +- arch/mips/kernel/binfmt_elfn32.c | 14 ++--- arch/mips/kernel/binfmt_elfo32.c | 14 ++--- arch/parisc/include/asm/compat.h | 6 +- arch/powerpc/include/asm/compat.h | 6 +- arch/powerpc/kernel/asm-offsets.c | 8 +-- arch/powerpc/oprofile/backtrace.c | 2 +- arch/sparc/include/asm/compat.h | 6 +- fs/aio.c | 8 +-- fs/compat_binfmt_elf.c | 2 +- fs/select.c | 20 +++---- fs/timerfd.c | 12 ++-- fs/utimes.c | 12 ++-- include/linux/compat.h | 96 +++++++++++++++---------------- include/linux/compat_time.h | 32 ----------- include/linux/elfcore-compat.h | 8 +-- include/linux/restart_block.h | 4 +- include/linux/syscalls.h | 2 +- include/linux/time32.h | 48 ++++++++++++---- ipc/mqueue.c | 8 +-- ipc/msg.c | 6 +- ipc/sem.c | 10 ++-- ipc/shm.c | 6 +- ipc/syscall.c | 2 +- ipc/util.h | 2 +- kernel/compat.c | 8 +-- kernel/futex_compat.c | 2 +- kernel/sched/core.c | 4 +- kernel/signal.c | 2 +- kernel/time/hrtimer.c | 8 +-- kernel/time/posix-stubs.c | 18 +++--- kernel/time/posix-timers.c | 30 +++++----- kernel/time/time.c | 58 +++++++++---------- net/compat.c | 4 +- 36 files changed, 237 insertions(+), 245 deletions(-) delete mode 100644 include/linux/compat_time.h -- 2.18.0 diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index 1a037b94eba1..4a89007db14a 100644 --- a/arch/arm64/include/asm/compat.h +++ b/arch/arm64/include/asm/compat.h @@ -86,11 +86,11 @@ struct compat_stat { compat_off_t st_size; compat_off_t st_blksize; compat_off_t st_blocks; - compat_time_t st_atime; + old_time32_t st_atime; compat_ulong_t st_atime_nsec; - compat_time_t st_mtime; + old_time32_t st_mtime; compat_ulong_t st_mtime_nsec; - compat_time_t st_ctime; + old_time32_t st_ctime; compat_ulong_t st_ctime_nsec; compat_ulong_t __unused4[2]; }; diff --git a/arch/arm64/include/asm/stat.h b/arch/arm64/include/asm/stat.h index eab738019707..397c6ccd04e7 100644 --- a/arch/arm64/include/asm/stat.h +++ b/arch/arm64/include/asm/stat.h @@ -20,7 +20,7 @@ #ifdef CONFIG_COMPAT -#include +#include #include /* diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h index 78675f19440f..7dcbd855814e 100644 --- a/arch/mips/include/asm/compat.h +++ b/arch/mips/include/asm/compat.h @@ -59,11 +59,11 @@ struct compat_stat { s32 st_pad2[2]; compat_off_t st_size; s32 st_pad3; - compat_time_t st_atime; + old_time32_t st_atime; s32 st_atime_nsec; - compat_time_t st_mtime; + old_time32_t st_mtime; s32 st_mtime_nsec; - compat_time_t st_ctime; + old_time32_t st_ctime; s32 st_ctime_nsec; s32 st_blksize; s32 st_blocks; diff --git a/arch/mips/kernel/binfmt_elfn32.c b/arch/mips/kernel/binfmt_elfn32.c index 89b234844534..7a12763d553a 100644 --- a/arch/mips/kernel/binfmt_elfn32.c +++ b/arch/mips/kernel/binfmt_elfn32.c @@ -54,10 +54,10 @@ struct elf_prstatus32 pid_t pr_ppid; pid_t pr_pgrp; pid_t pr_sid; - struct compat_timeval pr_utime; /* User time */ - struct compat_timeval pr_stime; /* System time */ - struct compat_timeval pr_cutime;/* Cumulative user time */ - struct compat_timeval pr_cstime;/* Cumulative system time */ + struct old_timeval32 pr_utime; /* User time */ + struct old_timeval32 pr_stime; /* System time */ + struct old_timeval32 pr_cutime;/* Cumulative user time */ + struct old_timeval32 pr_cstime;/* Cumulative system time */ elf_gregset_t pr_reg; /* GP registers */ int pr_fpvalid; /* True if math co-processor being used. */ }; @@ -81,9 +81,9 @@ struct elf_prpsinfo32 #define elf_caddr_t u32 #define init_elf_binfmt init_elfn32_binfmt -#define jiffies_to_timeval jiffies_to_compat_timeval +#define jiffies_to_timeval jiffies_to_old_timeval32 static __inline__ void -jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) +jiffies_to_old_timeval32(unsigned long jiffies, struct old_timeval32 *value) { /* * Convert jiffies to nanoseconds and separate with @@ -101,6 +101,6 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) #define TASK_SIZE TASK_SIZE32 #undef ns_to_timeval -#define ns_to_timeval ns_to_compat_timeval +#define ns_to_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 a88c59db3d48..e6db06a1d31a 100644 --- a/arch/mips/kernel/binfmt_elfo32.c +++ b/arch/mips/kernel/binfmt_elfo32.c @@ -59,10 +59,10 @@ struct elf_prstatus32 pid_t pr_ppid; pid_t pr_pgrp; pid_t pr_sid; - struct compat_timeval pr_utime; /* User time */ - struct compat_timeval pr_stime; /* System time */ - struct compat_timeval pr_cutime;/* Cumulative user time */ - struct compat_timeval pr_cstime;/* Cumulative system time */ + struct old_timeval32 pr_utime; /* User time */ + struct old_timeval32 pr_stime; /* System time */ + struct old_timeval32 pr_cutime;/* Cumulative user time */ + struct old_timeval32 pr_cstime;/* Cumulative system time */ elf_gregset_t pr_reg; /* GP registers */ int pr_fpvalid; /* True if math co-processor being used. */ }; @@ -86,9 +86,9 @@ struct elf_prpsinfo32 #define elf_caddr_t u32 #define init_elf_binfmt init_elf32_binfmt -#define jiffies_to_timeval jiffies_to_compat_timeval +#define jiffies_to_timeval jiffies_to_old_timeval32 static inline void -jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) +jiffies_to_old_timeval32(unsigned long jiffies, struct old_timeval32 *value) { /* * Convert jiffies to nanoseconds and separate with @@ -104,6 +104,6 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) #define TASK_SIZE TASK_SIZE32 #undef ns_to_timeval -#define ns_to_timeval ns_to_compat_timeval +#define ns_to_timeval ns_to_old_timeval32 #include "../../../fs/binfmt_elf.c" diff --git a/arch/parisc/include/asm/compat.h b/arch/parisc/include/asm/compat.h index ab8a54771507..32dadaf2b534 100644 --- a/arch/parisc/include/asm/compat.h +++ b/arch/parisc/include/asm/compat.h @@ -48,11 +48,11 @@ struct compat_stat { u16 st_reserved2; /* old st_gid */ compat_dev_t st_rdev; compat_off_t st_size; - compat_time_t st_atime; + old_time32_t st_atime; u32 st_atime_nsec; - compat_time_t st_mtime; + old_time32_t st_mtime; u32 st_mtime_nsec; - compat_time_t st_ctime; + old_time32_t st_ctime; u32 st_ctime_nsec; s32 st_blksize; s32 st_blocks; diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h index 85c8af2bb272..93f79d1a03c3 100644 --- a/arch/powerpc/include/asm/compat.h +++ b/arch/powerpc/include/asm/compat.h @@ -55,11 +55,11 @@ struct compat_stat { compat_off_t st_size; compat_off_t st_blksize; compat_off_t st_blocks; - compat_time_t st_atime; + old_time32_t st_atime; u32 st_atime_nsec; - compat_time_t st_mtime; + old_time32_t st_mtime; u32 st_mtime_nsec; - compat_time_t st_ctime; + old_time32_t st_ctime; u32 st_ctime_nsec; u32 __unused4[2]; }; diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 89cf15566c4e..041a115789a1 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c @@ -387,12 +387,12 @@ int main(void) OFFSET(CFG_SYSCALL_MAP64, vdso_data, syscall_map_64); OFFSET(TVAL64_TV_SEC, timeval, tv_sec); OFFSET(TVAL64_TV_USEC, timeval, tv_usec); - OFFSET(TVAL32_TV_SEC, compat_timeval, tv_sec); - OFFSET(TVAL32_TV_USEC, compat_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); OFFSET(TSPC64_TV_NSEC, timespec, tv_nsec); - OFFSET(TSPC32_TV_SEC, compat_timespec, tv_sec); - OFFSET(TSPC32_TV_NSEC, compat_timespec, tv_nsec); + 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); diff --git a/arch/powerpc/oprofile/backtrace.c b/arch/powerpc/oprofile/backtrace.c index ad054dd0d666..5df6290d1ccc 100644 --- a/arch/powerpc/oprofile/backtrace.c +++ b/arch/powerpc/oprofile/backtrace.c @@ -7,7 +7,7 @@ * 2 of the License, or (at your option) any later version. **/ -#include +#include #include #include #include diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h index 4eb51d2dae98..7018cb60beef 100644 --- a/arch/sparc/include/asm/compat.h +++ b/arch/sparc/include/asm/compat.h @@ -47,11 +47,11 @@ struct compat_stat { __compat_gid_t st_gid; compat_dev_t st_rdev; compat_off_t st_size; - compat_time_t st_atime; + old_time32_t st_atime; compat_ulong_t st_atime_nsec; - compat_time_t st_mtime; + old_time32_t st_mtime; compat_ulong_t st_mtime_nsec; - compat_time_t st_ctime; + old_time32_t st_ctime; compat_ulong_t st_ctime_nsec; compat_off_t st_blksize; compat_off_t st_blocks; diff --git a/fs/aio.c b/fs/aio.c index b9350f3360c6..301e6314183b 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -2135,12 +2135,12 @@ COMPAT_SYSCALL_DEFINE5(io_getevents, compat_aio_context_t, ctx_id, compat_long_t, min_nr, compat_long_t, nr, struct io_event __user *, events, - struct compat_timespec __user *, timeout) + struct old_timespec32 __user *, timeout) { struct timespec64 t; int ret; - if (timeout && compat_get_timespec64(&t, timeout)) + if (timeout && get_old_timespec32(&t, timeout)) return -EFAULT; ret = do_io_getevents(ctx_id, min_nr, nr, events, timeout ? &t : NULL); @@ -2160,7 +2160,7 @@ COMPAT_SYSCALL_DEFINE6(io_pgetevents, compat_long_t, min_nr, compat_long_t, nr, struct io_event __user *, events, - struct compat_timespec __user *, timeout, + struct old_timespec32 __user *, timeout, const struct __compat_aio_sigset __user *, usig) { struct __compat_aio_sigset ksig = { NULL, }; @@ -2168,7 +2168,7 @@ COMPAT_SYSCALL_DEFINE6(io_pgetevents, struct timespec64 t; int ret; - if (timeout && compat_get_timespec64(&t, timeout)) + if (timeout && get_old_timespec32(&t, timeout)) return -EFAULT; if (usig && copy_from_user(&ksig, usig, sizeof(ksig))) diff --git a/fs/compat_binfmt_elf.c b/fs/compat_binfmt_elf.c index 504b3c3539dc..15f6e96b3bd9 100644 --- a/fs/compat_binfmt_elf.c +++ b/fs/compat_binfmt_elf.c @@ -52,7 +52,7 @@ #define elf_prpsinfo compat_elf_prpsinfo #undef ns_to_timeval -#define ns_to_timeval ns_to_compat_timeval +#define ns_to_timeval ns_to_old_timeval32 /* * To use this file, asm/elf.h must define compat_elf_check_arch. diff --git a/fs/select.c b/fs/select.c index 4a6b6e4b21cb..22b3bf89f051 100644 --- a/fs/select.c +++ b/fs/select.c @@ -1120,7 +1120,7 @@ int compat_poll_select_copy_remaining(struct timespec64 *end_time, void __user * ts.tv_sec = ts.tv_nsec = 0; if (timeval) { - struct compat_timeval rtv; + struct old_timeval32 rtv; rtv.tv_sec = ts.tv_sec; rtv.tv_usec = ts.tv_nsec / NSEC_PER_USEC; @@ -1128,7 +1128,7 @@ int compat_poll_select_copy_remaining(struct timespec64 *end_time, void __user * if (!copy_to_user(p, &rtv, sizeof(rtv))) return ret; } else { - if (!compat_put_timespec64(&ts, p)) + if (!put_old_timespec32(&ts, p)) return ret; } /* @@ -1257,10 +1257,10 @@ static int compat_core_sys_select(int n, compat_ulong_t __user *inp, static int do_compat_select(int n, compat_ulong_t __user *inp, compat_ulong_t __user *outp, compat_ulong_t __user *exp, - struct compat_timeval __user *tvp) + struct old_timeval32 __user *tvp) { struct timespec64 end_time, *to = NULL; - struct compat_timeval tv; + struct old_timeval32 tv; int ret; if (tvp) { @@ -1282,7 +1282,7 @@ static int do_compat_select(int n, compat_ulong_t __user *inp, COMPAT_SYSCALL_DEFINE5(select, int, n, compat_ulong_t __user *, inp, compat_ulong_t __user *, outp, compat_ulong_t __user *, exp, - struct compat_timeval __user *, tvp) + struct old_timeval32 __user *, tvp) { return do_compat_select(n, inp, outp, exp, tvp); } @@ -1307,7 +1307,7 @@ COMPAT_SYSCALL_DEFINE1(old_select, struct compat_sel_arg_struct __user *, arg) static long do_compat_pselect(int n, compat_ulong_t __user *inp, compat_ulong_t __user *outp, compat_ulong_t __user *exp, - struct compat_timespec __user *tsp, compat_sigset_t __user *sigmask, + struct old_timespec32 __user *tsp, compat_sigset_t __user *sigmask, compat_size_t sigsetsize) { sigset_t ksigmask, sigsaved; @@ -1315,7 +1315,7 @@ static long do_compat_pselect(int n, compat_ulong_t __user *inp, int ret; if (tsp) { - if (compat_get_timespec64(&ts, tsp)) + if (get_old_timespec32(&ts, tsp)) return -EFAULT; to = &end_time; @@ -1355,7 +1355,7 @@ static long do_compat_pselect(int n, compat_ulong_t __user *inp, COMPAT_SYSCALL_DEFINE6(pselect6, int, n, compat_ulong_t __user *, inp, compat_ulong_t __user *, outp, compat_ulong_t __user *, exp, - struct compat_timespec __user *, tsp, void __user *, sig) + struct old_timespec32 __user *, tsp, void __user *, sig) { compat_size_t sigsetsize = 0; compat_uptr_t up = 0; @@ -1373,7 +1373,7 @@ COMPAT_SYSCALL_DEFINE6(pselect6, int, n, compat_ulong_t __user *, inp, } COMPAT_SYSCALL_DEFINE5(ppoll, struct pollfd __user *, ufds, - unsigned int, nfds, struct compat_timespec __user *, tsp, + unsigned int, nfds, struct old_timespec32 __user *, tsp, const compat_sigset_t __user *, sigmask, compat_size_t, sigsetsize) { sigset_t ksigmask, sigsaved; @@ -1381,7 +1381,7 @@ COMPAT_SYSCALL_DEFINE5(ppoll, struct pollfd __user *, ufds, int ret; if (tsp) { - if (compat_get_timespec64(&ts, tsp)) + if (get_old_timespec32(&ts, tsp)) return -EFAULT; to = &end_time; diff --git a/fs/timerfd.c b/fs/timerfd.c index d69ad801eb80..803ca070d42e 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c @@ -561,29 +561,29 @@ SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct __kernel_itimerspec __user *, #ifdef CONFIG_COMPAT_32BIT_TIME COMPAT_SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, - const struct compat_itimerspec __user *, utmr, - struct compat_itimerspec __user *, otmr) + const struct old_itimerspec32 __user *, utmr, + struct old_itimerspec32 __user *, otmr) { struct itimerspec64 new, old; int ret; - if (get_compat_itimerspec64(&new, utmr)) + if (get_old_itimerspec32(&new, utmr)) return -EFAULT; ret = do_timerfd_settime(ufd, flags, &new, &old); if (ret) return ret; - if (otmr && put_compat_itimerspec64(&old, otmr)) + if (otmr && put_old_itimerspec32(&old, otmr)) return -EFAULT; return ret; } COMPAT_SYSCALL_DEFINE2(timerfd_gettime, int, ufd, - struct compat_itimerspec __user *, otmr) + struct old_itimerspec32 __user *, otmr) { struct itimerspec64 kotmr; int ret = do_timerfd_gettime(ufd, &kotmr); if (ret) return ret; - return put_compat_itimerspec64(&kotmr, otmr) ? -EFAULT : 0; + return put_old_itimerspec32(&kotmr, otmr) ? -EFAULT : 0; } #endif diff --git a/fs/utimes.c b/fs/utimes.c index 69d4b6ba1bfb..79a65c163f40 100644 --- a/fs/utimes.c +++ b/fs/utimes.c @@ -245,13 +245,13 @@ COMPAT_SYSCALL_DEFINE2(utime, const char __user *, filename, return do_utimes(AT_FDCWD, filename, t ? tv : NULL, 0); } -COMPAT_SYSCALL_DEFINE4(utimensat, unsigned int, dfd, const char __user *, filename, struct compat_timespec __user *, t, int, flags) +COMPAT_SYSCALL_DEFINE4(utimensat, unsigned int, dfd, const char __user *, filename, struct old_timespec32 __user *, t, int, flags) { struct timespec64 tv[2]; if (t) { - if (compat_get_timespec64(&tv[0], &t[0]) || - compat_get_timespec64(&tv[1], &t[1])) + if (get_old_timespec32(&tv[0], &t[0]) || + get_old_timespec32(&tv[1], &t[1])) return -EFAULT; if (tv[0].tv_nsec == UTIME_OMIT && tv[1].tv_nsec == UTIME_OMIT) @@ -261,7 +261,7 @@ COMPAT_SYSCALL_DEFINE4(utimensat, unsigned int, dfd, const char __user *, filena } static long do_compat_futimesat(unsigned int dfd, const char __user *filename, - struct compat_timeval __user *t) + struct old_timeval32 __user *t) { struct timespec64 tv[2]; @@ -282,12 +282,12 @@ static long do_compat_futimesat(unsigned int dfd, const char __user *filename, COMPAT_SYSCALL_DEFINE3(futimesat, unsigned int, dfd, const char __user *, filename, - struct compat_timeval __user *, t) + struct old_timeval32 __user *, t) { return do_compat_futimesat(dfd, filename, t); } -COMPAT_SYSCALL_DEFINE2(utimes, const char __user *, filename, struct compat_timeval __user *, t) +COMPAT_SYSCALL_DEFINE2(utimes, const char __user *, filename, struct old_timeval32 __user *, t) { return do_compat_futimesat(AT_FDCWD, filename, t); } diff --git a/include/linux/compat.h b/include/linux/compat.h index 1a3c4f37e908..0e058792ecf6 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -7,7 +7,7 @@ */ #include -#include +#include #include #include /* for HZ */ @@ -116,13 +116,13 @@ struct compat_sel_arg_struct; struct rusage; struct compat_utimbuf { - compat_time_t actime; - compat_time_t modtime; + old_time32_t actime; + old_time32_t modtime; }; struct compat_itimerval { - struct compat_timeval it_interval; - struct compat_timeval it_value; + struct old_timeval32 it_interval; + struct old_timeval32 it_value; }; struct itimerval; @@ -146,7 +146,7 @@ struct compat_timex { compat_long_t constant; compat_long_t precision; compat_long_t tolerance; - struct compat_timeval time; + struct old_timeval32 time; compat_long_t tick; compat_long_t ppsfreq; compat_long_t jitter; @@ -307,8 +307,8 @@ struct compat_rlimit { }; struct compat_rusage { - struct compat_timeval ru_utime; - struct compat_timeval ru_stime; + struct old_timeval32 ru_utime; + struct old_timeval32 ru_stime; compat_long_t ru_maxrss; compat_long_t ru_ixrss; compat_long_t ru_idrss; @@ -457,8 +457,8 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *to, const siginfo_t *fr int get_compat_sigevent(struct sigevent *event, const struct compat_sigevent __user *u_event); -static inline int compat_timeval_compare(struct compat_timeval *lhs, - struct compat_timeval *rhs) +static inline int old_timeval32_compare(struct old_timeval32 *lhs, + struct old_timeval32 *rhs) { if (lhs->tv_sec < rhs->tv_sec) return -1; @@ -467,8 +467,8 @@ static inline int compat_timeval_compare(struct compat_timeval *lhs, return lhs->tv_usec - rhs->tv_usec; } -static inline int compat_timespec_compare(struct compat_timespec *lhs, - struct compat_timespec *rhs) +static inline int old_timespec32_compare(struct old_timespec32 *lhs, + struct old_timespec32 *rhs) { if (lhs->tv_sec < rhs->tv_sec) return -1; @@ -552,12 +552,12 @@ asmlinkage long compat_sys_io_getevents(compat_aio_context_t ctx_id, compat_long_t min_nr, compat_long_t nr, struct io_event __user *events, - struct compat_timespec __user *timeout); + struct old_timespec32 __user *timeout); asmlinkage long compat_sys_io_pgetevents(compat_aio_context_t ctx_id, compat_long_t min_nr, compat_long_t nr, struct io_event __user *events, - struct compat_timespec __user *timeout, + struct old_timespec32 __user *timeout, const struct __compat_aio_sigset __user *usig); /* fs/cookies.c */ @@ -642,11 +642,11 @@ asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd, asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp, compat_ulong_t __user *outp, compat_ulong_t __user *exp, - struct compat_timespec __user *tsp, + struct old_timespec32 __user *tsp, void __user *sig); asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds, unsigned int nfds, - struct compat_timespec __user *tsp, + struct old_timespec32 __user *tsp, const compat_sigset_t __user *sigmask, compat_size_t sigsetsize); @@ -671,15 +671,15 @@ asmlinkage long compat_sys_newfstat(unsigned int fd, /* fs/timerfd.c */ asmlinkage long compat_sys_timerfd_gettime(int ufd, - struct compat_itimerspec __user *otmr); + struct old_itimerspec32 __user *otmr); asmlinkage long compat_sys_timerfd_settime(int ufd, int flags, - const struct compat_itimerspec __user *utmr, - struct compat_itimerspec __user *otmr); + const struct old_itimerspec32 __user *utmr, + struct old_itimerspec32 __user *otmr); /* fs/utimes.c */ asmlinkage long compat_sys_utimensat(unsigned int dfd, const char __user *filename, - struct compat_timespec __user *t, + struct old_timespec32 __user *t, int flags); /* kernel/exit.c */ @@ -691,7 +691,7 @@ asmlinkage long compat_sys_waitid(int, compat_pid_t, /* kernel/futex.c */ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val, - struct compat_timespec __user *utime, u32 __user *uaddr2, + struct old_timespec32 __user *utime, u32 __user *uaddr2, u32 val3); asmlinkage long compat_sys_set_robust_list(struct compat_robust_list_head __user *head, @@ -701,8 +701,8 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, compat_size_t __user *len_ptr); /* kernel/hrtimer.c */ -asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp, - struct compat_timespec __user *rmtp); +asmlinkage long compat_sys_nanosleep(struct old_timespec32 __user *rqtp, + struct old_timespec32 __user *rmtp); /* kernel/itimer.c */ asmlinkage long compat_sys_getitimer(int which, @@ -722,19 +722,19 @@ asmlinkage long compat_sys_timer_create(clockid_t which_clock, struct compat_sigevent __user *timer_event_spec, timer_t __user *created_timer_id); asmlinkage long compat_sys_timer_gettime(timer_t timer_id, - struct compat_itimerspec __user *setting); + struct old_itimerspec32 __user *setting); asmlinkage long compat_sys_timer_settime(timer_t timer_id, int flags, - struct compat_itimerspec __user *new, - struct compat_itimerspec __user *old); + struct old_itimerspec32 __user *new, + struct old_itimerspec32 __user *old); asmlinkage long compat_sys_clock_settime(clockid_t which_clock, - struct compat_timespec __user *tp); + struct old_timespec32 __user *tp); asmlinkage long compat_sys_clock_gettime(clockid_t which_clock, - struct compat_timespec __user *tp); + struct old_timespec32 __user *tp); asmlinkage long compat_sys_clock_getres(clockid_t which_clock, - struct compat_timespec __user *tp); + struct old_timespec32 __user *tp); asmlinkage long compat_sys_clock_nanosleep(clockid_t which_clock, int flags, - struct compat_timespec __user *rqtp, - struct compat_timespec __user *rmtp); + struct old_timespec32 __user *rqtp, + struct old_timespec32 __user *rmtp); /* kernel/ptrace.c */ asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, @@ -748,7 +748,7 @@ asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, compat_ulong_t __user *user_mask_ptr); asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, - struct compat_timespec __user *interval); + struct old_timespec32 __user *interval); /* kernel/signal.c */ asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, @@ -768,7 +768,7 @@ asmlinkage long compat_sys_rt_sigpending(compat_sigset_t __user *uset, compat_size_t sigsetsize); asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese, struct compat_siginfo __user *uinfo, - struct compat_timespec __user *uts, compat_size_t sigsetsize); + struct old_timespec32 __user *uts, compat_size_t sigsetsize); asmlinkage long compat_sys_rt_sigqueueinfo(compat_pid_t pid, int sig, struct compat_siginfo __user *uinfo); /* No generic prototype for rt_sigreturn */ @@ -782,9 +782,9 @@ asmlinkage long compat_sys_setrlimit(unsigned int resource, asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru); /* kernel/time.c */ -asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv, +asmlinkage long compat_sys_gettimeofday(struct old_timeval32 __user *tv, struct timezone __user *tz); -asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, +asmlinkage long compat_sys_settimeofday(struct old_timeval32 __user *tv, struct timezone __user *tz); asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); @@ -798,11 +798,11 @@ asmlinkage long compat_sys_mq_open(const char __user *u_name, asmlinkage long compat_sys_mq_timedsend(mqd_t mqdes, const char __user *u_msg_ptr, compat_size_t msg_len, unsigned int msg_prio, - const struct compat_timespec __user *u_abs_timeout); + const struct old_timespec32 __user *u_abs_timeout); asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes, char __user *u_msg_ptr, compat_size_t msg_len, unsigned int __user *u_msg_prio, - const struct compat_timespec __user *u_abs_timeout); + const struct old_timespec32 __user *u_abs_timeout); asmlinkage long compat_sys_mq_notify(mqd_t mqdes, const struct compat_sigevent __user *u_notification); asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes, @@ -819,7 +819,7 @@ asmlinkage long compat_sys_msgsnd(int msqid, compat_uptr_t msgp, /* ipc/sem.c */ asmlinkage long compat_sys_semctl(int semid, int semnum, int cmd, int arg); asmlinkage long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, - unsigned nsems, const struct compat_timespec __user *timeout); + unsigned nsems, const struct old_timespec32 __user *timeout); /* ipc/shm.c */ asmlinkage long compat_sys_shmctl(int first, int second, void __user *uptr); @@ -876,7 +876,7 @@ asmlinkage long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, struct compat_siginfo __user *uinfo); asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, unsigned vlen, unsigned int flags, - struct compat_timespec __user *timeout); + struct old_timespec32 __user *timeout); asmlinkage long compat_sys_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options, struct compat_rusage __user *ru); @@ -928,7 +928,7 @@ asmlinkage long compat_sys_pwritev64v2(unsigned long fd, asmlinkage long compat_sys_open(const char __user *filename, int flags, umode_t mode); asmlinkage long compat_sys_utimes(const char __user *filename, - struct compat_timeval __user *t); + struct old_timeval32 __user *t); /* __ARCH_WANT_SYSCALL_NO_FLAGS */ asmlinkage long compat_sys_signalfd(int ufd, @@ -942,15 +942,15 @@ asmlinkage long compat_sys_newlstat(const char __user *filename, struct compat_stat __user *statbuf); /* __ARCH_WANT_SYSCALL_DEPRECATED */ -asmlinkage long compat_sys_time(compat_time_t __user *tloc); +asmlinkage long compat_sys_time(old_time32_t __user *tloc); asmlinkage long compat_sys_utime(const char __user *filename, struct compat_utimbuf __user *t); asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filename, - struct compat_timeval __user *t); + struct old_timeval32 __user *t); asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, compat_ulong_t __user *outp, compat_ulong_t __user *exp, - struct compat_timeval __user *tvp); + struct old_timeval32 __user *tvp); asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u32); asmlinkage long compat_sys_recv(int fd, void __user *buf, compat_size_t len, unsigned flags); @@ -983,7 +983,7 @@ asmlinkage long compat_sys_sigaction(int sig, #endif /* obsolete: kernel/time/time.c */ -asmlinkage long compat_sys_stime(compat_time_t __user *tptr); +asmlinkage long compat_sys_stime(old_time32_t __user *tptr); /* obsolete: net/socket.c */ asmlinkage long compat_sys_socketcall(int call, u32 __user *args); @@ -1002,15 +1002,15 @@ static inline bool in_compat_syscall(void) { return is_compat_task(); } #endif /** - * ns_to_compat_timeval - Compat version of ns_to_timeval + * ns_to_old_timeval32 - Compat version of ns_to_timeval * @nsec: the nanoseconds value to be converted * - * Returns the compat_timeval representation of the nsec parameter. + * Returns the old_timeval32 representation of the nsec parameter. */ -static inline struct compat_timeval ns_to_compat_timeval(s64 nsec) +static inline struct old_timeval32 ns_to_old_timeval32(s64 nsec) { struct timeval tv; - struct compat_timeval ctv; + struct old_timeval32 ctv; tv = ns_to_timeval(nsec); ctv.tv_sec = tv.tv_sec; diff --git a/include/linux/compat_time.h b/include/linux/compat_time.h deleted file mode 100644 index e70bfd1d2c3f..000000000000 --- a/include/linux/compat_time.h +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _LINUX_COMPAT_TIME_H -#define _LINUX_COMPAT_TIME_H - -#include -#include - -typedef s32 compat_time_t; - -struct compat_timespec { - compat_time_t tv_sec; - s32 tv_nsec; -}; - -struct compat_timeval { - compat_time_t tv_sec; - s32 tv_usec; -}; - -struct compat_itimerspec { - struct compat_timespec it_interval; - struct compat_timespec it_value; -}; - -extern int compat_get_timespec64(struct timespec64 *, const void __user *); -extern int compat_put_timespec64(const struct timespec64 *, void __user *); -extern int get_compat_itimerspec64(struct itimerspec64 *its, - const struct compat_itimerspec __user *uits); -extern int put_compat_itimerspec64(const struct itimerspec64 *its, - struct compat_itimerspec __user *uits); - -#endif /* _LINUX_COMPAT_TIME_H */ diff --git a/include/linux/elfcore-compat.h b/include/linux/elfcore-compat.h index b5f2efdd05e0..7a37f4ce9fd2 100644 --- a/include/linux/elfcore-compat.h +++ b/include/linux/elfcore-compat.h @@ -27,10 +27,10 @@ struct compat_elf_prstatus compat_pid_t pr_ppid; compat_pid_t pr_pgrp; compat_pid_t pr_sid; - struct compat_timeval pr_utime; - struct compat_timeval pr_stime; - struct compat_timeval pr_cutime; - struct compat_timeval pr_cstime; + struct old_timeval32 pr_utime; + struct old_timeval32 pr_stime; + struct old_timeval32 pr_cutime; + struct old_timeval32 pr_cstime; compat_elf_gregset_t pr_reg; #ifdef CONFIG_BINFMT_ELF_FDPIC compat_ulong_t pr_exec_fdpic_loadmap; diff --git a/include/linux/restart_block.h b/include/linux/restart_block.h index 5d83d0c1d06c..bba2920e9c05 100644 --- a/include/linux/restart_block.h +++ b/include/linux/restart_block.h @@ -10,7 +10,7 @@ #include struct timespec; -struct compat_timespec; +struct old_timespec32; struct pollfd; enum timespec_type { @@ -40,7 +40,7 @@ struct restart_block { enum timespec_type type; union { struct __kernel_timespec __user *rmtp; - struct compat_timespec __user *compat_rmtp; + struct old_timespec32 __user *compat_rmtp; }; u64 expires; } nanosleep; diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 2ff814c92f7f..b3e27e5ee322 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -60,7 +60,7 @@ struct tms; struct utimbuf; struct mq_attr; struct compat_stat; -struct compat_timeval; +struct old_timeval32; struct robust_list_head; struct getcpu_cache; struct old_linux_dirent; diff --git a/include/linux/time32.h b/include/linux/time32.h index 92c0ca092d93..0e0d7304d1a8 100644 --- a/include/linux/time32.h +++ b/include/linux/time32.h @@ -13,6 +13,31 @@ #define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) +typedef s32 old_time32_t; + +struct old_timespec32 { + old_time32_t tv_sec; + s32 tv_nsec; +}; + +struct old_timeval32 { + old_time32_t tv_sec; + s32 tv_usec; +}; + +struct old_itimerspec32 { + struct old_timespec32 it_interval; + struct old_timespec32 it_value; +}; + +extern int get_old_timespec32(struct timespec64 *, const void __user *); +extern int put_old_timespec32(const struct timespec64 *, void __user *); +extern int get_old_itimerspec32(struct itimerspec64 *its, + const struct old_itimerspec32 __user *uits); +extern int put_old_itimerspec32(const struct itimerspec64 *its, + struct old_itimerspec32 __user *uits); + + #if __BITS_PER_LONG == 64 /* timespec64 is defined as timespec here */ @@ -183,18 +208,17 @@ extern struct timeval ns_to_timeval(const s64 nsec); extern struct __kernel_old_timeval ns_to_kernel_old_timeval(s64 nsec); /* - * New aliases for compat time functions. These will be used to replace - * the compat code so it can be shared between 32-bit and 64-bit builds - * both of which provide compatibility with old 32-bit tasks. + * Old names for the 32-bit time_t interfaces, these will be removed + * when everything uses the new names. */ -#define old_time32_t compat_time_t -#define old_timeval32 compat_timeval -#define old_timespec32 compat_timespec -#define old_itimerspec32 compat_itimerspec -#define ns_to_old_timeval32 ns_to_compat_timeval -#define get_old_itimerspec32 get_compat_itimerspec64 -#define put_old_itimerspec32 put_compat_itimerspec64 -#define get_old_timespec32 compat_get_timespec64 -#define put_old_timespec32 compat_put_timespec64 +#define compat_time_t old_time32_t +#define compat_timeval old_timeval32 +#define compat_timespec old_timespec32 +#define compat_itimerspec old_itimerspec32 +#define ns_to_compat_timeval ns_to_old_timeval32 +#define get_compat_itimerspec64 get_old_itimerspec32 +#define put_compat_itimerspec64 put_old_itimerspec32 +#define compat_get_timespec64 get_old_timespec32 +#define compat_put_timespec64 put_old_timespec32 #endif diff --git a/ipc/mqueue.c b/ipc/mqueue.c index c0d58f390c3b..db7833370351 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -1461,10 +1461,10 @@ COMPAT_SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes, #endif #ifdef CONFIG_COMPAT_32BIT_TIME -static int compat_prepare_timeout(const struct compat_timespec __user *p, +static int compat_prepare_timeout(const struct old_timespec32 __user *p, struct timespec64 *ts) { - if (compat_get_timespec64(ts, p)) + if (get_old_timespec32(ts, p)) return -EFAULT; if (!timespec64_valid(ts)) return -EINVAL; @@ -1474,7 +1474,7 @@ static int compat_prepare_timeout(const struct compat_timespec __user *p, COMPAT_SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, compat_size_t, msg_len, unsigned int, msg_prio, - const struct compat_timespec __user *, u_abs_timeout) + const struct old_timespec32 __user *, u_abs_timeout) { struct timespec64 ts, *p = NULL; if (u_abs_timeout) { @@ -1489,7 +1489,7 @@ COMPAT_SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, COMPAT_SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, compat_size_t, msg_len, unsigned int __user *, u_msg_prio, - const struct compat_timespec __user *, u_abs_timeout) + const struct old_timespec32 __user *, u_abs_timeout) { struct timespec64 ts, *p = NULL; if (u_abs_timeout) { diff --git a/ipc/msg.c b/ipc/msg.c index 883642cf2b27..0833c6405915 100644 --- a/ipc/msg.c +++ b/ipc/msg.c @@ -622,9 +622,9 @@ struct compat_msqid_ds { struct compat_ipc_perm msg_perm; compat_uptr_t msg_first; compat_uptr_t msg_last; - compat_time_t msg_stime; - compat_time_t msg_rtime; - compat_time_t msg_ctime; + old_time32_t msg_stime; + old_time32_t msg_rtime; + old_time32_t msg_ctime; compat_ulong_t msg_lcbytes; compat_ulong_t msg_lqbytes; unsigned short msg_cbytes; diff --git a/ipc/sem.c b/ipc/sem.c index 26f8e37fcdcb..745dc6187e84 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -1698,8 +1698,8 @@ SYSCALL_DEFINE4(semctl, int, semid, int, semnum, int, cmd, unsigned long, arg) struct compat_semid_ds { struct compat_ipc_perm sem_perm; - compat_time_t sem_otime; - compat_time_t sem_ctime; + old_time32_t sem_otime; + old_time32_t sem_ctime; compat_uptr_t sem_base; compat_uptr_t sem_pending; compat_uptr_t sem_pending_last; @@ -2214,11 +2214,11 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops, #ifdef CONFIG_COMPAT_32BIT_TIME long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems, unsigned int nsops, - const struct compat_timespec __user *timeout) + const struct old_timespec32 __user *timeout) { if (timeout) { struct timespec64 ts; - if (compat_get_timespec64(&ts, timeout)) + if (get_old_timespec32(&ts, timeout)) return -EFAULT; return do_semtimedop(semid, tsems, nsops, &ts); } @@ -2227,7 +2227,7 @@ long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems, COMPAT_SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsems, unsigned int, nsops, - const struct compat_timespec __user *, timeout) + const struct old_timespec32 __user *, timeout) { return compat_ksys_semtimedop(semid, tsems, nsops, timeout); } diff --git a/ipc/shm.c b/ipc/shm.c index b0eb3757ab89..2657692199eb 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -1201,9 +1201,9 @@ SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf) struct compat_shmid_ds { struct compat_ipc_perm shm_perm; int shm_segsz; - compat_time_t shm_atime; - compat_time_t shm_dtime; - compat_time_t shm_ctime; + old_time32_t shm_atime; + old_time32_t shm_dtime; + old_time32_t shm_ctime; compat_ipc_pid_t shm_cpid; compat_ipc_pid_t shm_lpid; unsigned short shm_nattch; diff --git a/ipc/syscall.c b/ipc/syscall.c index 65d405f1ba0c..1ac06e3983c0 100644 --- a/ipc/syscall.c +++ b/ipc/syscall.c @@ -35,7 +35,7 @@ SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second, (const struct __kernel_timespec __user *)fifth); else if (IS_ENABLED(CONFIG_COMPAT_32BIT_TIME)) return compat_ksys_semtimedop(first, ptr, second, - (const struct compat_timespec __user *)fifth); + (const struct old_timespec32 __user *)fifth); else return -ENOSYS; diff --git a/ipc/util.h b/ipc/util.h index 0a159f69b3bb..1ee81bce25e9 100644 --- a/ipc/util.h +++ b/ipc/util.h @@ -266,7 +266,7 @@ long ksys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf); /* for CONFIG_ARCH_WANT_OLD_COMPAT_IPC */ long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems, unsigned int nsops, - const struct compat_timespec __user *timeout); + const struct old_timespec32 __user *timeout); #ifdef CONFIG_COMPAT long compat_ksys_semctl(int semid, int semnum, int cmd, int arg); long compat_ksys_msgctl(int msqid, int cmd, void __user *uptr); diff --git a/kernel/compat.c b/kernel/compat.c index 8e40efc2928a..089d00d0da9c 100644 --- a/kernel/compat.c +++ b/kernel/compat.c @@ -93,28 +93,28 @@ int compat_put_timex(struct compat_timex __user *utp, const struct timex *txc) return 0; } -static int __compat_get_timeval(struct timeval *tv, const struct compat_timeval __user *ctv) +static int __compat_get_timeval(struct timeval *tv, const struct old_timeval32 __user *ctv) { return (!access_ok(VERIFY_READ, ctv, sizeof(*ctv)) || __get_user(tv->tv_sec, &ctv->tv_sec) || __get_user(tv->tv_usec, &ctv->tv_usec)) ? -EFAULT : 0; } -static int __compat_put_timeval(const struct timeval *tv, struct compat_timeval __user *ctv) +static int __compat_put_timeval(const struct timeval *tv, struct old_timeval32 __user *ctv) { return (!access_ok(VERIFY_WRITE, ctv, sizeof(*ctv)) || __put_user(tv->tv_sec, &ctv->tv_sec) || __put_user(tv->tv_usec, &ctv->tv_usec)) ? -EFAULT : 0; } -static int __compat_get_timespec(struct timespec *ts, const struct compat_timespec __user *cts) +static int __compat_get_timespec(struct timespec *ts, const struct old_timespec32 __user *cts) { return (!access_ok(VERIFY_READ, cts, sizeof(*cts)) || __get_user(ts->tv_sec, &cts->tv_sec) || __get_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0; } -static int __compat_put_timespec(const struct timespec *ts, struct compat_timespec __user *cts) +static int __compat_put_timespec(const struct timespec *ts, struct old_timespec32 __user *cts) { return (!access_ok(VERIFY_WRITE, cts, sizeof(*cts)) || __put_user(ts->tv_sec, &cts->tv_sec) || diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c index 83f830acbb5f..410a77a8f6e2 100644 --- a/kernel/futex_compat.c +++ b/kernel/futex_compat.c @@ -173,7 +173,7 @@ COMPAT_SYSCALL_DEFINE3(get_robust_list, int, pid, } COMPAT_SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val, - struct compat_timespec __user *, utime, u32 __user *, uaddr2, + struct old_timespec32 __user *, utime, u32 __user *, uaddr2, u32, val3) { struct timespec ts; diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 625bc9897f62..8287b75ed961 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5257,13 +5257,13 @@ SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid, #ifdef CONFIG_COMPAT COMPAT_SYSCALL_DEFINE2(sched_rr_get_interval, compat_pid_t, pid, - struct compat_timespec __user *, interval) + struct old_timespec32 __user *, interval) { struct timespec64 t; int retval = sched_rr_get_interval(pid, &t); if (retval == 0) - retval = compat_put_timespec64(&t, interval); + retval = put_old_timespec32(&t, interval); return retval; } #endif diff --git a/kernel/signal.c b/kernel/signal.c index 5843c541fda9..a4db724e14c1 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3173,7 +3173,7 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese, #ifdef CONFIG_COMPAT COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese, struct compat_siginfo __user *, uinfo, - struct compat_timespec __user *, uts, compat_size_t, sigsetsize) + struct old_timespec32 __user *, uts, compat_size_t, sigsetsize) { sigset_t s; struct timespec t; diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index e1a549c9e399..9cdd74bd2d27 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -1660,7 +1660,7 @@ int nanosleep_copyout(struct restart_block *restart, struct timespec64 *ts) switch(restart->nanosleep.type) { #ifdef CONFIG_COMPAT_32BIT_TIME case TT_COMPAT: - if (compat_put_timespec64(ts, restart->nanosleep.compat_rmtp)) + if (put_old_timespec32(ts, restart->nanosleep.compat_rmtp)) return -EFAULT; break; #endif @@ -1780,12 +1780,12 @@ SYSCALL_DEFINE2(nanosleep, struct __kernel_timespec __user *, rqtp, #ifdef CONFIG_COMPAT_32BIT_TIME -COMPAT_SYSCALL_DEFINE2(nanosleep, struct compat_timespec __user *, rqtp, - struct compat_timespec __user *, rmtp) +COMPAT_SYSCALL_DEFINE2(nanosleep, struct old_timespec32 __user *, rqtp, + struct old_timespec32 __user *, rmtp) { struct timespec64 tu; - if (compat_get_timespec64(&tu, rqtp)) + if (get_old_timespec32(&tu, rqtp)) return -EFAULT; if (!timespec64_valid(&tu)) diff --git a/kernel/time/posix-stubs.c b/kernel/time/posix-stubs.c index 2c6847d5d69b..989ccf028bde 100644 --- a/kernel/time/posix-stubs.c +++ b/kernel/time/posix-stubs.c @@ -162,20 +162,20 @@ COMPAT_SYS_NI(setitimer); #ifdef CONFIG_COMPAT_32BIT_TIME COMPAT_SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock, - struct compat_timespec __user *, tp) + struct old_timespec32 __user *, tp) { struct timespec64 new_tp; if (which_clock != CLOCK_REALTIME) return -EINVAL; - if (compat_get_timespec64(&new_tp, tp)) + if (get_old_timespec32(&new_tp, tp)) return -EFAULT; return do_sys_settimeofday64(&new_tp, NULL); } COMPAT_SYSCALL_DEFINE2(clock_gettime, clockid_t, which_clock, - struct compat_timespec __user *, tp) + struct old_timespec32 __user *, tp) { int ret; struct timespec64 kernel_tp; @@ -184,13 +184,13 @@ COMPAT_SYSCALL_DEFINE2(clock_gettime, clockid_t, which_clock, if (ret) return ret; - if (compat_put_timespec64(&kernel_tp, tp)) + if (put_old_timespec32(&kernel_tp, tp)) return -EFAULT; return 0; } COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock, - struct compat_timespec __user *, tp) + struct old_timespec32 __user *, tp) { struct timespec64 rtn_tp = { .tv_sec = 0, @@ -201,7 +201,7 @@ COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock, case CLOCK_REALTIME: case CLOCK_MONOTONIC: case CLOCK_BOOTTIME: - if (compat_put_timespec64(&rtn_tp, tp)) + if (put_old_timespec32(&rtn_tp, tp)) return -EFAULT; return 0; default: @@ -210,8 +210,8 @@ COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock, } COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags, - struct compat_timespec __user *, rqtp, - struct compat_timespec __user *, rmtp) + struct old_timespec32 __user *, rqtp, + struct old_timespec32 __user *, rmtp) { struct timespec64 t; @@ -224,7 +224,7 @@ COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags, return -EINVAL; } - if (compat_get_timespec64(&t, rqtp)) + if (get_old_timespec32(&t, rqtp)) return -EFAULT; if (!timespec64_valid(&t)) return -EINVAL; diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index 4b9127e95430..3e71921668ba 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -755,13 +755,13 @@ SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id, #ifdef CONFIG_COMPAT_32BIT_TIME COMPAT_SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id, - struct compat_itimerspec __user *, setting) + struct old_itimerspec32 __user *, setting) { struct itimerspec64 cur_setting; int ret = do_timer_gettime(timer_id, &cur_setting); if (!ret) { - if (put_compat_itimerspec64(&cur_setting, setting)) + if (put_old_itimerspec32(&cur_setting, setting)) ret = -EFAULT; } return ret; @@ -928,8 +928,8 @@ SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, #ifdef CONFIG_COMPAT_32BIT_TIME COMPAT_SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, - struct compat_itimerspec __user *, new, - struct compat_itimerspec __user *, old) + struct old_itimerspec32 __user *, new, + struct old_itimerspec32 __user *, old) { struct itimerspec64 new_spec, old_spec; struct itimerspec64 *rtn = old ? &old_spec : NULL; @@ -937,12 +937,12 @@ COMPAT_SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, if (!new) return -EINVAL; - if (get_compat_itimerspec64(&new_spec, new)) + if (get_old_itimerspec32(&new_spec, new)) return -EFAULT; error = do_timer_settime(timer_id, flags, &new_spec, rtn); if (!error && old) { - if (put_compat_itimerspec64(&old_spec, old)) + if (put_old_itimerspec32(&old_spec, old)) error = -EFAULT; } return error; @@ -1115,7 +1115,7 @@ SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock, #ifdef CONFIG_COMPAT_32BIT_TIME COMPAT_SYSCALL_DEFINE2(clock_settime, clockid_t, which_clock, - struct compat_timespec __user *, tp) + struct old_timespec32 __user *, tp) { const struct k_clock *kc = clockid_to_kclock(which_clock); struct timespec64 ts; @@ -1123,14 +1123,14 @@ COMPAT_SYSCALL_DEFINE2(clock_settime, clockid_t, which_clock, if (!kc || !kc->clock_set) return -EINVAL; - if (compat_get_timespec64(&ts, tp)) + if (get_old_timespec32(&ts, tp)) return -EFAULT; return kc->clock_set(which_clock, &ts); } COMPAT_SYSCALL_DEFINE2(clock_gettime, clockid_t, which_clock, - struct compat_timespec __user *, tp) + struct old_timespec32 __user *, tp) { const struct k_clock *kc = clockid_to_kclock(which_clock); struct timespec64 ts; @@ -1141,7 +1141,7 @@ COMPAT_SYSCALL_DEFINE2(clock_gettime, clockid_t, which_clock, err = kc->clock_get(which_clock, &ts); - if (!err && compat_put_timespec64(&ts, tp)) + if (!err && put_old_timespec32(&ts, tp)) err = -EFAULT; return err; @@ -1180,7 +1180,7 @@ COMPAT_SYSCALL_DEFINE2(clock_adjtime, clockid_t, which_clock, #ifdef CONFIG_COMPAT_32BIT_TIME COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock, - struct compat_timespec __user *, tp) + struct old_timespec32 __user *, tp) { const struct k_clock *kc = clockid_to_kclock(which_clock); struct timespec64 ts; @@ -1190,7 +1190,7 @@ COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock, return -EINVAL; err = kc->clock_getres(which_clock, &ts); - if (!err && tp && compat_put_timespec64(&ts, tp)) + if (!err && tp && put_old_timespec32(&ts, tp)) return -EFAULT; return err; @@ -1237,8 +1237,8 @@ SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags, #ifdef CONFIG_COMPAT_32BIT_TIME COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags, - struct compat_timespec __user *, rqtp, - struct compat_timespec __user *, rmtp) + struct old_timespec32 __user *, rqtp, + struct old_timespec32 __user *, rmtp) { const struct k_clock *kc = clockid_to_kclock(which_clock); struct timespec64 t; @@ -1248,7 +1248,7 @@ COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags, if (!kc->nsleep) return -EOPNOTSUPP; - if (compat_get_timespec64(&t, rqtp)) + if (get_old_timespec32(&t, rqtp)) return -EFAULT; if (!timespec64_valid(&t)) diff --git a/kernel/time/time.c b/kernel/time/time.c index de332250d6fa..f1983f468fe3 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c @@ -104,12 +104,12 @@ SYSCALL_DEFINE1(stime, time_t __user *, tptr) #ifdef CONFIG_COMPAT #ifdef __ARCH_WANT_COMPAT_SYS_TIME -/* compat_time_t is a 32 bit "long" and needs to get converted. */ -COMPAT_SYSCALL_DEFINE1(time, compat_time_t __user *, tloc) +/* old_time32_t is a 32 bit "long" and needs to get converted. */ +COMPAT_SYSCALL_DEFINE1(time, old_time32_t __user *, tloc) { - compat_time_t i; + old_time32_t i; - i = (compat_time_t)ktime_get_real_seconds(); + i = (old_time32_t)ktime_get_real_seconds(); if (tloc) { if (put_user(i,tloc)) @@ -119,7 +119,7 @@ COMPAT_SYSCALL_DEFINE1(time, compat_time_t __user *, tloc) return i; } -COMPAT_SYSCALL_DEFINE1(stime, compat_time_t __user *, tptr) +COMPAT_SYSCALL_DEFINE1(stime, old_time32_t __user *, tptr) { struct timespec64 tv; int err; @@ -225,7 +225,7 @@ SYSCALL_DEFINE2(settimeofday, struct timeval __user *, tv, } #ifdef CONFIG_COMPAT -COMPAT_SYSCALL_DEFINE2(gettimeofday, struct compat_timeval __user *, tv, +COMPAT_SYSCALL_DEFINE2(gettimeofday, struct old_timeval32 __user *, tv, struct timezone __user *, tz) { if (tv) { @@ -244,7 +244,7 @@ COMPAT_SYSCALL_DEFINE2(gettimeofday, struct compat_timeval __user *, tv, return 0; } -COMPAT_SYSCALL_DEFINE2(settimeofday, struct compat_timeval __user *, tv, +COMPAT_SYSCALL_DEFINE2(settimeofday, struct old_timeval32 __user *, tv, struct timezone __user *, tz) { struct timespec64 new_ts; @@ -863,10 +863,10 @@ int put_timespec64(const struct timespec64 *ts, } EXPORT_SYMBOL_GPL(put_timespec64); -int __compat_get_timespec64(struct timespec64 *ts64, - const struct compat_timespec __user *cts) +int __get_old_timespec32(struct timespec64 *ts64, + const struct old_timespec32 __user *cts) { - struct compat_timespec ts; + struct old_timespec32 ts; int ret; ret = copy_from_user(&ts, cts, sizeof(ts)); @@ -879,33 +879,33 @@ int __compat_get_timespec64(struct timespec64 *ts64, return 0; } -int __compat_put_timespec64(const struct timespec64 *ts64, - struct compat_timespec __user *cts) +int __put_old_timespec32(const struct timespec64 *ts64, + struct old_timespec32 __user *cts) { - struct compat_timespec ts = { + struct old_timespec32 ts = { .tv_sec = ts64->tv_sec, .tv_nsec = ts64->tv_nsec }; return copy_to_user(cts, &ts, sizeof(ts)) ? -EFAULT : 0; } -int compat_get_timespec64(struct timespec64 *ts, const void __user *uts) +int get_old_timespec32(struct timespec64 *ts, const void __user *uts) { if (COMPAT_USE_64BIT_TIME) return copy_from_user(ts, uts, sizeof(*ts)) ? -EFAULT : 0; else - return __compat_get_timespec64(ts, uts); + return __get_old_timespec32(ts, uts); } -EXPORT_SYMBOL_GPL(compat_get_timespec64); +EXPORT_SYMBOL_GPL(get_old_timespec32); -int compat_put_timespec64(const struct timespec64 *ts, void __user *uts) +int put_old_timespec32(const struct timespec64 *ts, void __user *uts) { if (COMPAT_USE_64BIT_TIME) return copy_to_user(uts, ts, sizeof(*ts)) ? -EFAULT : 0; else - return __compat_put_timespec64(ts, uts); + return __put_old_timespec32(ts, uts); } -EXPORT_SYMBOL_GPL(compat_put_timespec64); +EXPORT_SYMBOL_GPL(put_old_timespec32); int get_itimerspec64(struct itimerspec64 *it, const struct __kernel_itimerspec __user *uit) @@ -937,23 +937,23 @@ int put_itimerspec64(const struct itimerspec64 *it, } EXPORT_SYMBOL_GPL(put_itimerspec64); -int get_compat_itimerspec64(struct itimerspec64 *its, - const struct compat_itimerspec __user *uits) +int get_old_itimerspec32(struct itimerspec64 *its, + const struct old_itimerspec32 __user *uits) { - if (__compat_get_timespec64(&its->it_interval, &uits->it_interval) || - __compat_get_timespec64(&its->it_value, &uits->it_value)) + if (__get_old_timespec32(&its->it_interval, &uits->it_interval) || + __get_old_timespec32(&its->it_value, &uits->it_value)) return -EFAULT; return 0; } -EXPORT_SYMBOL_GPL(get_compat_itimerspec64); +EXPORT_SYMBOL_GPL(get_old_itimerspec32); -int put_compat_itimerspec64(const struct itimerspec64 *its, - struct compat_itimerspec __user *uits) +int put_old_itimerspec32(const struct itimerspec64 *its, + struct old_itimerspec32 __user *uits) { - if (__compat_put_timespec64(&its->it_interval, &uits->it_interval) || - __compat_put_timespec64(&its->it_value, &uits->it_value)) + if (__put_old_timespec32(&its->it_interval, &uits->it_interval) || + __put_old_timespec32(&its->it_value, &uits->it_value)) return -EFAULT; return 0; } -EXPORT_SYMBOL_GPL(put_compat_itimerspec64); +EXPORT_SYMBOL_GPL(put_old_itimerspec32); diff --git a/net/compat.c b/net/compat.c index 3b2105f6549d..2ef160876bc1 100644 --- a/net/compat.c +++ b/net/compat.c @@ -812,7 +812,7 @@ COMPAT_SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, buf, compat_size_t, len static int __compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, unsigned int vlen, unsigned int flags, - struct compat_timespec __user *timeout) + struct old_timespec32 __user *timeout) { int datagrams; struct timespec ktspec; @@ -834,7 +834,7 @@ static int __compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, COMPAT_SYSCALL_DEFINE5(recvmmsg, int, fd, struct compat_mmsghdr __user *, mmsg, unsigned int, vlen, unsigned int, flags, - struct compat_timespec __user *, timeout) + struct old_timespec32 __user *, timeout) { return __compat_sys_recvmmsg(fd, mmsg, vlen, flags, timeout); } From patchwork Mon Aug 27 19:45:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145207 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp333338ljw; Mon, 27 Aug 2018 12:46:59 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZW4B4DjzOewvnHUKU/LPXHNu7IJPIf475IXhoWspNqYb88djvT7TIN0MeRVLmKdNGS8hzz X-Received: by 2002:a63:495f:: with SMTP id y31-v6mr13305033pgk.32.1535399218922; Mon, 27 Aug 2018 12:46:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399218; cv=none; d=google.com; s=arc-20160816; b=kh8OYUsHz9bkGyY2QKeqOen3eAdkWzoEc1VUp2J+RKNM6ZQ3SCiW+U1vywjfBxylhA 5bfgai2e79YjyIFtVHzy7a71ekIbXbGoiqJPRmXjxW65i3b+apnNid0LeZdwD8/TMkIO cDPxWGwka6ds317WkjhoMJ/Mzuu987DJKlWcgBNcT67vfkW+07rMCpk5RnrI9YJPALm6 T5ODUjJFQvbUdTpyPUpMQ0d2dY3moVIp1hbN3vwc8wAc37u0vHZPiVtJO9XiXbNmIA7f lCqGvlEDQOt2e96L2I7Y/rmuZyLERcShAp5fzBU36ai+Gl3a4wvFNeWF+dcjA/WWgt0L s8sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=4PfQ1L22ofifjt4Lk1QmLgPzxdsbreWK8CJHHFM7USI=; b=ygv0kU6CQchFkqRqFrltI4TOLF+QXvwTrhOOd7T8fB9DPpWO3Hz2nUst5zJktv47PY x8xB19jc8k/HpTHZ/oGkrW78up5EaTItEwp4pyqtwVZOU2wQQky5ZjwS0bSQ9fAi5s/v t/+IW500NeuyR/sVVRKddxIXDp2P3ALSzGiROp9owARQ5+Ait87tcJHOc8mycKdMbq2v PCHt1odcrMS7gM3bG0LmJIR2mPC5OKqbKhfBwsQo1aAVmpEkVFfiy0OojoxFUTfyCiwv SLtzgvsbf7VOZ00Q0HrFfPHCx7GoB2Pb21o1N/aPNqwgi6ZjyLBccjNc64YdS4g5H48k zmjQ== 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 c16-v6si95345pfj.333.2018.08.27.12.46.58; Mon, 27 Aug 2018 12:46:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; 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 S1727866AbeH0Xe5 (ORCPT + 32 others); Mon, 27 Aug 2018 19:34:57 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:34837 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726939AbeH0Xdq (ORCPT ); Mon, 27 Aug 2018 19:33:46 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0M8hqV-1fi3bX47Bj-00wH5E; Mon, 27 Aug 2018 21:45:37 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, linux-api@vger.kernel.org, Christoph Hellwig , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, deepa.kernel@gmail.com, linux-arch@vger.kernel.org, Arnd Bergmann Subject: [PATCH 04/14] y2038: Remove newstat family from default syscall set Date: Mon, 27 Aug 2018 21:45:21 +0200 Message-Id: <20180827194531.3796559-5-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827194531.3796559-1-arnd@arndb.de> References: <20180827194531.3796559-1-arnd@arndb.de> X-Provags-ID: V03:K1:1gDZLuElI0G1LKlTL6RoBPSZxFQDRriwbmpfMjfc1KIcskoHnj3 DGnRdrV0TlSPFQNl7Hmma2IKjo5OwExBnFBBUChYG4uMaNs8j4j+DJd8N59T5dcAN1Ulp2X nG/TmYQVpadR1zp2uVitOL61GfR8d+OyReQ/4vfOW9wanJaI+4tEjQcNQJQ263/gwrqLXiT XdbYABIlj1feKUxJ2Qo9g== X-UI-Out-Filterresults: notjunk:1; V01:K0:oWD6c3hCnlk=:XVxT1XYXy9Sat1zup0e8P+ stT+Xf0gtJ/aQvym5PaelvLjftQItx5tw8sNJdkiVUiJXv1yn4sdD7INndk2VpaofeiLb4Hms AGBoIexeFsK00XQJPtj6CPOIMXcDkmiDse2X8hK48+I/DDvutEbS/5Lv12xDmGQPN/GBi1q8H +pMvah1veKruu8+Q7Jmf2LquanfH3IRRpW4eYwNXIF3lipQzuEMF8cUvFH8iDk49L6iYUXsj7 o8dUBlzoAZR1xMveFhRAf5Riuq7I6zAJOgVVhDMd5mKc33KRHVw8AiuYFNvz12an7Btqcl04q aegPOYGghNgHgblhwpecUhwWX7mAjLAZ7NBmGYIxFRlRK1aSRTRa4ccgTOk2vlcedPzGFnHym gTuk0j3dHUqjLOSmEM0Y3Ihs47Ml92PvxQrS9j9cdOt2QifRIVHCyNeBrdRw/cp/1nJIU99I5 8ESxYal34ofuzZUC0xOw4ZerwHdr1pXWC6Voh8GI1uCbsoZbQ2odVnVoQgEtIyIJRDVaVIcap TLBaJz5mLALvA3bihADQbR7ea9K+JLVDDnmiBaoeXpVcTLlv+0h1eQkdgdsPvlsEEB9krPmy+ xXmemzuBkZihMPaP6dDyhQBppJm3Qhn0gvqZfcY718anRxe2lFJwvu1baeme6KzaWiyMW8FBL 7oSsNRINgHe5Syx6upMbMl2RSMa77ek9JnkYJn+I6rtZ3Wbd6FTWxT8PM4Se3+eQTrr4= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We have four generations of stat() syscalls: - the oldstat syscalls that are only used on the older architectures - the newstat family that is used on all 64-bit architectures but lacked support for large files on 32-bit architectures. - the stat64 family that is used mostly on 32-bit architectures to replace newstat - statx() to replace all of the above, adding 64-bit timestamps among other things. We already compile stat64 only on those architectures that need it, but newstat is always built, including on those that don't reference it. This adds a new __ARCH_WANT_NEW_STAT symbol along the lines of __ARCH_WANT_OLD_STAT and __ARCH_WANT_STAT64 to control compilation of newstat. All architectures that need it use an explict define, the others now get a little bit smaller, and future architecture (including 64-bit targets) won't ever see it. Acked-by: Geert Uytterhoeven Signed-off-by: Arnd Bergmann --- arch/alpha/include/asm/unistd.h | 1 + arch/arm/include/asm/unistd.h | 1 + arch/arm64/include/uapi/asm/unistd.h | 1 + arch/ia64/include/asm/unistd.h | 2 ++ arch/m68k/include/asm/unistd.h | 1 + arch/microblaze/include/asm/unistd.h | 1 + arch/mips/include/asm/unistd.h | 1 + arch/parisc/include/asm/unistd.h | 1 + arch/powerpc/include/asm/unistd.h | 1 + arch/s390/include/asm/unistd.h | 1 + arch/sh/include/asm/unistd.h | 1 + arch/sparc/include/asm/unistd.h | 1 + arch/x86/include/asm/unistd.h | 1 + arch/xtensa/include/asm/unistd.h | 1 + fs/stat.c | 3 +++ 15 files changed, 18 insertions(+) -- 2.18.0 diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h index d6e29a1de4cc..edc090470023 100644 --- a/arch/alpha/include/asm/unistd.h +++ b/arch/alpha/include/asm/unistd.h @@ -6,6 +6,7 @@ #define NR_SYSCALLS 523 +#define __ARCH_WANT_NEW_STAT #define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_STAT64 #define __ARCH_WANT_SYS_GETHOSTNAME diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h index 076090d2dbf5..07e58010d597 100644 --- a/arch/arm/include/asm/unistd.h +++ b/arch/arm/include/asm/unistd.h @@ -16,6 +16,7 @@ #include #include +#define __ARCH_WANT_NEW_STAT #define __ARCH_WANT_STAT64 #define __ARCH_WANT_SYS_GETHOSTNAME #define __ARCH_WANT_SYS_PAUSE diff --git a/arch/arm64/include/uapi/asm/unistd.h b/arch/arm64/include/uapi/asm/unistd.h index 5072cbd15c82..dae1584cf017 100644 --- a/arch/arm64/include/uapi/asm/unistd.h +++ b/arch/arm64/include/uapi/asm/unistd.h @@ -16,5 +16,6 @@ */ #define __ARCH_WANT_RENAMEAT +#define __ARCH_WANT_NEW_STAT #include diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h index ffb705dc9c13..c5b2620c4a4c 100644 --- a/arch/ia64/include/asm/unistd.h +++ b/arch/ia64/include/asm/unistd.h @@ -28,6 +28,8 @@ #define __IGNORE_vfork /* clone() */ #define __IGNORE_umount2 /* umount() */ +#define __ARCH_WANT_NEW_STAT + #if !defined(__ASSEMBLY__) && !defined(ASSEMBLER) #include diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index 30d0d3fbd4ef..db22cdadc38a 100644 --- a/arch/m68k/include/asm/unistd.h +++ b/arch/m68k/include/asm/unistd.h @@ -7,6 +7,7 @@ #define NR_syscalls 380 +#define __ARCH_WANT_NEW_STAT #define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_OLD_STAT #define __ARCH_WANT_STAT64 diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h index a62d09420a47..a28dc770c9b2 100644 --- a/arch/microblaze/include/asm/unistd.h +++ b/arch/microblaze/include/asm/unistd.h @@ -15,6 +15,7 @@ /* #define __ARCH_WANT_OLD_READDIR */ /* #define __ARCH_WANT_OLD_STAT */ +#define __ARCH_WANT_NEW_STAT #define __ARCH_WANT_STAT64 #define __ARCH_WANT_SYS_ALARM #define __ARCH_WANT_SYS_GETHOSTNAME diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h index 3c09450908aa..d7878b3e16d8 100644 --- a/arch/mips/include/asm/unistd.h +++ b/arch/mips/include/asm/unistd.h @@ -24,6 +24,7 @@ #ifndef __ASSEMBLY__ +#define __ARCH_WANT_NEW_STAT #define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_SYS_ALARM #define __ARCH_WANT_SYS_GETHOSTNAME diff --git a/arch/parisc/include/asm/unistd.h b/arch/parisc/include/asm/unistd.h index 3d507d04eb4c..b36273bacca7 100644 --- a/arch/parisc/include/asm/unistd.h +++ b/arch/parisc/include/asm/unistd.h @@ -141,6 +141,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ return K_INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5); \ } +#define __ARCH_WANT_NEW_STAT #define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_STAT64 #define __ARCH_WANT_SYS_ALARM diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index c19379f0a32e..8b37e01817be 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h @@ -22,6 +22,7 @@ #include #include +#define __ARCH_WANT_NEW_STAT #define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_STAT64 #define __ARCH_WANT_SYS_ALARM diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h index fd79c0d35dc4..1d181373288a 100644 --- a/arch/s390/include/asm/unistd.h +++ b/arch/s390/include/asm/unistd.h @@ -15,6 +15,7 @@ #define __IGNORE_pkey_alloc #define __IGNORE_pkey_free +#define __ARCH_WANT_NEW_STAT #define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_SYS_ALARM #define __ARCH_WANT_SYS_GETHOSTNAME diff --git a/arch/sh/include/asm/unistd.h b/arch/sh/include/asm/unistd.h index b36200af9ce7..a845b57eac69 100644 --- a/arch/sh/include/asm/unistd.h +++ b/arch/sh/include/asm/unistd.h @@ -5,6 +5,7 @@ # include # endif +# define __ARCH_WANT_NEW_STAT # define __ARCH_WANT_OLD_READDIR # define __ARCH_WANT_OLD_STAT # define __ARCH_WANT_STAT64 diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h index b2a6a955113e..3544244685e1 100644 --- a/arch/sparc/include/asm/unistd.h +++ b/arch/sparc/include/asm/unistd.h @@ -21,6 +21,7 @@ #else #define __NR_time 231 /* Linux sparc32 */ #endif +#define __ARCH_WANT_NEW_STAT #define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_STAT64 #define __ARCH_WANT_SYS_ALARM diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h index 51c4eee00732..35b66bbf8028 100644 --- a/arch/x86/include/asm/unistd.h +++ b/arch/x86/include/asm/unistd.h @@ -31,6 +31,7 @@ # endif +# define __ARCH_WANT_NEW_STAT # define __ARCH_WANT_OLD_READDIR # define __ARCH_WANT_OLD_STAT # define __ARCH_WANT_SYS_ALARM diff --git a/arch/xtensa/include/asm/unistd.h b/arch/xtensa/include/asm/unistd.h index ed66db3bc9bb..0d532ab60b37 100644 --- a/arch/xtensa/include/asm/unistd.h +++ b/arch/xtensa/include/asm/unistd.h @@ -5,6 +5,7 @@ #define __ARCH_WANT_SYS_CLONE #include +#define __ARCH_WANT_NEW_STAT #define __ARCH_WANT_STAT64 #define __ARCH_WANT_SYS_UTIME #define __ARCH_WANT_SYS_LLSEEK diff --git a/fs/stat.c b/fs/stat.c index f8e6fb2c3657..adbfcd86c81b 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -280,6 +280,8 @@ SYSCALL_DEFINE2(fstat, unsigned int, fd, struct __old_kernel_stat __user *, stat #endif /* __ARCH_WANT_OLD_STAT */ +#ifdef __ARCH_WANT_NEW_STAT + #if BITS_PER_LONG == 32 # define choose_32_64(a,b) a #else @@ -378,6 +380,7 @@ SYSCALL_DEFINE2(newfstat, unsigned int, fd, struct stat __user *, statbuf) return error; } +#endif static int do_readlinkat(int dfd, const char __user *pathname, char __user *buf, int bufsiz) From patchwork Mon Aug 27 19:45:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145208 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp333394ljw; Mon, 27 Aug 2018 12:47:03 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYzzYJ20vtxPSa1bcno5XFp4bFquXfcQxOen9rrrA6LPjcByDLBGorvZXaRxEBBKn0IJnYu X-Received: by 2002:a65:4c0b:: with SMTP id u11-v6mr7592134pgq.451.1535399223715; Mon, 27 Aug 2018 12:47:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399223; cv=none; d=google.com; s=arc-20160816; b=SrqXkQwUYtpjcMy5Ckn4B1927TZA5mG3v/n5ZIkOkB8FVmTONxO9+XjWZ8zDmC3wOw ZARiz042R2RkylGbUNzkEWyVKfNtlIDiIlEXXGPDFbC1F+EMa6UER5ZTLDqHATSd0u1u EVG9Vy62mqC/KZLsa5B/yFdj0dT6PX+iuWK1BYbhJfS+Cd0xXWBZ4MgmOEVmEsipDe2E OUH7CNGeA9lqIwf/SDhpkqV38OPVmVboLbJl7bXEiKcg08p9L+d9nwAhNpqdF/su8rzW WwkXG3FWvyOr5wgWNhVYPmjs14wd8XRvVtlQ8C3exRGb6hQPzymEcnb+RdTpgZBo9t1U Tekg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Lax0MA7GSyxapUgTYdROI3Ab/pe0doPnOWZ2qBpkb2g=; b=GWg8CzgtmobtV+JKiaDpgxXWhPXFMjkpeJ0G0kecYSmrT1vSjTBkQaUY+GQ7D58Lot HYDJCkyyhpCSa/lXMRT+455MjYtSbxkIM1/Tepmso3wktY8TEeAB3y61mifWZjhcj5GX //qThh+iNOO4EOO8kvKtwnd6Dx1gNxWPYJYgMUhgrAd0D+yfjF3qWH3oLwrLAKPsroeJ GjrR6LpEq6nTlo6UKYLiTLjpiCg44fz0nsquerif2C0TzQ56gsbLuWD1R0ZuFmzGp70O nNd9c6FykB2hR6wVYMa9LPSBt2EoR2xYn9cGTkpvUkW5AGy9Vs+qHi9tZU9mZlRUDSFh 0s1A== 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 c16-v6si95345pfj.333.2018.08.27.12.47.03; Mon, 27 Aug 2018 12:47:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; 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 S1727846AbeH0Xe5 (ORCPT + 32 others); Mon, 27 Aug 2018 19:34:57 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:38759 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726823AbeH0Xdq (ORCPT ); Mon, 27 Aug 2018 19:33:46 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0Mbyf0-1gBM4l1S7i-00JNUb; Mon, 27 Aug 2018 21:45:37 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, linux-api@vger.kernel.org, Christoph Hellwig , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, deepa.kernel@gmail.com, linux-arch@vger.kernel.org, Arnd Bergmann Subject: [PATCH 05/14] y2038: Remove stat64 family from default syscall set Date: Mon, 27 Aug 2018 21:45:22 +0200 Message-Id: <20180827194531.3796559-6-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827194531.3796559-1-arnd@arndb.de> References: <20180827194531.3796559-1-arnd@arndb.de> X-Provags-ID: V03:K1:igrE4gERJEo+kEelQStiIqH+Zmx2zakwnV1Y9q8rzHSJSjFzJ34 7hDWUXVcOlpUt6y6OGLsGCdr7vmR23mTNPzsqFlBF1KAEzMvszYTAA649INWGlLwPsE27cg FNy6S7ziri4tY2yXUfgacUtQBiMcjiJQNM6+oAkBSVr5iazMxAr1ueDyyJtu55Shf7bBqKb ixuJg10g7FjAoi5WOu3Dw== X-UI-Out-Filterresults: notjunk:1; V01:K0:dhyiS7C+TOE=:kJb/Uirr9K9RyDguMmy/BJ QFKaHbiQAJnysouRVE5wYVTjhWV+vmdwF6iXq8I1fiNmtaJc9cIAV4Eb0TkAdVdcobTMAnuFn fmJGB45ceBaiHFGoiipk+tEEisoLQRRZVqLADTZgaKu6FA8xYPSQgpTUkNItYJAFdSg6ZaNzt ItDIrZ/y2Dzr9v/ktHt2Jqcb/kh84BVS3Ephbt4TBEbV1U9/Tn9No4PY7gpkX8lJ55jRAE7RP 7Qgvc0hDfVfTgZ5UlM0c1l7sS8k9SJdhcZfKrJz1iulijQlSp1DKo2DzkV6qhP/RDYoFb10Zu C9BWVx4jPWEATqdknG117Gq5BSqJkYolLDp4bgTQQQOC9n/2JE2HTc9OfLFoFyDUYYdEwYNju W6TZQ8aUmGC6ETecKtNBEPwWhpGNXzT4NlPJNZgDav6LX1xZ25/DBM9a3URRe+gTN1poy8Nhw rt5maDLaPV1AuBtTVJPavrZ6om+Jw4O59Xfloo1fN6nYXBb6PFl0XmmDzB1w+GmpqHgoa5B6D PRUDrkVBVUbdkNjsFbes4DnPxd3lGytYxjSwAvq0xSIbW9GCpm8gknffEHErq5Cd/58mMInJH KqZzi3K18hNQ2hKLHjXk9RTZ2SxEfr1hjJXmuyznh/xHacgHWinpOqEPQvvyIkztJoqeAlqLj IDyt4+ZTi8j+9uis6zHrbzKmJIFxGx/+6W1LqDRx9XC0g2NEx0gL5WmfAgToeSpJGK+4= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org New architectures should no longer need stat64, which is not y2038 safe and has been replaced by statx(). This removes the 'select __ARCH_WANT_STAT64' statement from asm-generic/unistd.h and instead moves it into the respective asm/unistd.h UAPI header files for each architecture that uses it today. In the generic file, the system call number and entry points are now made conditional, so newly added architectures (e.g. riscv32 or csky) will never need to carry backwards compatiblity for it. arm64 is the only 64-bit architecture using the asm-generic/unistd.h file, and it already sets __ARCH_WANT_NEW_STAT in its headers, and I use the same #ifdef here: future 64-bit architectures therefore won't see newstat or stat64 any more. They don't suffer from the y2038 time_t overflow, but for consistency it seems best to also let them use statx(). Signed-off-by: Arnd Bergmann --- arch/arc/include/uapi/asm/unistd.h | 1 + arch/c6x/include/uapi/asm/unistd.h | 1 + arch/h8300/include/uapi/asm/unistd.h | 1 + arch/hexagon/include/uapi/asm/unistd.h | 1 + arch/nds32/include/uapi/asm/unistd.h | 1 + arch/nios2/include/uapi/asm/unistd.h | 1 + arch/openrisc/include/uapi/asm/unistd.h | 1 + arch/unicore32/include/uapi/asm/unistd.h | 1 + include/asm-generic/unistd.h | 1 - include/uapi/asm-generic/unistd.h | 2 ++ 10 files changed, 10 insertions(+), 1 deletion(-) -- 2.18.0 diff --git a/arch/arc/include/uapi/asm/unistd.h b/arch/arc/include/uapi/asm/unistd.h index 517178b1daef..3b3543fd151c 100644 --- a/arch/arc/include/uapi/asm/unistd.h +++ b/arch/arc/include/uapi/asm/unistd.h @@ -17,6 +17,7 @@ #define _UAPI_ASM_ARC_UNISTD_H #define __ARCH_WANT_RENAMEAT +#define __ARCH_WANT_STAT64 #define __ARCH_WANT_SYS_EXECVE #define __ARCH_WANT_SYS_CLONE #define __ARCH_WANT_SYS_VFORK diff --git a/arch/c6x/include/uapi/asm/unistd.h b/arch/c6x/include/uapi/asm/unistd.h index 0d2daf7f9809..6b2fe792de9d 100644 --- a/arch/c6x/include/uapi/asm/unistd.h +++ b/arch/c6x/include/uapi/asm/unistd.h @@ -16,6 +16,7 @@ */ #define __ARCH_WANT_RENAMEAT +#define __ARCH_WANT_STAT64 #define __ARCH_WANT_SYS_CLONE /* Use the standard ABI for syscalls. */ diff --git a/arch/h8300/include/uapi/asm/unistd.h b/arch/h8300/include/uapi/asm/unistd.h index 7dd20ef7625a..628195823816 100644 --- a/arch/h8300/include/uapi/asm/unistd.h +++ b/arch/h8300/include/uapi/asm/unistd.h @@ -1,5 +1,6 @@ #define __ARCH_NOMMU #define __ARCH_WANT_RENAMEAT +#define __ARCH_WANT_STAT64 #include diff --git a/arch/hexagon/include/uapi/asm/unistd.h b/arch/hexagon/include/uapi/asm/unistd.h index ea181e79162e..c91ca7d02461 100644 --- a/arch/hexagon/include/uapi/asm/unistd.h +++ b/arch/hexagon/include/uapi/asm/unistd.h @@ -29,6 +29,7 @@ #define sys_mmap2 sys_mmap_pgoff #define __ARCH_WANT_RENAMEAT +#define __ARCH_WANT_STAT64 #define __ARCH_WANT_SYS_EXECVE #define __ARCH_WANT_SYS_CLONE #define __ARCH_WANT_SYS_VFORK diff --git a/arch/nds32/include/uapi/asm/unistd.h b/arch/nds32/include/uapi/asm/unistd.h index 6e95901cabe3..603e826e0449 100644 --- a/arch/nds32/include/uapi/asm/unistd.h +++ b/arch/nds32/include/uapi/asm/unistd.h @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (C) 2005-2017 Andes Technology Corporation +#define __ARCH_WANT_STAT64 #define __ARCH_WANT_SYNC_FILE_RANGE2 /* Use the standard ABI for syscalls */ diff --git a/arch/nios2/include/uapi/asm/unistd.h b/arch/nios2/include/uapi/asm/unistd.h index b6bdae04bc84..d9948d88790b 100644 --- a/arch/nios2/include/uapi/asm/unistd.h +++ b/arch/nios2/include/uapi/asm/unistd.h @@ -19,6 +19,7 @@ #define sys_mmap2 sys_mmap_pgoff #define __ARCH_WANT_RENAMEAT +#define __ARCH_WANT_STAT64 /* Use the standard ABI for syscalls */ #include diff --git a/arch/openrisc/include/uapi/asm/unistd.h b/arch/openrisc/include/uapi/asm/unistd.h index 11c5a58ab333..ec37df18d8ed 100644 --- a/arch/openrisc/include/uapi/asm/unistd.h +++ b/arch/openrisc/include/uapi/asm/unistd.h @@ -20,6 +20,7 @@ #define sys_mmap2 sys_mmap_pgoff #define __ARCH_WANT_RENAMEAT +#define __ARCH_WANT_STAT64 #define __ARCH_WANT_SYS_FORK #define __ARCH_WANT_SYS_CLONE diff --git a/arch/unicore32/include/uapi/asm/unistd.h b/arch/unicore32/include/uapi/asm/unistd.h index 65856eaab163..1e8fe5941b8a 100644 --- a/arch/unicore32/include/uapi/asm/unistd.h +++ b/arch/unicore32/include/uapi/asm/unistd.h @@ -15,4 +15,5 @@ /* Use the standard ABI for syscalls. */ #include +#define __ARCH_WANT_STAT64 #define __ARCH_WANT_SYS_CLONE diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index cdf904265caf..ea74eca8463f 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h @@ -8,6 +8,5 @@ * be selected by default. */ #if __BITS_PER_LONG == 32 -#define __ARCH_WANT_STAT64 #define __ARCH_WANT_SYS_LLSEEK #endif diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index df4bedb9b01c..538546edbfbd 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h @@ -242,10 +242,12 @@ __SYSCALL(__NR_tee, sys_tee) /* fs/stat.c */ #define __NR_readlinkat 78 __SYSCALL(__NR_readlinkat, sys_readlinkat) +#if defined(__ARCH_WANT_NEW_STAT) || defined(__ARCH_WANT_STAT64) #define __NR3264_fstatat 79 __SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat) #define __NR3264_fstat 80 __SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat) +#endif /* fs/sync.c */ #define __NR_sync 81 From patchwork Mon Aug 27 19:45:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145206 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp333233ljw; Mon, 27 Aug 2018 12:46:52 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZsvBqePW7PXdm17FzTZfRJrE0iIb9fYEPL5aKt6s3JACe3hmkYWPLubtJVhGQlG7OuFlHh X-Received: by 2002:a62:b2d3:: with SMTP id z80-v6mr15940953pfl.79.1535399212415; Mon, 27 Aug 2018 12:46:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399212; cv=none; d=google.com; s=arc-20160816; b=NbLNAta7pTtRm645G6d6lMB9q+KiE9trNyOMeTcc5Xhzxaww70a8I4iKaSp3LQY4c9 TioxiGgLdykEd+Zc2dhV8KM57C9gcxwTrAEEdALeHfaMau4B+CicWdcxKFtmSt5avDV6 4tazEIzTWiTPICx96nu/EdWeueHvhHJSk2pRoBACSjtqw9D3QzAdpX7UhA8TtKEpwvIp R9GTVodswawS7WFbn/VfrlhxImxYowhB0hxrMS0F+Xb1RuglHwU4YAmo8Q9f34T1mS/6 Rvbq/f2fcL9vc8Ba6cPcVFVqhWIrB4lWKHXHXDK3BaXgUxBc+15QhVQVowGU+MdOLfmQ Kuwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=J87lRmT0xGIF5s5pcDGqK/vY6sGXA+s0aP4MoQR67mE=; b=a3ey4A2AzbgZrmIGYcDdQoBXq4IdpJQQysXgQ5BUqHB6N0HQotCfN/YRsu0gMR2WSW MfQmSBI8jwvm7A95Og+mpv6/aqLYQrkSwjUg2fTLQ7QTk9CD0+m7VAeSyRWIfvjajUhj HiuIiyvwCFz+n6F1RoKUvaRC+nAymFiRfXm1Tf7H31xO/1yQOKenw8UEg54Ja+W8zZ+B /7dWRMXxtsNJ7yQbJqMBNA7dgkxmPpXOsgNXAiV0uNDq/1/Q27snILXoXZS+SL0P8cWO 7SaeDDoOX+UMO8YNH6yJDcZ/7/YCAdHLhKNmaHTJst2ZDR2uQlJBzC39eObBcwJQc+6Y 2jDA== 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 g12-v6si100556pgl.635.2018.08.27.12.46.52; Mon, 27 Aug 2018 12:46:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; 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 S1727502AbeH0Xeu (ORCPT + 32 others); Mon, 27 Aug 2018 19:34:50 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:45699 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727474AbeH0Xdr (ORCPT ); Mon, 27 Aug 2018 19:33:47 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0MOj82-1fyCwh3HWg-0065q1; Mon, 27 Aug 2018 21:45:37 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, linux-api@vger.kernel.org, Christoph Hellwig , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, deepa.kernel@gmail.com, linux-arch@vger.kernel.org, Arnd Bergmann Subject: [PATCH 06/14] asm-generic: Move common compat types to asm-generic/compat.h Date: Mon, 27 Aug 2018 21:45:23 +0200 Message-Id: <20180827194531.3796559-7-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827194531.3796559-1-arnd@arndb.de> References: <20180827194531.3796559-1-arnd@arndb.de> X-Provags-ID: V03:K1:o9DIekXsJ8DGLA5Tz6m4hgSMh3av//E2l/o12OvOAgEGkJfMHeq NHSP892P5GLABvqZ5nG2Q17JbJuOzH5+F825gSF9PmM2PpZj8JS9mtSZqcXoElenoVD1myh ysf35EOqkeawq6vWFM9kpplZKg8pQzcFN7yYWrwvGyFoGkZlD2vqy9/C3pGrBvPGkX/IzJ1 4VHAxEcEUWvCScF3MwufQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:S+EKeLmjw1c=:FSQOp6twnRTFFESvYUp8fO U5uEbSaA5urxxrW8UOdb4BpXSvDIYyMDzUKFBh3KhiHICEGummqBQUIatdsQay7Ec12emfY7M 2yXthNF3X9uQNkOmDrV64OBn5l0XsvSKV3K7g+WnPtreGUmvIDntWF1d15/jnADtf3a5W4Boa JyeTwWe913JVys81YtFCAjNtltCKowkwOuKy3tSLV60JRxvNDJwXhfmWNmcrC/ke0LDeAhmcn IjvKn0e3c/Kvj5ZsaqAic7mlml7UVxjSCVaKjpqKw3ekAtwOZf7Xu1oixQ7v/VtJnG4R2RrFC 4UG+gzh1q0zhipdWmtCU/Xlr/0n1cdeDIOWdao1OV/yXPIGMhb7RbGmGt4LZ3WRDVs2zuNDdh jBcZnNOpXf2bfXEkhHTyJO/rWxXkAVWrGvHbvQ1VkmkZLGdu5BcYipJg6I626NcBecjiHYBjG 1Qw/lcDbCCuSTj/WCrncd4vCqv+KUb3XFOMclkupLyciv+xbponGE7C1+JDMT32Q3d3NfsTM5 CIShY+wcTcrUdBX8NXU1NnRcuKv8xaUGbougpeKwRGN780D63UbI+Vtfy9zMal7UuCM7cKV3e tnFqZJdqIJYyr1n5wuVBc+x80r5V7a0CTos1cGMlO6doE17EsO8R02jTgiVthwz3xFUoB1gRo jbM7rPshS6hkOgCQk/WfuT3VzIIhQrpoU35RpflTR/r3jkkgSeUcasGIk8VnsPwPU1QM= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While converting compat system call handlers to work on 32-bit architectures, I found a number of types used in those handlers that are identical between all architectures. Let's move all the identical ones into asm-generic/compat.h to avoid having to add even more identical definitions of those types. For unknown reasons, mips defines __compat_gid32_t, __compat_uid32_t and compat_caddr_t as signed, while all others have them unsigned. This seems to be a mistake, but I'm leaving it alone here. The other types all differ by size or alignment on at least on architecture. compat_aio_context_t is currently defined in linux/compat.h but also needed for compat_sys_io_getevents(), so let's move it into the same place. While we still have not decided whether the 32-bit time handling will always use the compat syscalls, or in which form, I think this is a useful cleanup that we can merge regardless. Reviewed-by: Christoph Hellwig Signed-off-by: Arnd Bergmann --- arch/arm64/include/asm/compat.h | 20 ++------------------ arch/mips/include/asm/compat.h | 22 ++-------------------- arch/parisc/include/asm/compat.h | 18 ++---------------- arch/powerpc/include/asm/compat.h | 18 ++---------------- arch/s390/include/asm/compat.h | 18 ++---------------- arch/sparc/include/asm/compat.h | 19 ++----------------- arch/x86/include/asm/compat.h | 19 ++----------------- include/asm-generic/compat.h | 24 +++++++++++++++++++++++- include/linux/compat.h | 2 -- 9 files changed, 37 insertions(+), 123 deletions(-) -- 2.18.0 diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index 4a89007db14a..ee689d8a026d 100644 --- a/arch/arm64/include/asm/compat.h +++ b/arch/arm64/include/asm/compat.h @@ -25,6 +25,8 @@ #include #include +#include + #define COMPAT_USER_HZ 100 #ifdef __AARCH64EB__ #define COMPAT_UTS_MACHINE "armv8b\0\0" @@ -32,10 +34,6 @@ #define COMPAT_UTS_MACHINE "armv8l\0\0" #endif -typedef u32 compat_size_t; -typedef s32 compat_ssize_t; -typedef s32 compat_clock_t; -typedef s32 compat_pid_t; typedef u16 __compat_uid_t; typedef u16 __compat_gid_t; typedef u16 __compat_uid16_t; @@ -43,27 +41,13 @@ typedef u16 __compat_gid16_t; typedef u32 __compat_uid32_t; typedef u32 __compat_gid32_t; typedef u16 compat_mode_t; -typedef u32 compat_ino_t; typedef u32 compat_dev_t; -typedef s32 compat_off_t; -typedef s64 compat_loff_t; typedef s32 compat_nlink_t; typedef u16 compat_ipc_pid_t; -typedef s32 compat_daddr_t; typedef u32 compat_caddr_t; typedef __kernel_fsid_t compat_fsid_t; -typedef s32 compat_key_t; -typedef s32 compat_timer_t; - -typedef s16 compat_short_t; -typedef s32 compat_int_t; -typedef s32 compat_long_t; typedef s64 compat_s64; -typedef u16 compat_ushort_t; -typedef u32 compat_uint_t; -typedef u32 compat_ulong_t; typedef u64 compat_u64; -typedef u32 compat_uptr_t; struct compat_stat { #ifdef __AARCH64EB__ diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h index 7dcbd855814e..c99166eadbde 100644 --- a/arch/mips/include/asm/compat.h +++ b/arch/mips/include/asm/compat.h @@ -9,43 +9,25 @@ #include #include +#include + #define COMPAT_USER_HZ 100 #define COMPAT_UTS_MACHINE "mips\0\0\0" -typedef u32 compat_size_t; -typedef s32 compat_ssize_t; -typedef s32 compat_clock_t; -typedef s32 compat_suseconds_t; - -typedef s32 compat_pid_t; typedef s32 __compat_uid_t; typedef s32 __compat_gid_t; typedef __compat_uid_t __compat_uid32_t; typedef __compat_gid_t __compat_gid32_t; typedef u32 compat_mode_t; -typedef u32 compat_ino_t; typedef u32 compat_dev_t; -typedef s32 compat_off_t; -typedef s64 compat_loff_t; typedef u32 compat_nlink_t; typedef s32 compat_ipc_pid_t; -typedef s32 compat_daddr_t; typedef s32 compat_caddr_t; typedef struct { s32 val[2]; } compat_fsid_t; -typedef s32 compat_timer_t; -typedef s32 compat_key_t; - -typedef s16 compat_short_t; -typedef s32 compat_int_t; -typedef s32 compat_long_t; typedef s64 compat_s64; -typedef u16 compat_ushort_t; -typedef u32 compat_uint_t; -typedef u32 compat_ulong_t; typedef u64 compat_u64; -typedef u32 compat_uptr_t; struct compat_stat { compat_dev_t st_dev; diff --git a/arch/parisc/include/asm/compat.h b/arch/parisc/include/asm/compat.h index 32dadaf2b534..e03e3c849f40 100644 --- a/arch/parisc/include/asm/compat.h +++ b/arch/parisc/include/asm/compat.h @@ -8,36 +8,22 @@ #include #include +#include + #define COMPAT_USER_HZ 100 #define COMPAT_UTS_MACHINE "parisc\0\0" -typedef u32 compat_size_t; -typedef s32 compat_ssize_t; -typedef s32 compat_clock_t; -typedef s32 compat_pid_t; typedef u32 __compat_uid_t; typedef u32 __compat_gid_t; typedef u32 __compat_uid32_t; typedef u32 __compat_gid32_t; typedef u16 compat_mode_t; -typedef u32 compat_ino_t; typedef u32 compat_dev_t; -typedef s32 compat_off_t; -typedef s64 compat_loff_t; typedef u16 compat_nlink_t; typedef u16 compat_ipc_pid_t; -typedef s32 compat_daddr_t; typedef u32 compat_caddr_t; -typedef s32 compat_key_t; -typedef s32 compat_timer_t; - -typedef s32 compat_int_t; -typedef s32 compat_long_t; typedef s64 compat_s64; -typedef u32 compat_uint_t; -typedef u32 compat_ulong_t; typedef u64 compat_u64; -typedef u32 compat_uptr_t; struct compat_stat { compat_dev_t st_dev; /* dev_t is 32 bits on parisc */ diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h index 93f79d1a03c3..74d0db511099 100644 --- a/arch/powerpc/include/asm/compat.h +++ b/arch/powerpc/include/asm/compat.h @@ -8,6 +8,8 @@ #include #include +#include + #define COMPAT_USER_HZ 100 #ifdef __BIG_ENDIAN__ #define COMPAT_UTS_MACHINE "ppc\0\0" @@ -15,34 +17,18 @@ #define COMPAT_UTS_MACHINE "ppcle\0\0" #endif -typedef u32 compat_size_t; -typedef s32 compat_ssize_t; -typedef s32 compat_clock_t; -typedef s32 compat_pid_t; typedef u32 __compat_uid_t; typedef u32 __compat_gid_t; typedef u32 __compat_uid32_t; typedef u32 __compat_gid32_t; typedef u32 compat_mode_t; -typedef u32 compat_ino_t; typedef u32 compat_dev_t; -typedef s32 compat_off_t; -typedef s64 compat_loff_t; typedef s16 compat_nlink_t; typedef u16 compat_ipc_pid_t; -typedef s32 compat_daddr_t; typedef u32 compat_caddr_t; typedef __kernel_fsid_t compat_fsid_t; -typedef s32 compat_key_t; -typedef s32 compat_timer_t; - -typedef s32 compat_int_t; -typedef s32 compat_long_t; typedef s64 compat_s64; -typedef u32 compat_uint_t; -typedef u32 compat_ulong_t; typedef u64 compat_u64; -typedef u32 compat_uptr_t; struct compat_stat { compat_dev_t st_dev; diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h index 97db2fba546a..63b46e30b2c3 100644 --- a/arch/s390/include/asm/compat.h +++ b/arch/s390/include/asm/compat.h @@ -9,6 +9,8 @@ #include #include +#include + #define __TYPE_IS_PTR(t) (!__builtin_types_compatible_p( \ typeof(0?(__force t)0:0ULL), u64)) @@ -51,34 +53,18 @@ #define COMPAT_USER_HZ 100 #define COMPAT_UTS_MACHINE "s390\0\0\0\0" -typedef u32 compat_size_t; -typedef s32 compat_ssize_t; -typedef s32 compat_clock_t; -typedef s32 compat_pid_t; typedef u16 __compat_uid_t; typedef u16 __compat_gid_t; typedef u32 __compat_uid32_t; typedef u32 __compat_gid32_t; typedef u16 compat_mode_t; -typedef u32 compat_ino_t; typedef u16 compat_dev_t; -typedef s32 compat_off_t; -typedef s64 compat_loff_t; typedef u16 compat_nlink_t; typedef u16 compat_ipc_pid_t; -typedef s32 compat_daddr_t; typedef u32 compat_caddr_t; typedef __kernel_fsid_t compat_fsid_t; -typedef s32 compat_key_t; -typedef s32 compat_timer_t; - -typedef s32 compat_int_t; -typedef s32 compat_long_t; typedef s64 compat_s64; -typedef u32 compat_uint_t; -typedef u32 compat_ulong_t; typedef u64 compat_u64; -typedef u32 compat_uptr_t; typedef struct { u32 mask; diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h index 7018cb60beef..30b1763580b1 100644 --- a/arch/sparc/include/asm/compat.h +++ b/arch/sparc/include/asm/compat.h @@ -6,38 +6,23 @@ */ #include +#include + #define COMPAT_USER_HZ 100 #define COMPAT_UTS_MACHINE "sparc\0\0" -typedef u32 compat_size_t; -typedef s32 compat_ssize_t; -typedef s32 compat_clock_t; -typedef s32 compat_pid_t; typedef u16 __compat_uid_t; typedef u16 __compat_gid_t; typedef u32 __compat_uid32_t; typedef u32 __compat_gid32_t; typedef u16 compat_mode_t; -typedef u32 compat_ino_t; typedef u16 compat_dev_t; -typedef s32 compat_off_t; -typedef s64 compat_loff_t; typedef s16 compat_nlink_t; typedef u16 compat_ipc_pid_t; -typedef s32 compat_daddr_t; typedef u32 compat_caddr_t; typedef __kernel_fsid_t compat_fsid_t; -typedef s32 compat_key_t; -typedef s32 compat_timer_t; - -typedef s32 compat_int_t; -typedef s32 compat_long_t; typedef s64 compat_s64; -typedef u32 compat_uint_t; -typedef u32 compat_ulong_t; typedef u64 compat_u64; -typedef u32 compat_uptr_t; - struct compat_stat { compat_dev_t st_dev; compat_ino_t st_ino; diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h index fb97cf7c4137..0ce6f452d334 100644 --- a/arch/x86/include/asm/compat.h +++ b/arch/x86/include/asm/compat.h @@ -12,38 +12,23 @@ #include #include +#include + #define COMPAT_USER_HZ 100 #define COMPAT_UTS_MACHINE "i686\0\0" -typedef u32 compat_size_t; -typedef s32 compat_ssize_t; -typedef s32 compat_clock_t; -typedef s32 compat_pid_t; typedef u16 __compat_uid_t; typedef u16 __compat_gid_t; typedef u32 __compat_uid32_t; typedef u32 __compat_gid32_t; typedef u16 compat_mode_t; -typedef u32 compat_ino_t; typedef u16 compat_dev_t; -typedef s32 compat_off_t; -typedef s64 compat_loff_t; typedef u16 compat_nlink_t; typedef u16 compat_ipc_pid_t; -typedef s32 compat_daddr_t; typedef u32 compat_caddr_t; typedef __kernel_fsid_t compat_fsid_t; -typedef s32 compat_timer_t; -typedef s32 compat_key_t; - -typedef s32 compat_int_t; -typedef s32 compat_long_t; typedef s64 __attribute__((aligned(4))) compat_s64; -typedef u32 compat_uint_t; -typedef u32 compat_ulong_t; -typedef u32 compat_u32; typedef u64 __attribute__((aligned(4))) compat_u64; -typedef u32 compat_uptr_t; struct compat_stat { compat_dev_t st_dev; diff --git a/include/asm-generic/compat.h b/include/asm-generic/compat.h index 28819451b6d1..a86f65bffab8 100644 --- a/include/asm-generic/compat.h +++ b/include/asm-generic/compat.h @@ -1,3 +1,25 @@ /* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_GENERIC_COMPAT_H +#define __ASM_GENERIC_COMPAT_H -/* This is an empty stub for 32-bit-only architectures */ +/* These types are common across all compat ABIs */ +typedef u32 compat_size_t; +typedef s32 compat_ssize_t; +typedef s32 compat_clock_t; +typedef s32 compat_pid_t; +typedef u32 compat_ino_t; +typedef s32 compat_off_t; +typedef s64 compat_loff_t; +typedef s32 compat_daddr_t; +typedef s32 compat_timer_t; +typedef s32 compat_key_t; +typedef s16 compat_short_t; +typedef s32 compat_int_t; +typedef s32 compat_long_t; +typedef u16 compat_ushort_t; +typedef u32 compat_uint_t; +typedef u32 compat_ulong_t; +typedef u32 compat_uptr_t; +typedef u32 compat_aio_context_t; + +#endif diff --git a/include/linux/compat.h b/include/linux/compat.h index 0e058792ecf6..d376fa8be00d 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -110,8 +110,6 @@ typedef struct compat_sigaltstack { typedef __compat_uid32_t compat_uid_t; typedef __compat_gid32_t compat_gid_t; -typedef compat_ulong_t compat_aio_context_t; - struct compat_sel_arg_struct; struct rusage; From patchwork Mon Aug 27 19:45:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145205 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp333070ljw; Mon, 27 Aug 2018 12:46:40 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbKtdDIQku6uikTIxot0kTignl4eRYEZSiXJ4djuSNuXlRK/qhDzoqnC5HcKzs2PrfmJFC/ X-Received: by 2002:a63:f80a:: with SMTP id n10-v6mr13206407pgh.82.1535399200242; Mon, 27 Aug 2018 12:46:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399200; cv=none; d=google.com; s=arc-20160816; b=OjpqkLFT8bkgRMNOrYAg5+IAXa1PNKHJwQOEHmmkzDp97LmG9RgCMPPf1VXFNWuBo/ lDo00SpYPUI80z6ee7LmVQF50VDq5ZSCWmzmkhcqAxP1KcULoDbw/rdBno9jU9x0hwB2 kFeWgVR47GsGVdpT92X0/6QMVEWYQQ6LXWcENQGRJJ5OXMP9bFBcewUgQ3dPJTBCbZS2 p5O+F6KlKFaz5K+IbHilWc5ASDjCS4B4HxR+owN5S6Kb/aE34330kQ1Vw6OSZU8vMhNA XPksaNuCYQCrgk4xQpQqglNCTVv8pK02FzfJD2UoTsjbWKUWRQmXFaajuIZsQzepFq5F XVHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=JkNbdi2X1n1fpY16wYyB+tTy39lS9yQj35KD9XVe+6A=; b=uyRp/xKtA70JbztE9bCTfg6gYTRX6ljYzYV7SABTnS/fW7DBYsviToXmZ1UnwN2AZf /1xYRvyae7DUiBBn76NJT60f2eGU6VxXHMPFjff/75yHZiEMfBApib2dwOtN88iQ6lD+ aF2/IhRXPR8OG+HSEKT9Zml8uC0CErfE7s1tyZgEhVwzCP6X98WhDXO3tL9C7eqSvXAO tAgr84y1hT0vCHIUjFw4k71EysA7MNksZHnwDOENVMXKuxe17zhFRPDujyDBRgjr1g+O KYbrFixZK1Zwk9Jcbd0RcPFfQbtIVSfT7DNnfblcx/jRwixWD9UpQRvsbOL6raDGE+uT zsYA== 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 g12-v6si101018plt.259.2018.08.27.12.46.39; Mon, 27 Aug 2018 12:46:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; 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 S1727815AbeH0Xec (ORCPT + 32 others); Mon, 27 Aug 2018 19:34:32 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:48091 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727558AbeH0Xdr (ORCPT ); Mon, 27 Aug 2018 19:33:47 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0M6DoA-1fjzPk0k8o-00yBxR; Mon, 27 Aug 2018 21:45:38 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, linux-api@vger.kernel.org, Christoph Hellwig , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, deepa.kernel@gmail.com, linux-arch@vger.kernel.org, Arnd Bergmann Subject: [PATCH 07/14] asm-generic: Remove unneeded __ARCH_WANT_SYS_LLSEEK macro Date: Mon, 27 Aug 2018 21:45:24 +0200 Message-Id: <20180827194531.3796559-8-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827194531.3796559-1-arnd@arndb.de> References: <20180827194531.3796559-1-arnd@arndb.de> X-Provags-ID: V03:K1:kz0MUR0edeX/CTA9y/GpA3AA0Hfpn6jT9kn21nGkPkdsEtiluk1 xRKbWld+2f5lmUPUr4wYneLMVhpEhMGFtbVOKHnYcZGYHFaGAURJQqaShv5OjjKP5VB+RCg PlzBJiOiN/QqqlbBm+nwt/iQNgG66s1HgXLLsO54X6OLPGUXEZQsMGRvDrQvW0ZYO1SCcgc vO6tgSuLXrBHrtg8eT81A== X-UI-Out-Filterresults: notjunk:1; V01:K0:N/oyfW0C/NY=:hv9OoiN+MqO+bpuEmNd0Uf oOmHlnBkLEqmtsGMjI5hVZKubuYIMwkzoS2DQahRg1JC1hnjxy9iGTG1OgmgUKkpA56t6C1h8 L1hUqnUoBH2xFNiMlCN4h+Ri5DKcARUT9zM4NB638z1KBxFO3vjRRqMWvJ0ZttJoX5MEhwZi3 FGfggth+eMk68aXb9BYi83XvL2BmOX67ZIUoqj0VzXDw3O6NYPEpqZlp/1bbp+I8LVs/k9f6S gnvLx3hEgpnLukZceTYWTWV9x7dX6+UX/T3x22jFLSCQDmhHy96jPhLQ7fL5b3zdmVl8BLJdS zAB6KoXvMZjbfmJhx24x/vp675myP+MJVAOj/aXBBVVxPgcLFUkf5wPSwztYfFXAXpV0TVP8G P/mb3S7lnmX/uurK3fFsvASwJL5jnanavpa39pCE0uN+BEDtxRzUWFiosT6KnX4TPfXvh50a+ 330ULRQRTEcu9+U6HAmBOy71AcJ1qxqn4r1HZKma9rLF1Mm6TDex+yvQGtOVgWfiqenjk5kEk Hq7dqSnILMYj/PXFJQNH7tv4xlcWDMAtoNbbbznDlwUffKrmJNXnbirsJq3FrVlnpS9nMKeMp 61vqTVVG+fABjN1vhLRlTFs1+91YKb2mCyTe9ndq+irE0jk+oiNZP4Zp7D8moahDkqtrjRlqk zyNy2/ArrQT49i0MY1koNi3DVyalwcOxnNBwwsd92JpXez9YmwfWk3VY6Ofw10vqQtIs= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The sys_llseek sytem call is needed on all 32-bit architectures and none of the 64-bit ones, so we can remove the __ARCH_WANT_SYS_LLSEEK guard and simplify the include/asm-generic/unistd.h header further. Since 32-bit tasks can run either natively or in compat mode on 64-bit architectures, we have to check for both !CONFIG_64BIT and CONFIG_COMPAT. There are a few 64-bit architectures that also reference sys_llseek in their 64-bit ABI (e.g. sparc), but I verified that those all select CONFIG_COMPAT, so the #if check is still correct here. It's a bit odd to include it in the syscall table though, as it's the same as sys_lseek() on 64-bit, but with strange calling conventions. Acked-by: Geert Uytterhoeven Reviewed-by: Christoph Hellwig Signed-off-by: Arnd Bergmann --- arch/arm/include/asm/unistd.h | 1 - arch/arm64/include/asm/unistd.h | 1 - arch/m68k/include/asm/unistd.h | 1 - arch/microblaze/include/asm/unistd.h | 1 - arch/mips/include/asm/unistd.h | 1 - arch/parisc/include/asm/unistd.h | 1 - arch/powerpc/include/asm/unistd.h | 1 - arch/s390/include/asm/unistd.h | 1 - arch/sh/include/asm/unistd.h | 1 - arch/sparc/include/asm/unistd.h | 1 - arch/x86/include/asm/unistd.h | 1 - arch/xtensa/include/asm/unistd.h | 1 - fs/read_write.c | 2 +- include/asm-generic/unistd.h | 9 --------- 14 files changed, 1 insertion(+), 22 deletions(-) -- 2.18.0 diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h index 07e58010d597..8f1159c26f20 100644 --- a/arch/arm/include/asm/unistd.h +++ b/arch/arm/include/asm/unistd.h @@ -21,7 +21,6 @@ #define __ARCH_WANT_SYS_GETHOSTNAME #define __ARCH_WANT_SYS_PAUSE #define __ARCH_WANT_SYS_GETPGRP -#define __ARCH_WANT_SYS_LLSEEK #define __ARCH_WANT_SYS_NICE #define __ARCH_WANT_SYS_SIGPENDING #define __ARCH_WANT_SYS_SIGPROCMASK diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h index e0d0f5b856e7..2af308f13463 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h @@ -18,7 +18,6 @@ #define __ARCH_WANT_SYS_GETHOSTNAME #define __ARCH_WANT_SYS_PAUSE #define __ARCH_WANT_SYS_GETPGRP -#define __ARCH_WANT_SYS_LLSEEK #define __ARCH_WANT_SYS_NICE #define __ARCH_WANT_SYS_SIGPENDING #define __ARCH_WANT_SYS_SIGPROCMASK diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index db22cdadc38a..e680031bda7b 100644 --- a/arch/m68k/include/asm/unistd.h +++ b/arch/m68k/include/asm/unistd.h @@ -22,7 +22,6 @@ #define __ARCH_WANT_SYS_SOCKETCALL #define __ARCH_WANT_SYS_FADVISE64 #define __ARCH_WANT_SYS_GETPGRP -#define __ARCH_WANT_SYS_LLSEEK #define __ARCH_WANT_SYS_NICE #define __ARCH_WANT_SYS_OLD_GETRLIMIT #define __ARCH_WANT_SYS_OLD_MMAP diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h index a28dc770c9b2..f42c40f5001b 100644 --- a/arch/microblaze/include/asm/unistd.h +++ b/arch/microblaze/include/asm/unistd.h @@ -27,7 +27,6 @@ #define __ARCH_WANT_SYS_SOCKETCALL #define __ARCH_WANT_SYS_FADVISE64 #define __ARCH_WANT_SYS_GETPGRP -#define __ARCH_WANT_SYS_LLSEEK #define __ARCH_WANT_SYS_NICE /* #define __ARCH_WANT_SYS_OLD_GETRLIMIT */ #define __ARCH_WANT_SYS_OLDUMOUNT diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h index d7878b3e16d8..c2174b80e50e 100644 --- a/arch/mips/include/asm/unistd.h +++ b/arch/mips/include/asm/unistd.h @@ -34,7 +34,6 @@ #define __ARCH_WANT_SYS_WAITPID #define __ARCH_WANT_SYS_SOCKETCALL #define __ARCH_WANT_SYS_GETPGRP -#define __ARCH_WANT_SYS_LLSEEK #define __ARCH_WANT_SYS_NICE #define __ARCH_WANT_SYS_OLD_UNAME #define __ARCH_WANT_SYS_OLDUMOUNT diff --git a/arch/parisc/include/asm/unistd.h b/arch/parisc/include/asm/unistd.h index b36273bacca7..a0c38374fff0 100644 --- a/arch/parisc/include/asm/unistd.h +++ b/arch/parisc/include/asm/unistd.h @@ -156,7 +156,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ #define __ARCH_WANT_SYS_SOCKETCALL #define __ARCH_WANT_SYS_FADVISE64 #define __ARCH_WANT_SYS_GETPGRP -#define __ARCH_WANT_SYS_LLSEEK #define __ARCH_WANT_SYS_NICE #define __ARCH_WANT_SYS_OLDUMOUNT #define __ARCH_WANT_SYS_SIGPENDING diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index 8b37e01817be..9326c9133516 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h @@ -36,7 +36,6 @@ #define __ARCH_WANT_SYS_SOCKETCALL #define __ARCH_WANT_SYS_FADVISE64 #define __ARCH_WANT_SYS_GETPGRP -#define __ARCH_WANT_SYS_LLSEEK #define __ARCH_WANT_SYS_NICE #define __ARCH_WANT_SYS_OLD_GETRLIMIT #define __ARCH_WANT_SYS_OLD_UNAME diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h index 1d181373288a..a2d583ea526d 100644 --- a/arch/s390/include/asm/unistd.h +++ b/arch/s390/include/asm/unistd.h @@ -26,7 +26,6 @@ #define __ARCH_WANT_SYS_IPC #define __ARCH_WANT_SYS_FADVISE64 #define __ARCH_WANT_SYS_GETPGRP -#define __ARCH_WANT_SYS_LLSEEK #define __ARCH_WANT_SYS_NICE #define __ARCH_WANT_SYS_OLD_GETRLIMIT #define __ARCH_WANT_SYS_OLD_MMAP diff --git a/arch/sh/include/asm/unistd.h b/arch/sh/include/asm/unistd.h index a845b57eac69..a99234b61051 100644 --- a/arch/sh/include/asm/unistd.h +++ b/arch/sh/include/asm/unistd.h @@ -20,7 +20,6 @@ # define __ARCH_WANT_SYS_SOCKETCALL # define __ARCH_WANT_SYS_FADVISE64 # define __ARCH_WANT_SYS_GETPGRP -# define __ARCH_WANT_SYS_LLSEEK # define __ARCH_WANT_SYS_NICE # define __ARCH_WANT_SYS_OLD_GETRLIMIT # define __ARCH_WANT_SYS_OLD_UNAME diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h index 3544244685e1..f7514d3eae7b 100644 --- a/arch/sparc/include/asm/unistd.h +++ b/arch/sparc/include/asm/unistd.h @@ -34,7 +34,6 @@ #define __ARCH_WANT_SYS_SOCKETCALL #define __ARCH_WANT_SYS_FADVISE64 #define __ARCH_WANT_SYS_GETPGRP -#define __ARCH_WANT_SYS_LLSEEK #define __ARCH_WANT_SYS_NICE #define __ARCH_WANT_SYS_OLDUMOUNT #define __ARCH_WANT_SYS_SIGPENDING diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h index 35b66bbf8028..153d2a5e6b02 100644 --- a/arch/x86/include/asm/unistd.h +++ b/arch/x86/include/asm/unistd.h @@ -38,7 +38,6 @@ # define __ARCH_WANT_SYS_FADVISE64 # define __ARCH_WANT_SYS_GETHOSTNAME # define __ARCH_WANT_SYS_GETPGRP -# define __ARCH_WANT_SYS_LLSEEK # define __ARCH_WANT_SYS_NICE # define __ARCH_WANT_SYS_OLDUMOUNT # define __ARCH_WANT_SYS_OLD_GETRLIMIT diff --git a/arch/xtensa/include/asm/unistd.h b/arch/xtensa/include/asm/unistd.h index 0d532ab60b37..574e5520968c 100644 --- a/arch/xtensa/include/asm/unistd.h +++ b/arch/xtensa/include/asm/unistd.h @@ -8,7 +8,6 @@ #define __ARCH_WANT_NEW_STAT #define __ARCH_WANT_STAT64 #define __ARCH_WANT_SYS_UTIME -#define __ARCH_WANT_SYS_LLSEEK #define __ARCH_WANT_SYS_GETPGRP /* diff --git a/fs/read_write.c b/fs/read_write.c index 39b4a21dd933..e892e409386b 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -331,7 +331,7 @@ COMPAT_SYSCALL_DEFINE3(lseek, unsigned int, fd, compat_off_t, offset, unsigned i } #endif -#ifdef __ARCH_WANT_SYS_LLSEEK +#if !defined(CONFIG_64BIT) || defined(CONFIG_COMPAT) SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high, unsigned long, offset_low, loff_t __user *, result, unsigned int, whence) diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index ea74eca8463f..71d2fcf9dbcd 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h @@ -1,12 +1,3 @@ /* SPDX-License-Identifier: GPL-2.0 */ #include #include - -/* - * These are required system calls, we should - * invert the logic eventually and let them - * be selected by default. - */ -#if __BITS_PER_LONG == 32 -#define __ARCH_WANT_SYS_LLSEEK -#endif From patchwork Mon Aug 27 19:45:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145204 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp333009ljw; Mon, 27 Aug 2018 12:46:35 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYI4YnnXhx5Uf+zkcRlFPEtWYuWzE+TMFVFJUge3NiU5VZYsl6zhRtpvZJ5QxYrp3caMPvU X-Received: by 2002:a63:8b44:: with SMTP id j65-v6mr13595687pge.325.1535399195337; Mon, 27 Aug 2018 12:46:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399195; cv=none; d=google.com; s=arc-20160816; b=WbTzBqLsgp/N96/NaqPGaXHk5yNh42efkchDNIrfAIBe1wACi+LK/o/vvhlUfU7bLR R5S2oHP1IFw/G9yvQMoPwDjCYz/DTJsLodhhfn2JtoH6UdI64ewzOqjJdOQ6PcMUyA86 aEJJPlShXt1dsNvShUnmbMW6jWogoUEWarODsom6yyHFEUahluSpkKEaaDCYKpDsKsdz J39p4+8ockpXXQgsHzTigwoTq0oT+s7qjkpeDqVDeWoN633oWOVOcGSIHQNq2z6h+eRT 7PwEfgIEjLDRCr3BMZGBQowTTSqytatJ8XuYsyeZXaRq1gjm/3kVMUYccIKArbYANNrw POKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=d9ytuDUjrc9a/ehadAZfAaL4NbnQojmcXjWo7kjFZ/I=; b=HFy1AdFmBJQNR4H0UqPR3wLkmgRxQ1xND7SRWuROOXJuxR3diqDpBWbQApcnUxEzAM iL9hI60loQ3CO56OATIgA2+5o7elp24foWWemqZF2bfk5wuE3IItNusQWAMKyRoqaCm8 6cWwY0Y0C05rILkUevbjDnPldCJvh3S9UiGMlamUKjlmqN68RD7tjYucF6SoWiyFZope QabZYzu4IvaD4tUituiUeHFpY6gRVQShErUTIEj9tqMnR3JBMBA7dL1zCYttxWHXVOFU h/EGH8TuOFsuCA6DHWPxw7g3SavzdSMltX6AchBOt5RLNu/WdoJvFHo5/w1Hz6MhtJ4I cHVA== 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 o1-v6si106998pfe.259.2018.08.27.12.46.34; Mon, 27 Aug 2018 12:46:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; 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 S1727834AbeH0Xec (ORCPT + 32 others); Mon, 27 Aug 2018 19:34:32 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:59205 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726895AbeH0Xdr (ORCPT ); Mon, 27 Aug 2018 19:33:47 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0LlFaA-1fKlSG2Mwo-00b2w1; Mon, 27 Aug 2018 21:45:38 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, linux-api@vger.kernel.org, Christoph Hellwig , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, deepa.kernel@gmail.com, linux-arch@vger.kernel.org, Arnd Bergmann Subject: [PATCH 08/14] asm-generic: Remove empty asm/unistd.h Date: Mon, 27 Aug 2018 21:45:25 +0200 Message-Id: <20180827194531.3796559-9-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827194531.3796559-1-arnd@arndb.de> References: <20180827194531.3796559-1-arnd@arndb.de> X-Provags-ID: V03:K1:2EVCHoabxR8FT28jD6zrmEoQz6SAw/UnZzYWPCZrUFliV5+7nAW ASbCPL8NeIuCUDNT3LBLYZXzyyzSSTyVRbaAEpe5zH/8r67kjN5I6Qk11PVcW1xC1MB4Az/ z2AyIAjRojjUoqEysAzx+7svD3wXdurjK0jGsgKvqLAm3rg19f75yxocNOToE7hm2tb3Bpd nOXzydleJoXgFvtJ+TNQA== X-UI-Out-Filterresults: notjunk:1; V01:K0:YxGxJtvL1yw=:+BIfcRqKnoK64JagiEAPHv YXzPp9lrpQCVR9G63MzQQ9x2BhbVVCZW2cWYxTf3ePINjRwUxbT1+4Bvb8I1gP8NPkskeXIQY lTdBsoJnd0BgPGkY/illPFO+nJg/twVRupL/ITVy60Uf6hPeMmh+yVRyHDBOcxaTdI3W3L1Lq zZ25iKZvneQMKdRiH7BKrq2w/yKM4DmxqUAZtIB8yqF2X2EuHWbqPysX1i6XZ6ciM6HIgTxwn YXa0SlIsk0vSCahei8D6B2nm7jys0VZGgoojh4EYwIVznFFf6jF4oZxeSWN8UdQO80M3FOglU PJr620XlS3WvA2X/sGnROHshv45+couG2JtB+CqkP804saiQkOn0X1VndkoOxIXhD1pJTvylp v1sr8UQxJZ36lPyLTaMPupOgnBL//l4DATMhYJ7ylNjlSRV/YUuUvBqq7TOqYKjtiD3Tn9fY7 S4pAwOTRsp+ehO6OI/ltNvydDwkKttlCoKc1VUzOf56OSpWK4bXC8GEllJprEQQCGH7Q5TvpQ KH1R9LWnNi2gEmAEQMCg/cgZluwHg2XwiJVL3pwFmW7AJlC6aYujKUslx6ksTGxVFWyChbVbg XPcdRa496fS2jMa6HAQoHnStpWlnSGhe0TyacE5UHEdzcmLi3IhPDNWM2Ll3AlKT+GFZRnZsi oCtA3mzubpjDyIuCTv2Kd0Htr4s1W2FSUIMc525974UNgHw2rFsgWirTd+xcV/9V8HWg= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Nothing is left in asm/unistd.h except for the redirect to uapi/asm/unistd.h, so removing the file simply leads to that one being used directly. The linux/export.h inclusion is a leftover from commit e1b5bb6d1236 ("consolidate cond_syscall and SYSCALL_ALIAS declarations") and should not be used anyway. Reviewed-by: Christoph Hellwig Signed-off-by: Arnd Bergmann --- include/asm-generic/unistd.h | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 include/asm-generic/unistd.h -- 2.18.0 diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h deleted file mode 100644 index 71d2fcf9dbcd..000000000000 --- a/include/asm-generic/unistd.h +++ /dev/null @@ -1,3 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#include -#include From patchwork Mon Aug 27 19:45:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145196 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp332356ljw; Mon, 27 Aug 2018 12:45:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbX3YQBerLqxA3/ZdR6O6RKX7hrtUGmeVFwVBOntPt0SAugzrXJ/y5RjbSyD4HavMFQIRfw X-Received: by 2002:a63:225f:: with SMTP id t31-v6mr6704289pgm.275.1535399150912; Mon, 27 Aug 2018 12:45:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399150; cv=none; d=google.com; s=arc-20160816; b=Hh61BgwAixGEM3CxWw3FOtbxivNM7FyfJPdeIy90zhESBqY0w7yiBNxgPc+oGXm/bq yZX0y8eLBYHo6kEokieieU9XPiw8BX7Z2OME05KkMLnWD2D0FZ/9Zq4blSNH3ScbcWVJ +idAJ7ZYzh2fCqfJ/WfZsS2VTlSY2j5yzWq/9lwROsuPARNqUaOMntih8uv6L5Uv1pAG sEwtgEEDiRqdRMpBjcx1hm4THEpFQB99KjRyYHOLJmUSThAUkZzKm82OOgUNMqgLA12s XEFJvNiBrBhcMx8y6Gda5hAVUaqadOMJoN2DcQb3bmkuQ5l1QTyCDE9JZXMHFVj4UffT Gfjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=xbWxJWd6+Bo4pEk7wGwmuG20eatk6ib81q2Lm6I27Ao=; b=hCRDefIlpolcbMOGeUWz7nwoijv4VSopGAvagJZD0HoA0ArYnEdtMEbWfDf+nVNUEA boCCqd9GOdqZO/z/XXvtRMaxUKonG7r39By+if0MB2ruFDO0M9jzSjFv7+V4wr82CPh9 HzaJ8ekc2tYMfQ5ZOZPL+2Zu1OlQFRWpsyw6pVG8F7Uu7FT8nM2k3ItvaZXc0KA7U5f7 M8qOVO8FCtYwvAhCDJ6sG9NNzYggeGCNepCzJOrs3G+b8t9/dgz4pz0vwXIi07lpWT2+ 4oGd9vCWRktGrNyFX64XtOM3+7KdMZ5pJuHI0a24cIQPuBf5tmSj0Y64g7/vjxjT32iw UPsw== 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 x66-v6si117946pfx.129.2018.08.27.12.45.50; Mon, 27 Aug 2018 12:45:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; 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 S1727616AbeH0Xds (ORCPT + 32 others); Mon, 27 Aug 2018 19:33:48 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:45741 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727559AbeH0Xdr (ORCPT ); Mon, 27 Aug 2018 19:33:47 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0LrsLe-1fnKv649vS-013fan; Mon, 27 Aug 2018 21:45:39 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, linux-api@vger.kernel.org, Christoph Hellwig , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, deepa.kernel@gmail.com, linux-arch@vger.kernel.org, Arnd Bergmann Subject: [PATCH 09/14] y2038: Change sys_utimensat() to use __kernel_timespec Date: Mon, 27 Aug 2018 21:45:26 +0200 Message-Id: <20180827194531.3796559-10-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827194531.3796559-1-arnd@arndb.de> References: <20180827194531.3796559-1-arnd@arndb.de> X-Provags-ID: V03:K1:1qFKP/S7PvEA3HGD/4Qil6EAAqGJOKrgU2K9WNFrsWxBv9b6Q0D yYM7i59XcgAykwlLnhg08OtGr1cj409eIHpZMBTy0E7PgCktsEx6ZrD+e1PgXyCPr77haTj K5GGYfJLeo+g7ahQpTBdteZmDgAwyXZqtzTiIRf8M754nT8GRk4MEZzZGeaJnUBxjnEwDEl vkT7XDbZHei0fnN8oCI/g== X-UI-Out-Filterresults: notjunk:1; V01:K0:HZsGQAdmNqU=:Xig2Cyx/76WH5+gacDPcEs 1qOjGEr+CkA3fQ3xBS1Cq0cyTrNvmqvJVXcRObhCFLQjWDwuEOmTo2HbIVUOM0hnnEjzYaXsI eyZEJNOs4msPq9C64ypqRN30fmhcsD5EkbXt8kOOjD/ONME10+4I4XDHzO1ASUKZu0RSWx3Uq m/DZxWvZZXfV/LGQT2kIVTDvRB2Z/knUwRnVUXntKVylqrR83sP7u4c/8TVsDfRSiNuJEYLoM njp0TRTJd7UahF2if6HioBG+HVbjYuHqdE8akUmy+wf+ouET49d/WDPMUM+nWi8BDmDzaB4gO C01CoTW7jdNA6J1v+eRzfTfRBWAZnqBDpE3C33d77IgW5pFfPO45C7Y4BnCUR2h1pxmoONS// D2VCKrn71adJMT8rAr87x1IHzVwUuVoen9f/iHXVbBokdzeabsIRI+h+TJMV8pKW2EiTxgUT1 zHRYWuXAQZMuOg8KrY/6b4igBWgg4dmV+2Fs2F5QeqapEBWQJUGfwOfSwpeahBQ6nhgtVbU0G 8Hh7tn2WRlG09+eNd+OFUbfWhSrEdzV/X2mfbSrmIcBznVzXJ+p3JD3Fpe64BPD11Lnmxs0Vk LdaRv3Wa/zdlKsp9bjwyJQxj7pOg8qEu9eHotj2VRZDnY+c/y5XFRrfB/5hAc3hOF8JSuDbin cfMqcHIG4C8BqcOUaeLSo0oYb3Dr47zZ4VWM85fwQGR/HmKeWnriIiAH/NT7gwsbWLg4= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When 32-bit architectures get changed to support 64-bit time_t, utimensat() needs to use the new __kernel_timespec structure as its argument. The older utime(), utimes() and futimesat() system calls don't need a corresponding change as they are no longer used on C libraries that have 64-bit time support. As we do for the other syscalls that have timespec arguments, we reuse the 'compat' syscall entry points to implement the traditional four interfaces, and only leave the new utimensat() as a native handler, so that the same code gets used on both 32-bit and 64-bit kernels on each syscall. Signed-off-by: Arnd Bergmann --- fs/utimes.c | 2 +- include/linux/syscalls.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) -- 2.18.0 diff --git a/fs/utimes.c b/fs/utimes.c index 79a65c163f40..d30f409ecc1a 100644 --- a/fs/utimes.c +++ b/fs/utimes.c @@ -166,7 +166,7 @@ long do_utimes(int dfd, const char __user *filename, struct timespec64 *times, } SYSCALL_DEFINE4(utimensat, int, dfd, const char __user *, filename, - struct timespec __user *, utimes, int, flags) + struct __kernel_timespec __user *, utimes, int, flags) { struct timespec64 tstimes[2]; diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index b3e27e5ee322..420ac881a610 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -513,7 +513,8 @@ asmlinkage long sys_timerfd_gettime(int ufd, struct __kernel_itimerspec __user * /* fs/utimes.c */ asmlinkage long sys_utimensat(int dfd, const char __user *filename, - struct timespec __user *utimes, int flags); + struct __kernel_timespec __user *utimes, + int flags); /* kernel/acct.c */ asmlinkage long sys_acct(const char __user *name); From patchwork Mon Aug 27 19:45:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145200 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp332511ljw; Mon, 27 Aug 2018 12:46:03 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbCDWyT0RL5odYbVkgSY5XxDyHH5omUBHUcFUDGnmlmQSoY1FntDaYs/kGw0eTEYfnFetip X-Received: by 2002:a63:2e09:: with SMTP id u9-v6mr13725994pgu.294.1535399162906; Mon, 27 Aug 2018 12:46:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399162; cv=none; d=google.com; s=arc-20160816; b=pcpSceyBbYSHyg0WFm70ReQkzzVPre7KQedSyOD+UEx6lEXunBO34tJqCHaONj6D1C e13nnADoiBw1mJAMWeur6onFffycqaHOIw5MK8fmM9J938aKEvh5Ew4cNjs8kMM7JLUQ Xc88SWTbSX2XrRjjfTdiHoro1EYjRfZ3ZR2ynuwPI4eBAmKcLxIsheHFYebeRd4NkHu3 NVylWqnVRahNk9eitfSIm7IHTqd2YTBh6EyJPqH4ef1khYaT2JHUKze0uxNUt+Lh0H99 VuGRi3r7/MqohBVCd8q1uQ1uX0lp7dlL6dd+pL/D0veK/idIEwgkHBVrnadzfalCNz0U QApw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=p0WUgKHcssMomxvSTWN6oaqhpAuOre1fcgtTVw1Ct4Q=; b=ewRfjbxkavD2rsw/Fu4nTsDMIlXXkIuI8PGxzFCmdlpKv0ejDTHtcuHE0BlOHZUCyX SuczjNGpDZx6SuzlcXPq4czRWWB6BKinEz6/p9ITIh2GahphpiLrQVHU0odrune8PUpa AvXHI0yTTRPnvDKbbAideg1wWpwSobR1qvqelgMM8mQJd8FIsbih0AdGjgwZXkcnjFl8 /frsyjRg0AZew2citviKzv/VMmmdz/GLCVkdSD9BY/3UODzX19gaISsPFyqZDcFGb1A2 fdqW+iWHB5k0fWbDWmqodYDSz5TNpQ25BSHe3RiWzGV8hhVUQPmqbPZw89sf+nc1pKzV qQPg== 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 j64-v6si119825pgc.88.2018.08.27.12.46.02; Mon, 27 Aug 2018 12:46:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; 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 S1727759AbeH0XeA (ORCPT + 32 others); Mon, 27 Aug 2018 19:34:00 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:43801 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727525AbeH0XeA (ORCPT ); Mon, 27 Aug 2018 19:34:00 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0Lw14n-1frRWg1WAP-017mKc; Mon, 27 Aug 2018 21:45:39 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, linux-api@vger.kernel.org, Christoph Hellwig , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, deepa.kernel@gmail.com, linux-arch@vger.kernel.org, Arnd Bergmann Subject: [PATCH 10/14] y2038: Compile utimes()/futimesat() conditionally Date: Mon, 27 Aug 2018 21:45:27 +0200 Message-Id: <20180827194531.3796559-11-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827194531.3796559-1-arnd@arndb.de> References: <20180827194531.3796559-1-arnd@arndb.de> X-Provags-ID: V03:K1:ldLBwGAtBnHShU1CkbDcC05BCQC5chbQv0lvadM0afTqQvYpGgV CxEZ0iX+6eHDdyGySydvWlaB7MwDapGG0/LBsi/uhbOsquXIuKpG8ri3nJxeQwl26Rnnsdt +qjVudtA6z0slDvZ7vI+71tw4QPOXHjDGImT9QupsvmeLJhfrGfixenaUTduyJUve/2kb09 FSSH+sPHrccZHdI/VfHjg== X-UI-Out-Filterresults: notjunk:1; V01:K0:8wkNAu5Y9qM=:+sXHvKu8MAjBq1NWfsZIl/ 40oJaMB3XYk84YGtjJjuEXYTE/shmGe4tzVDruXbVPIPWGesduzMBvw3hW45o95UBX8lX96ZO OsFFZPuVYAVS0MU/A5al7bL77CZqKS2wOA6oxgCgYUp1TC1BArHg49xs6cwD9Vj1B3HCxwpsX Zcj1Z6BE+FNCvU+Qlb+BOz7YKMjBMmvgJ7IBl/R/An4CU9RQZOeWqqFs2BmTFfe7dUavuJoEx MIBOQ3yDdCDv1blPrE4zhotswDMMF3oJNefPWt54syp2vjVfwNNns4lD7Kd6K5BwZjKJtCHDh JyfqaIIzlrWiQ00s75EB9jDEsZC8DoXe8geCdZUkOthA49xw/jkdVPHXb/haLivSV4JZTrm21 fFvmx3vdn7Zf3/PdQFkR1WqdtmUFonsxtk4kgGcEIGBPhXQyIGTecjnF0Xqd1+a2LgFVAvkwh 5sL1G8+1kV5z0alHR9w2C3jWRHspsEm0arbLaRQeVr61BQ0+VGO/8zpTPirlZ4I33y3W/sOUH nV+ZJiK8ehEH0NO9hbZngLs9JrEHhLZMkTGi4cApuDoCLOXnOn4SH3NSNqBsJFAwlBvOz72t+ fpt9jb/7WULSRB6kGI2ZZ+Ck30fMJVBkiCK8Yn0Hv+8YYnJLBV7ML45frIC9u1y4/Ceo91Mgc 70NvJLPKPQkQq1WBUMICoVIg8E4yJf2tvcgQoy0g41UjevmCpWON8gYshszPN1prxQ0A= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are four generations of utimes() syscalls: utime(), utimes(), futimesat() and utimensat(), each one being a superset of the previous one. For y2038 support, we have to add another one, which is the same as the existing utimensat() but always passes 64-bit times_t based timespec values. There are currently 10 architectures that only use utimensat(), two that use utimes(), futimesat() and utimensat() but not utime(), and 11 architectures that have all four, and those define __ARCH_WANT_SYS_UTIME in order to get a sys_utime implementation. Since all the new architectures only want utimensat(), moving all the legacy entry points into a common __ARCH_WANT_SYS_UTIME guard simplifies the logic. Only alpha and ia64 grow a tiny bit as they now also get an unused sys_utime(), but it didn't seem worth the extra complexity of adding yet another ifdef for those. Signed-off-by: Arnd Bergmann --- arch/alpha/include/asm/unistd.h | 1 + arch/arm/include/asm/unistd.h | 2 +- arch/ia64/include/asm/unistd.h | 1 + fs/utimes.c | 51 ++++++++++++++------------------- include/linux/syscalls.h | 10 ++++--- 5 files changed, 31 insertions(+), 34 deletions(-) -- 2.18.0 diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h index edc090470023..9ff37aa1165f 100644 --- a/arch/alpha/include/asm/unistd.h +++ b/arch/alpha/include/asm/unistd.h @@ -14,6 +14,7 @@ #define __ARCH_WANT_SYS_GETPGRP #define __ARCH_WANT_SYS_OLDUMOUNT #define __ARCH_WANT_SYS_SIGPENDING +#define __ARCH_WANT_SYS_UTIME #define __ARCH_WANT_SYS_FORK #define __ARCH_WANT_SYS_VFORK #define __ARCH_WANT_SYS_CLONE diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h index 8f1159c26f20..88ef2ce1f69a 100644 --- a/arch/arm/include/asm/unistd.h +++ b/arch/arm/include/asm/unistd.h @@ -26,13 +26,13 @@ #define __ARCH_WANT_SYS_SIGPROCMASK #define __ARCH_WANT_SYS_OLD_MMAP #define __ARCH_WANT_SYS_OLD_SELECT +#define __ARCH_WANT_SYS_UTIME #if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT) #define __ARCH_WANT_SYS_TIME #define __ARCH_WANT_SYS_IPC #define __ARCH_WANT_SYS_OLDUMOUNT #define __ARCH_WANT_SYS_ALARM -#define __ARCH_WANT_SYS_UTIME #define __ARCH_WANT_SYS_OLD_GETRLIMIT #define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_SYS_SOCKETCALL diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h index c5b2620c4a4c..49e34db2529c 100644 --- a/arch/ia64/include/asm/unistd.h +++ b/arch/ia64/include/asm/unistd.h @@ -29,6 +29,7 @@ #define __IGNORE_umount2 /* umount() */ #define __ARCH_WANT_NEW_STAT +#define __ARCH_WANT_SYS_UTIME #if !defined(__ASSEMBLY__) && !defined(ASSEMBLER) diff --git a/fs/utimes.c b/fs/utimes.c index d30f409ecc1a..2f6f08061a26 100644 --- a/fs/utimes.c +++ b/fs/utimes.c @@ -8,35 +8,6 @@ #include #include -#ifdef __ARCH_WANT_SYS_UTIME - -/* - * sys_utime() can be implemented in user-level using sys_utimes(). - * Is this for backwards compatibility? If so, why not move it - * into the appropriate arch directory (for those architectures that - * need it). - */ - -/* If times==NULL, set access and modification to current time, - * must be owner or have write permission. - * Else, update from *times, must be owner or super user. - */ -SYSCALL_DEFINE2(utime, char __user *, filename, struct utimbuf __user *, times) -{ - struct timespec64 tv[2]; - - if (times) { - if (get_user(tv[0].tv_sec, ×->actime) || - get_user(tv[1].tv_sec, ×->modtime)) - return -EFAULT; - tv[0].tv_nsec = 0; - tv[1].tv_nsec = 0; - } - return do_utimes(AT_FDCWD, filename, times ? tv : NULL, 0); -} - -#endif - static bool nsec_valid(long nsec) { if (nsec == UTIME_OMIT || nsec == UTIME_NOW) @@ -184,6 +155,13 @@ SYSCALL_DEFINE4(utimensat, int, dfd, const char __user *, filename, return do_utimes(dfd, filename, utimes ? tstimes : NULL, flags); } +#ifdef __ARCH_WANT_SYS_UTIME +/* + * futimesat(), utimes() and utime() are older versions of utimensat() + * that are provided for compatibility with traditional C libraries. + * On modern architectures, we always use libc wrappers around + * utimensat() instead. + */ static long do_futimesat(int dfd, const char __user *filename, struct timeval __user *utimes) { @@ -225,6 +203,21 @@ SYSCALL_DEFINE2(utimes, char __user *, filename, return do_futimesat(AT_FDCWD, filename, utimes); } +SYSCALL_DEFINE2(utime, char __user *, filename, struct utimbuf __user *, times) +{ + struct timespec64 tv[2]; + + if (times) { + if (get_user(tv[0].tv_sec, ×->actime) || + get_user(tv[1].tv_sec, ×->modtime)) + return -EFAULT; + tv[0].tv_nsec = 0; + tv[1].tv_nsec = 0; + } + return do_utimes(AT_FDCWD, filename, times ? tv : NULL, 0); +} +#endif + #ifdef CONFIG_COMPAT /* * Not all architectures have sys_utime, so implement this in terms diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 420ac881a610..95e795fb0593 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -955,8 +955,6 @@ asmlinkage long sys_access(const char __user *filename, int mode); asmlinkage long sys_rename(const char __user *oldname, const char __user *newname); asmlinkage long sys_symlink(const char __user *old, const char __user *new); -asmlinkage long sys_utimes(char __user *filename, - struct timeval __user *utimes); #if defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_COMPAT_STAT64) asmlinkage long sys_stat64(const char __user *filename, struct stat64 __user *statbuf); @@ -986,14 +984,18 @@ 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); +#ifdef __ARCH_WANT_SYS_UTIME asmlinkage long sys_utime(char __user *filename, struct utimbuf __user *times); +asmlinkage long sys_utimes(char __user *filename, + struct timeval __user *utimes); +asmlinkage long sys_futimesat(int dfd, const char __user *filename, + struct timeval __user *utimes); +#endif asmlinkage long sys_creat(const char __user *pathname, umode_t mode); asmlinkage long sys_getdents(unsigned int fd, struct linux_dirent __user *dirent, unsigned int count); -asmlinkage long sys_futimesat(int dfd, const char __user *filename, - struct timeval __user *utimes); asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, struct timeval __user *tvp); asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds, From patchwork Mon Aug 27 19:45:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145202 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp332819ljw; Mon, 27 Aug 2018 12:46:22 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYeGINfy3gcyCHbN0JjXMiZ6YrTMhhRjUm5jm5QgQOYKHDLayGTu5cudsg971eLlJmqU5X6 X-Received: by 2002:a63:2214:: with SMTP id i20-v6mr13119803pgi.212.1535399182578; Mon, 27 Aug 2018 12:46:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399182; cv=none; d=google.com; s=arc-20160816; b=MMRkyvzdoSf5pObQNixSOAmtHX7vFmIjrjMQIDp6DoMxCImYEHYZ/fEIVXH6K9Lj3d fNZQMakt1qFsZ2Kif9y5/b8C1OWIuLULOR8NVQitVDAG1VZrVhAHCReottM54QyOogs7 3rNxzu9gEitIV3CRThtRo+f4kZeUsg/9mk63pTblD8HC9Lyf6vv5yN+7zCvOaVaivZs6 3L0fT0ymF1leXDmxhU4BXZ+xVMAoppl+ZWR8zOpsR799kXHpW/PLSscwGweK4x0BSzlQ FfWBxSdih9XA5f2Dc/5uM3eCNxaYRLGUtaVYs07S/PCLJpzNryg1Xio/twBe0PR5DkM8 d3bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=JyM024UZUK/0u6UPr/bbPbArralAXkbkztLlChDPx4Y=; b=cxb24VltPS//Fwr2FbIBR/8PK/aTJU5ePy5tq+LkyfdyU49ReAd/aahe0NUQhi4ozm 4RLXXTqDLsvi/J6JsY270oHhTzdVhgQ86GtHzl9u932lAq0OZoR25fl1KIcg0xc3JIAV zLQKQms+hulHKpDr/ztpoMjMjPVeCZUtYdB+bzvnChJC5cDh1QoHVijdINNEeqm1o9Up eUvWr106qzp5rSV70GeBgLv2nqzmTz4fkW4UdQ9qNPI53h2GkFdb+qBBSRT6Ak2iB3yB 5bwLheMZQmo7RghwmFuMqQ29jgLccSleMmnZ5wUIWbk/mG2FHsxj30lKOp3sQsr6/p+6 Dwsw== 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 i2-v6si109518plt.112.2018.08.27.12.46.22; Mon, 27 Aug 2018 12:46:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; 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 S1727799AbeH0XeU (ORCPT + 32 others); Mon, 27 Aug 2018 19:34:20 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:57557 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726826AbeH0Xdt (ORCPT ); Mon, 27 Aug 2018 19:33:49 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0LnjcV-1fRdDY31Zv-00htUi; Mon, 27 Aug 2018 21:45:39 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, linux-api@vger.kernel.org, Christoph Hellwig , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, deepa.kernel@gmail.com, linux-arch@vger.kernel.org, Arnd Bergmann Subject: [PATCH 11/14] y2038: utimes: Rework #ifdef guards for compat syscalls Date: Mon, 27 Aug 2018 21:45:28 +0200 Message-Id: <20180827194531.3796559-12-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827194531.3796559-1-arnd@arndb.de> References: <20180827194531.3796559-1-arnd@arndb.de> X-Provags-ID: V03:K1:cA26fqo5rWCSg4FMYUmayUb8qH1K8ark2v1x2xLDlbiCynixUT1 A31Cmgx9Tt1tU43uHao/U8nP4kcdynUfIQAPVLXyegYfw1XJNh9DN4c0ky5BgK67YB2mJiQ LSh/XuWiHgwifVQnHNdzxNvuXLQRhVtpwmrzvRo0DX7RwwO8ZLET2c7OOTvWeuL1rZOWVpl ru45OfF7pEFQ+yQ1wnM+w== X-UI-Out-Filterresults: notjunk:1; V01:K0:jcqdODgFYSo=:3Z6GCk0O6pQF+7BFOaN2gO AGpVpt6Sed3XPZVXFUx8ikEsFeo++FrO5Sjl+HDbzveWqxbo3YH/a5PTXbMfqxg81iLHrWtl0 158kog/Nc3hoCsXh6mtkX+RT7bPJPWTNnNy8UC+wghy8G+7VJclkz02dZNDz8pyslrkHs9oAR qfygIIC8ZzbRKkIwSExx/fJx91I5MS21qYUR7ZZkaEfvl6mtTMqQf/cJ3FjKpVxTDrj+oTaZA r+5lITqxy2B4oBR8FQ9AD+rlNWPtpzDp1mNhFIlLhwI0cZ2kdhzxJFZfHbtQ71LHWzgaLyMPc rKMQ4SWtKgUyaL+XkFKmMP6K/c+GTWcpLuHdX9r230SjR4TuBOwto4gdN1MGlg98XMyZnOnrv netQCZ9z57tRhqyyjetgDuwor7rtOV488icJNetm48vlb9hhx2GLYgf9htSvnCtai7sbpPX0V ibs91HlwuU2A4AhPv+im87vHUWT8B8iKScS9CsC/Vie97ufQ4QLZgIwl3h691qsXKsOdiCUup kjFCOrmzJlPTyD+oqyqV/OZrT3ScEex1ONSY2zWVugbtf7qS0JIQb7PbIoYHw+Fk/2AViVcef AMvqpczA1zb9wf4w9Y4j3R1//CradmM3gjWI0IqMS6i0C19o774GSPM+rkHT6/VwpuvSiDM62 woDelX56Sww671KsoOKwLqUuE78kshseQQ6PqmoFMcyZJ+Y7jo2GHHWUHTKCjLEBFZPs= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After changing over to 64-bit time_t syscalls, many architectures will want compat_sys_utimensat() but not respective handlers for utime(), utimes() and futimesat(). This adds a new __ARCH_WANT_SYS_UTIME32 to complement __ARCH_WANT_SYS_UTIME. For now, all 64-bit architectures that support CONFIG_COMPAT set it, but future 64-bit architectures will not (tile would not have needed it either, but got removed). As older 32-bit architectures get converted to using CONFIG_64BIT_TIME, they will have to use __ARCH_WANT_SYS_UTIME32 instead of __ARCH_WANT_SYS_UTIME. Architectures using the generic syscall ABI don't need either of them as they never had a utime syscall. Since the compat_utimbuf structure is now required outside of CONFIG_COMPAT, I'm moving it into compat_time.h. Signed-off-by: Arnd Bergmann --- changed from last version: - renamed __ARCH_WANT_COMPAT_SYS_UTIME to __ARCH_WANT_SYS_UTIME32 --- arch/arm64/include/asm/unistd.h | 1 + arch/mips/include/asm/unistd.h | 1 + arch/parisc/include/asm/unistd.h | 1 + arch/powerpc/include/asm/unistd.h | 1 + arch/s390/include/asm/unistd.h | 1 + arch/sparc/include/asm/unistd.h | 1 + arch/x86/include/asm/unistd.h | 1 + fs/utimes.c | 8 ++++++-- include/linux/compat.h | 7 +------ include/linux/time32.h | 5 +++++ 10 files changed, 19 insertions(+), 8 deletions(-) -- 2.18.0 diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h index 2af308f13463..b13ca091f833 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h @@ -22,6 +22,7 @@ #define __ARCH_WANT_SYS_SIGPENDING #define __ARCH_WANT_SYS_SIGPROCMASK #define __ARCH_WANT_COMPAT_SYS_SENDFILE +#define __ARCH_WANT_SYS_UTIME32 #define __ARCH_WANT_SYS_FORK #define __ARCH_WANT_SYS_VFORK diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h index c2174b80e50e..c68b8ae3efcb 100644 --- a/arch/mips/include/asm/unistd.h +++ b/arch/mips/include/asm/unistd.h @@ -31,6 +31,7 @@ #define __ARCH_WANT_SYS_IPC #define __ARCH_WANT_SYS_PAUSE #define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_UTIME32 #define __ARCH_WANT_SYS_WAITPID #define __ARCH_WANT_SYS_SOCKETCALL #define __ARCH_WANT_SYS_GETPGRP diff --git a/arch/parisc/include/asm/unistd.h b/arch/parisc/include/asm/unistd.h index a0c38374fff0..bc37a4953eaa 100644 --- a/arch/parisc/include/asm/unistd.h +++ b/arch/parisc/include/asm/unistd.h @@ -152,6 +152,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ #define __ARCH_WANT_COMPAT_SYS_TIME #define __ARCH_WANT_COMPAT_SYS_SCHED_RR_GET_INTERVAL #define __ARCH_WANT_SYS_UTIME +#define __ARCH_WANT_SYS_UTIME32 #define __ARCH_WANT_SYS_WAITPID #define __ARCH_WANT_SYS_SOCKETCALL #define __ARCH_WANT_SYS_FADVISE64 diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index 9326c9133516..b0de85b477e1 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h @@ -47,6 +47,7 @@ #endif #ifdef CONFIG_PPC64 #define __ARCH_WANT_COMPAT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME32 #define __ARCH_WANT_SYS_NEWFSTATAT #define __ARCH_WANT_COMPAT_SYS_SENDFILE #endif diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h index a2d583ea526d..a1fbf15d53aa 100644 --- a/arch/s390/include/asm/unistd.h +++ b/arch/s390/include/asm/unistd.h @@ -34,6 +34,7 @@ #define __ARCH_WANT_SYS_SIGPROCMASK # ifdef CONFIG_COMPAT # define __ARCH_WANT_COMPAT_SYS_TIME +# define __ARCH_WANT_SYS_UTIME32 # endif #define __ARCH_WANT_SYS_FORK #define __ARCH_WANT_SYS_VFORK diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h index f7514d3eae7b..00f87dbd0b17 100644 --- a/arch/sparc/include/asm/unistd.h +++ b/arch/sparc/include/asm/unistd.h @@ -42,6 +42,7 @@ #define __ARCH_WANT_SYS_IPC #else #define __ARCH_WANT_COMPAT_SYS_TIME +#define __ARCH_WANT_SYS_UTIME32 #define __ARCH_WANT_COMPAT_SYS_SENDFILE #endif diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h index 153d2a5e6b02..dc4ed8bc2382 100644 --- a/arch/x86/include/asm/unistd.h +++ b/arch/x86/include/asm/unistd.h @@ -24,6 +24,7 @@ # include # include # define __ARCH_WANT_COMPAT_SYS_TIME +# define __ARCH_WANT_SYS_UTIME32 # define __ARCH_WANT_COMPAT_SYS_PREADV64 # define __ARCH_WANT_COMPAT_SYS_PWRITEV64 # define __ARCH_WANT_COMPAT_SYS_PREADV64V2 diff --git a/fs/utimes.c b/fs/utimes.c index 2f6f08061a26..bdcf2daf39c1 100644 --- a/fs/utimes.c +++ b/fs/utimes.c @@ -218,13 +218,14 @@ SYSCALL_DEFINE2(utime, char __user *, filename, struct utimbuf __user *, times) } #endif -#ifdef CONFIG_COMPAT +#ifdef CONFIG_COMPAT_32BIT_TIME /* * Not all architectures have sys_utime, so implement this in terms * of sys_utimes. */ +#ifdef __ARCH_WANT_SYS_UTIME32 COMPAT_SYSCALL_DEFINE2(utime, const char __user *, filename, - struct compat_utimbuf __user *, t) + struct old_utimbuf32 __user *, t) { struct timespec64 tv[2]; @@ -237,6 +238,7 @@ COMPAT_SYSCALL_DEFINE2(utime, const char __user *, filename, } return do_utimes(AT_FDCWD, filename, t ? tv : NULL, 0); } +#endif COMPAT_SYSCALL_DEFINE4(utimensat, unsigned int, dfd, const char __user *, filename, struct old_timespec32 __user *, t, int, flags) { @@ -253,6 +255,7 @@ COMPAT_SYSCALL_DEFINE4(utimensat, unsigned int, dfd, const char __user *, filena return do_utimes(dfd, filename, t ? tv : NULL, flags); } +#ifdef __ARCH_WANT_SYS_UTIME32 static long do_compat_futimesat(unsigned int dfd, const char __user *filename, struct old_timeval32 __user *t) { @@ -285,3 +288,4 @@ COMPAT_SYSCALL_DEFINE2(utimes, const char __user *, filename, struct old_timeval return do_compat_futimesat(AT_FDCWD, filename, t); } #endif +#endif diff --git a/include/linux/compat.h b/include/linux/compat.h index d376fa8be00d..6fb5abdb87be 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -113,11 +113,6 @@ typedef __compat_gid32_t compat_gid_t; struct compat_sel_arg_struct; struct rusage; -struct compat_utimbuf { - old_time32_t actime; - old_time32_t modtime; -}; - struct compat_itimerval { struct old_timeval32 it_interval; struct old_timeval32 it_value; @@ -942,7 +937,7 @@ asmlinkage long compat_sys_newlstat(const char __user *filename, /* __ARCH_WANT_SYSCALL_DEPRECATED */ asmlinkage long compat_sys_time(old_time32_t __user *tloc); asmlinkage long compat_sys_utime(const char __user *filename, - struct compat_utimbuf __user *t); + struct old_utimbuf32 __user *t); asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filename, struct old_timeval32 __user *t); diff --git a/include/linux/time32.h b/include/linux/time32.h index 0e0d7304d1a8..61904a6c098f 100644 --- a/include/linux/time32.h +++ b/include/linux/time32.h @@ -30,6 +30,11 @@ struct old_itimerspec32 { struct old_timespec32 it_value; }; +struct old_utimbuf32 { + old_time32_t actime; + old_time32_t modtime; +}; + extern int get_old_timespec32(struct timespec64 *, const void __user *); extern int put_old_timespec32(const struct timespec64 *, void __user *); extern int get_old_itimerspec32(struct itimerspec64 *its, From patchwork Mon Aug 27 19:45:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145197 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp332378ljw; Mon, 27 Aug 2018 12:45:52 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda0vP75chbQEgZ48WPOJRu+oQ6NowoLZEey9zVufkNzO3y+avfoTFde889ZvkD7rgETop00 X-Received: by 2002:a17:902:d917:: with SMTP id c23-v6mr14276750plz.65.1535399152383; Mon, 27 Aug 2018 12:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399152; cv=none; d=google.com; s=arc-20160816; b=QsO9MgFOHxWvJeG/FbmEY9CPqcVuCnL8YAYQD0/LJJNb6mHuZZfBxwufVKA952cqli 4rrDPyAwaJgbOVBHiaHEx7mWY/Vr2jSLUbBT/fit8+7i3vkilC1YwAh1O8ZopoMdqBK7 YZkuBLM6bi+fPPziDEsBoHtT3+5B6Nuh64QDmRAlIkM8eLeohP5jpwE6PA37ld7c+Ngl YKau+9tmjf4Bu7ZxHdHQZrWVO4OTDTVZntOsR0/jxZ7OSe896dg6w9R3d2uRtFfr15o6 sNO+ZEynP6XvtSZAQEAddecsyxhgEYrUVjjpOUS4by+2B0R7T+0nQqcpUE5ue8m3tdjB nC1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=lHiOM5deHGRikSt1B43ZuSiNxUvYUBN455dKP1Onpt8=; b=OiFk4mWQhwEMtbE/gSBLXWuS+XXQdY2r83ARNvRpXXUiqWcy8N/3T5vKtLdenFx5Wm 0TSRyRTHIn/TLeeElWmDfYS80OJ+9bla5jXUz17vhjTuGq6Mux7vF2UT4HTVqIDiJlWN 3qbZAKOJTnrUzM9oeztQcA+Czu4SNgyBrcA8W4tGqOV0IP6GZ5CSrCWT5UOnk+5nvoEn g7Z3Jqo/6V34DLyrKNZpaCQ/y8XjhGoVvg641wcyizt4mPSE/nDdQpT5K/FCbFk8jUJD RFeMCBvJM/XHAI48aUrvLH/ji7qrr9zulQrUtQ0UdXP+PQVfJBDEyTuC5zncatvwQ19c CrFg== 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 bh12-v6si80277plb.425.2018.08.27.12.45.52; Mon, 27 Aug 2018 12:45:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; 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 S1727651AbeH0Xdt (ORCPT + 32 others); Mon, 27 Aug 2018 19:33:49 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:35469 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727620AbeH0Xdt (ORCPT ); Mon, 27 Aug 2018 19:33:49 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0M1nxq-1ffbh80KlO-00toEj; Mon, 27 Aug 2018 21:45:40 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, linux-api@vger.kernel.org, Christoph Hellwig , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, deepa.kernel@gmail.com, linux-arch@vger.kernel.org, Arnd Bergmann Subject: [PATCH 12/14] y2038: sched: Change sched_rr_get_interval to use __kernel_timespec Date: Mon, 27 Aug 2018 21:45:29 +0200 Message-Id: <20180827194531.3796559-13-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827194531.3796559-1-arnd@arndb.de> References: <20180827194531.3796559-1-arnd@arndb.de> X-Provags-ID: V03:K1:A/PvtBsBqqPBHphqonIzFoco4UcdjHocqMllKaqT0ZBSX1pyyuv CI9k4lkIApv0KhEoBjNLqN1I9Q6Y9E/9wuJ2zNhpIDhNW4AkM+A1NnEEXU8x7Kj0ddMuHio xj5PFbUKX/1Cokxjq88roCCZe4ZJmhmekFCYsj1oqPvESVUTpwtSrMTU2YyPFDt9HUln1zO a0UyZy78YOCAc6msBEXmQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:xKLUZx0V7qM=:ZJT2IOPxulQ8zzcIdMU1bF iMjUInVfAjhSZc7+pFYiB05dQmC7RiKjw3/TxrrSHWg8LvBBF+qiG22FhCStK7w9WYBewxh3O Ezu2nhmHEXdUPYF+4PVhhZZ70xqHlSkbp1iMMXopl7fNfIusg1Jr6enjY3XEfsLVNBw+Cd/DO TrDHWRn0rA0GGZ8oU5ayVF4Sck45RkmQ2mTk7ToqjuoZV2RphbaIohASG8Jz2zg6iexBXzq11 /e5bKisCU2+WeQAAecrPKOZzkBLwf0y846CyRSZ25QBkZG8pPXLXebhS2zccyz3tr+OOzDQzp InlHGQ8Zut9pPafpiUJSig4NXT3eEd5nMZNj9f4MplqdCG4AaSf8GIBQNoINDacztEPL5Dks6 NTZ+cjZBcAarQGQHFCbDpqt8eRGR5o9+BLp1ilgsxYcO/qOwCOuWM0B23IsPr03RAJcZsXuou m0ijpj4/RfGAXXq9+wM1UjLlEY4u72GGVoMpV/VKhteUs2KYZDiOHEtQnNl2UmjWDWRhmWnEL y1PRqVDk2DLdFAX9RqmaItTrVTF9LeTmsKuh+SGweY9r/WOiNRUVEYtovY6K80Uf1v4yRGxzG UA/Q8zowGzEliVY8f7eLvFfLPwz0JkYCwIp2p4xqjHwgFk22Ofp0+rRDanzRK2aD/68o9imXT uVmjww+R6D1nuDTwvtCIhFpDKAEZAMSS0y1ZE8QTC/O9hFpaftYoyYqd1V5XtdD9/hcA= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a preparation patch for converting sys_sched_rr_get_interval to work with 64-bit time_t on 32-bit architectures. The 'interval' argument is changed to struct __kernel_timespec, which will be redefined using 64-bit time_t in the future. The compat version of the system call in turn is enabled for compilation with CONFIG_COMPAT_32BIT_TIME so the individual 32-bit architectures can share the handling of the traditional argument with 64-bit architectures providing it for their compat mode. Signed-off-by: Arnd Bergmann --- include/linux/syscalls.h | 2 +- kernel/sched/core.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) -- 2.18.0 diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 95e795fb0593..5642016a312d 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -614,7 +614,7 @@ asmlinkage long sys_sched_yield(void); asmlinkage long sys_sched_get_priority_max(int policy); asmlinkage long sys_sched_get_priority_min(int policy); asmlinkage long sys_sched_rr_get_interval(pid_t pid, - struct timespec __user *interval); + struct __kernel_timespec __user *interval); /* kernel/signal.c */ asmlinkage long sys_restart_syscall(void); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 8287b75ed961..39af2bec2b39 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5243,7 +5243,7 @@ static int sched_rr_get_interval(pid_t pid, struct timespec64 *t) * an error code. */ SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid, - struct timespec __user *, interval) + struct __kernel_timespec __user *, interval) { struct timespec64 t; int retval = sched_rr_get_interval(pid, &t); @@ -5254,7 +5254,7 @@ SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid, return retval; } -#ifdef CONFIG_COMPAT +#ifdef CONFIG_COMPAT_32BIT_TIME COMPAT_SYSCALL_DEFINE2(sched_rr_get_interval, compat_pid_t, pid, struct old_timespec32 __user *, interval) From patchwork Mon Aug 27 19:45:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145198 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp332388ljw; Mon, 27 Aug 2018 12:45:53 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda/QU8JErco10qQ0cVdOEKhRkJYr5a0JZHSxL7gKEDrsmG9I4Nk8Y+em8jE6kCOriw++lJj X-Received: by 2002:a17:902:6115:: with SMTP id t21-v6mr14522257plj.92.1535399153434; Mon, 27 Aug 2018 12:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399153; cv=none; d=google.com; s=arc-20160816; b=F7WZtI6xbkmRqWbcZWneGGCop5oXNTtvVvEFBzmL3Pchj2JWuDlWEe+JrORfDwopwR URXND2VGsNoVqSCwKGt7sxFo6DolN5fHaCPocMjb7RcAqM18fab5rKacIQWix/AQZct3 uX68EW+6KAfihZT9gqKg8Uob31+Oz9btnnvOSMa7dazoYojIvB5m89NDyG+HFgmmW4Kj nbz/oWC/UFXYlGeD+h3VMNWyLv7ORs9XnJ72nAgz1Yddic3pUqfaF7lKljWQncvfhkeX o5WsM0QXkqTtKdhAFMbv2bShxdHQx5GmTK458Nbx7ydqKD1LWfybUw9PdQNlZTM+LSVM ryNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=kBJVWoJ5Ln+gG7A7XZlYsOJh1DGCQ6u7oHxY2hxj+6A=; b=OFzUvH/9ioAK6KzXTllBAmrpMegIC0KFkgglg/qEXDVapPjTgOqKC0VD5ujFXo9ePr Vr6+99/oagvmfyV/thZmyrLhReZXwbP97NTXDu+ysuluNLfdqGwWuBtABUIY1OcKPz+p GscQOud8CJQGy8AKN1H56B2KMY9Pdem0D7e0I26hii5EEhKPyFju52RJlsiFZxH2BbNN 2PN6+w9KsUlDt0zXJsqA2LxZhyBzoRt8Q1ovXrrvKr/F1NWdhlframzYqpPQO3IPU968 vealSA3lXPiYC012KlKPf2y/FGiS8UUjptR138bRXuYkBumwPtZD39CvyK4j9L41nIK3 wn0w== 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 o126-v6si110454pga.294.2018.08.27.12.45.53; Mon, 27 Aug 2018 12:45:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; 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 S1727678AbeH0Xdu (ORCPT + 32 others); Mon, 27 Aug 2018 19:33:50 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:39705 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727468AbeH0Xdu (ORCPT ); Mon, 27 Aug 2018 19:33:50 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0M73gb-1fgOuX1pbR-00wp38; Mon, 27 Aug 2018 21:45:40 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, linux-api@vger.kernel.org, Christoph Hellwig , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, deepa.kernel@gmail.com, linux-arch@vger.kernel.org, Arnd Bergmann Subject: [PATCH 13/14] y2038: socket: Change recvmmsg to use __kernel_timespec Date: Mon, 27 Aug 2018 21:45:30 +0200 Message-Id: <20180827194531.3796559-14-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827194531.3796559-1-arnd@arndb.de> References: <20180827194531.3796559-1-arnd@arndb.de> X-Provags-ID: V03:K1:V7XQZl/ZW81NfyBSLXtTx6Jd2VYw1T3PcNZLy3/zcKCVKE9TsTG MrL5oHyvdviiYMXRqro6oD2iHv0Qb2gyWygNsKMspFNy3ANSGzQkP9cBBPdtJ+TSV4FOpPD 4Ls+28sfWTuWmtgv57FPhCGvJwE50NF1WtJCvhRVxQOnQH8yUYSu5m2cxeSipJ4O3ZT3uPE 4CtdNnGpaJ3KMEMBlJmYw== X-UI-Out-Filterresults: notjunk:1; V01:K0:o+GhUvvZZsk=:OAa5iFyoQhNLOLn8C/lsRz IFjuXBxLVZtmtNg4uTzbkPzaahDhamX5EwHybWBJsQHHZOa6sVhqkvxH7Ao20V6DWck9RJN+V 6EF0jQc6UPmPs9wq1BQs8jdvaOrsFF7jbwwz20dMe2UdbRPlJHtdmmrs2hogVhge+tXGZKkqB 64NWTCvli18aep74XbhysCZbW2pdMAehVZqfeeLq7LU2r1tqCLUgo6QrkRsXEfU6dOnjglcyZ zmAtBSo2UHRbBRpCzXgUh1CHH4PRnDT5HWCbG7Ir6J3beru7hTnj7KyT1I07KwatHB+LAeiXb juxcL4kmcV+YN3N7O+K6sATd144roeoYdjN8BNFs2JschtVEojvSpRByqIXvwPUEFVEvyDUoE Po8yAt/MmTsAaEmYZdunQ7OUAuQ6fXB7pcrGl7nGfg2sqSGz30k6YMK71WaeQ9gnhdfEME4Jq L+iV1ZJmdeinSaoI1+L3CQ3vlSCOWcVgCxQRjJc67AMExXDGBY5j+UYF9sw2WYDYxiIALEj6w 0m+rZ3yvy6gWVJtLcjFTDa/zJzBjEBkX4GQ8HS8Mg0n+jfH0c5rO8QjlIIRL43U7f6mhoaGuR DRjmW51iH3U129ahKANVvDcYvgE0zczHEYfxcJB41OE+Quogj8xk/9fB5cPQ7JhYTty81fVB7 sF0CFmZI5Whw5E+fvFtMq1cC4EWY4VqQNvdzA6dtzu+yH16dp4AVk9+og/GIrp4/4t68= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This converts the recvmmsg() system call in all its variations to use 'timespec64' internally for its timeout, and have a __kernel_timespec64 argument in the native entry point. This lets us change the type to use 64-bit time_t at a later point while using the 32-bit compat system call emulation for existing user space. Signed-off-by: Arnd Bergmann --- include/linux/socket.h | 4 ++-- include/linux/syscalls.h | 2 +- net/compat.c | 6 +++--- net/socket.c | 18 ++++++++---------- 4 files changed, 14 insertions(+), 16 deletions(-) -- 2.18.0 diff --git a/include/linux/socket.h b/include/linux/socket.h index 7ed4713d5337..8b571e9b9f76 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -348,7 +348,7 @@ struct ucred { extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr); extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); -struct timespec; +struct timespec64; /* The __sys_...msg variants allow MSG_CMSG_COMPAT iff * forbid_cmsg_compat==false @@ -358,7 +358,7 @@ extern long __sys_recvmsg(int fd, struct user_msghdr __user *msg, extern long __sys_sendmsg(int fd, struct user_msghdr __user *msg, unsigned int flags, bool forbid_cmsg_compat); extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, - unsigned int flags, struct timespec *timeout); + unsigned int flags, struct timespec64 *timeout); extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, unsigned int flags, bool forbid_cmsg_compat); diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 5642016a312d..fb3a05fab8aa 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -830,7 +830,7 @@ asmlinkage long sys_perf_event_open( asmlinkage long sys_accept4(int, struct sockaddr __user *, int __user *, int); asmlinkage long sys_recvmmsg(int fd, struct mmsghdr __user *msg, unsigned int vlen, unsigned flags, - struct timespec __user *timeout); + struct __kernel_timespec __user *timeout); asmlinkage long sys_wait4(pid_t pid, int __user *stat_addr, int options, struct rusage __user *ru); diff --git a/net/compat.c b/net/compat.c index 2ef160876bc1..47a614b370cd 100644 --- a/net/compat.c +++ b/net/compat.c @@ -815,18 +815,18 @@ static int __compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, struct old_timespec32 __user *timeout) { int datagrams; - struct timespec ktspec; + struct timespec64 ktspec; if (timeout == NULL) return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, flags | MSG_CMSG_COMPAT, NULL); - if (compat_get_timespec(&ktspec, timeout)) + if (compat_get_timespec64(&ktspec, timeout)) return -EFAULT; datagrams = __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, flags | MSG_CMSG_COMPAT, &ktspec); - if (datagrams > 0 && compat_put_timespec(&ktspec, timeout)) + if (datagrams > 0 && compat_put_timespec64(&ktspec, timeout)) datagrams = -EFAULT; return datagrams; diff --git a/net/socket.c b/net/socket.c index e6945e318f02..b9d71b503720 100644 --- a/net/socket.c +++ b/net/socket.c @@ -2340,7 +2340,7 @@ SYSCALL_DEFINE3(recvmsg, int, fd, struct user_msghdr __user *, msg, */ int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, - unsigned int flags, struct timespec *timeout) + unsigned int flags, struct timespec64 *timeout) { int fput_needed, err, datagrams; struct socket *sock; @@ -2405,8 +2405,7 @@ int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, if (timeout) { ktime_get_ts64(&timeout64); - *timeout = timespec64_to_timespec( - timespec64_sub(end_time, timeout64)); + *timeout = timespec64_sub(end_time, timeout64); if (timeout->tv_sec < 0) { timeout->tv_sec = timeout->tv_nsec = 0; break; @@ -2452,10 +2451,10 @@ int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, static int do_sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, unsigned int flags, - struct timespec __user *timeout) + struct __kernel_timespec __user *timeout) { int datagrams; - struct timespec timeout_sys; + struct timespec64 timeout_sys; if (flags & MSG_CMSG_COMPAT) return -EINVAL; @@ -2463,13 +2462,12 @@ static int do_sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, if (!timeout) return __sys_recvmmsg(fd, mmsg, vlen, flags, NULL); - if (copy_from_user(&timeout_sys, timeout, sizeof(timeout_sys))) + if (get_timespec64(&timeout_sys, timeout)) return -EFAULT; datagrams = __sys_recvmmsg(fd, mmsg, vlen, flags, &timeout_sys); - if (datagrams > 0 && - copy_to_user(timeout, &timeout_sys, sizeof(timeout_sys))) + if (datagrams > 0 && put_timespec64(&timeout_sys, timeout)) datagrams = -EFAULT; return datagrams; @@ -2477,7 +2475,7 @@ static int do_sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg, unsigned int, vlen, unsigned int, flags, - struct timespec __user *, timeout) + struct __kernel_timespec __user *, timeout) { return do_sys_recvmmsg(fd, mmsg, vlen, flags, timeout); } @@ -2601,7 +2599,7 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args) break; case SYS_RECVMMSG: err = do_sys_recvmmsg(a0, (struct mmsghdr __user *)a1, a[2], - a[3], (struct timespec __user *)a[4]); + a[3], (struct __kernel_timespec __user *)a[4]); break; case SYS_ACCEPT4: err = __sys_accept4(a0, (struct sockaddr __user *)a1, From patchwork Mon Aug 27 19:45:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145201 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp332607ljw; Mon, 27 Aug 2018 12:46:09 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbyulGjgorjNt9aAaOu21lnlkEDwog30fnr5BMxLSrrgxE5k3SsdCCp9QSeB0zpaVF0siTW X-Received: by 2002:a62:959a:: with SMTP id c26-v6mr15589437pfk.234.1535399169070; Mon, 27 Aug 2018 12:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399169; cv=none; d=google.com; s=arc-20160816; b=FXMCbqXXdmH04EtxKxQ1FD9Gdd6BArn9TjNjuV5yLe4Ig92/qQw9OolU0ZpSZEFr/5 yFFvvpFapL2LnSU61JtG1H/ZIdBSQj+rYVxTXDlklKXldUGUszBP15bH907e18/OKeSt d6cPihxu4zrltReKhdui0p3I8uVTlaRVa4e8EAmLkZ/IYR5VkeCENeoGZuHFR/oUMKeN zlJ+6WH/m6Rx9R99ZGB/yObD9trf3AkPRRVh3Z0uFYRNgQnY6t4vJt9czQffBeLkvJOd 0zmKj2GlPYjTM4WYGQ/nSiyqYQW+z/7yOb0ajz+DoYNMHDJyn2NCin3lF847DdsLfQ4c /SsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=hyDeF855GHRCtnB0+bbmMqt/TOsJQwwL0Qd+FVw07Yc=; b=07zKOdfIQSviAqn9dOOoo7PUayLGEpkvtYzcqboxP+zixik/2s9rvAnHSW9cRcN4ci 3Z0/PE63LHy0v9pnv6AMRtgSGUekZ0pUgHVGiB/BLupcRtwihYYZgSDkSj9u0gqZDUJr DMiNXo+lymHQDAc8GNU9EgMYlbYQ5dE2puifHbLhOWktUQ37SiXdOisrKLhWtBd3TKl+ bLkHKHIfucfwFLl99uin23em6GQtY/tH89Ke8rFYF3QxkLzM0A3Bgf9wLxG4s+6Nu93c cKiOpD2wckX1+SqHCaXlm8l8AY0vPGeaPD/xQdGIkrvpFHL2tAa5jlHQNP5C6NbKbn/n QqHQ== 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 i21-v6si120413pgb.81.2018.08.27.12.46.08; Mon, 27 Aug 2018 12:46:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; 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 S1727788AbeH0XeH (ORCPT + 32 others); Mon, 27 Aug 2018 19:34:07 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:45163 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727023AbeH0XeA (ORCPT ); Mon, 27 Aug 2018 19:34:00 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0MJl3M-1ftGzY3Mma-001A9X; Mon, 27 Aug 2018 21:45:40 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, linux-api@vger.kernel.org, Christoph Hellwig , linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, deepa.kernel@gmail.com, linux-arch@vger.kernel.org, Arnd Bergmann Subject: [PATCH 14/14] y2038: signal: Change rt_sigtimedwait to use __kernel_timespec Date: Mon, 27 Aug 2018 21:45:31 +0200 Message-Id: <20180827194531.3796559-15-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827194531.3796559-1-arnd@arndb.de> References: <20180827194531.3796559-1-arnd@arndb.de> X-Provags-ID: V03:K1:xZZzmnDdydRGcaU8fik9x2VJnlUAaSwLpHGEywejpKwdgWLBeBW eswYtn8eitwySsa56Ef/BEG5HyDIIRMQXFal8PYAal0mV1EUWrxhh1VyI8CIAhrv/jF5p2c AypyvLA+xi9RWo4/Nu++do2SBb12GWabT5PNb/vLDLuPN6GLFJr8x8SWGok+xvBdVJqYjgS Gyt+wFOr80nFMEb+D6DDg== X-UI-Out-Filterresults: notjunk:1; V01:K0:CTs3t11d81Y=:Pgf9rbF7prThlp5nRAnHEy m4wrSp8CVIyco5oALh2KIFccStH6/j53hCTLKCRYLwvsTsYi6m73TTYT3Nj5yzTEqB+sSvrUg +i8bgWcAS6ldVlNYSmVYSa1Q33xBWKUGXivNHxwPaYAttnrk8Ohz8ld8LKcmkjxh5CDTwYk51 evI46jRar2ctnT1BwG2SVx7jnUvrwn9U/T04/7oaiyaTHc/LsntWJ3SginQpfBUDFTFAQnkk0 T7CK5CtkbnP3F2N5EgGmjcDjFlxST4gIGfpWJmoMH/gJh1gV4w0tNfVGWJvDJZZowpitL6lIp cT220azwWN8w74KUHTKfFbQIngfy4GYN9CRUFj6YxmDyiBUe9+nwJAfSVTZiE5HGQaPD7UnSa MdOy70B0QQT5SNt3xjDjUWadd7A3XT0VOcZMQtoIfyR4dZwVM0BDZHOsFy9g1LZ8aXPib4Snz lYNqV4bFW1pc+gR6027BABzy8/8Th+0iP3H64UWKIxey9jlfg08qLOaeTw9tRCNyoY9MlwoDg zbxwJj22ltkBtf9hkRoFXrNiVrcpvV0HzTCeKzWyOS3p1gA7uv/vaA2JEnNbmUSaUIjAwEOQd OeKjShCcI77q2QjE07aNBL4Nr3bczN9WUCXrRqd95dWDF9wVg2dAxMDlnyjhYk0/6YQ7/IReu E5k4646UFTvTmly0jnjwiMFQ7lSbk9v27SCW1nPgWc3l/zDYQZNudfnPCwHcL7wWObvg= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This changes sys_rt_sigtimedwait() to use get_timespec64(), changing the timeout type to __kernel_timespec, which will be changed to use a 64-bit time_t in the future. Since the do_sigtimedwait() core function changes, we also have to modify the compat version of this system call in the same way. Signed-off-by: Arnd Bergmann --- include/linux/syscalls.h | 2 +- kernel/signal.c | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) -- 2.18.0 diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index fb3a05fab8aa..2ac3d13a915b 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -635,7 +635,7 @@ asmlinkage long sys_rt_sigprocmask(int how, sigset_t __user *set, asmlinkage long sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize); asmlinkage long sys_rt_sigtimedwait(const sigset_t __user *uthese, siginfo_t __user *uinfo, - const struct timespec __user *uts, + const struct __kernel_timespec __user *uts, size_t sigsetsize); asmlinkage long sys_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t __user *uinfo); diff --git a/kernel/signal.c b/kernel/signal.c index a4db724e14c1..0831d56a731a 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3082,7 +3082,7 @@ int copy_siginfo_from_user32(struct siginfo *to, * @ts: upper bound on process time suspension */ static int do_sigtimedwait(const sigset_t *which, siginfo_t *info, - const struct timespec *ts) + const struct timespec64 *ts) { ktime_t *to = NULL, timeout = KTIME_MAX; struct task_struct *tsk = current; @@ -3090,9 +3090,9 @@ static int do_sigtimedwait(const sigset_t *which, siginfo_t *info, int sig, ret = 0; if (ts) { - if (!timespec_valid(ts)) + if (!timespec64_valid(ts)) return -EINVAL; - timeout = timespec_to_ktime(*ts); + timeout = timespec64_to_ktime(*ts); to = &timeout; } @@ -3140,11 +3140,12 @@ static int do_sigtimedwait(const sigset_t *which, siginfo_t *info, * @sigsetsize: size of sigset_t type */ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese, - siginfo_t __user *, uinfo, const struct timespec __user *, uts, + siginfo_t __user *, uinfo, + const struct __kernel_timespec __user *, uts, size_t, sigsetsize) { sigset_t these; - struct timespec ts; + struct timespec64 ts; siginfo_t info; int ret; @@ -3156,7 +3157,7 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese, return -EFAULT; if (uts) { - if (copy_from_user(&ts, uts, sizeof(ts))) + if (get_timespec64(&ts, uts)) return -EFAULT; } @@ -3176,7 +3177,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese, struct old_timespec32 __user *, uts, compat_size_t, sigsetsize) { sigset_t s; - struct timespec t; + struct timespec64 t; siginfo_t info; long ret; @@ -3187,7 +3188,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese, return -EFAULT; if (uts) { - if (compat_get_timespec(&t, uts)) + if (get_old_timespec32(&t, uts)) return -EFAULT; }