From patchwork Wed Apr 25 16:02:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 134363 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1052230lji; Wed, 25 Apr 2018 09:06:10 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+dsvg6UJSuj3cBr9XtHlnAT+sqsjeKNor2fY/4FIkXDgi8oRu6d8Pw+fVbfSfmMzv+IJEU X-Received: by 10.98.108.69 with SMTP id h66mr28471105pfc.43.1524672370419; Wed, 25 Apr 2018 09:06:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524672370; cv=none; d=google.com; s=arc-20160816; b=wHF4rxe/uSugxg2WKmYtYIFvvtLZEYrD3nYlOF2CcoyN/m7AfcpTn2aI55cPTeuf5N Yo8Mx93z2k90UIZ5pxmX/oSpOJB5biPIXHuhvSvEB8hJbF9cq+r+qbenywqtiw1fsNjO BwxmASYvrGoXCC+yRIcXQcQXcRkrIMbJ6KCLq4qRDLZ0eUPyenuslUFLizkiPZ9Tjy5Z iZiJEahahjKmwNwuDqaSkQhiFNb8tKwa3uSBZpzx10zck/JREZymSbkGSFCLOt2CoEjI b9pVXCvSBDuBY9w1wtQ4BjokDPimmzE4gpo1VJZF1s149hY8fF8nU0TbzcNkZ/z0bx/X Uxiw== 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=nxBMoB5BCkCHwTk8stZWRu/C+yKEtB4juT66hmCygJM=; b=dN1LVus5QyYfSvJaEe3zohiArNDTg9mqJLBLkiwM12GFk5A5UtpaU68ROeNAYDU+qp vOuICLoAu45ifzXDLDpTQ2QB9sddhtni8Fobicrjml7RlvOcOqjfaGwVIMPcJfnGnYKM d9zwQfSh8vFK+MrRFtlXrhUNDbjSqyQA7dDOY7VAFXxHL4Bjus7k3J5ZQxK5HmcxCQst nyy2I6lMvRv0PVx0Lln23qR0+dMjJkHYsA2LKHe/5JOm6W2UVyBcQgjQMHjpxEm5c2Bp +Senx58UqaPC5St/yD6j9D3fV/pUOaNorVGg/vNyAeIG5BBlH8BhDDptEEVDQ3dNqgID UmCQ== 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 z187si9171792pgd.646.2018.04.25.09.06.09; Wed, 25 Apr 2018 09:06:10 -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 S932206AbeDYQGE (ORCPT + 29 others); Wed, 25 Apr 2018 12:06:04 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:33823 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755896AbeDYQFc (ORCPT ); Wed, 25 Apr 2018 12:05:32 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0MVd0h-1etY682MHP-00YxNj; Wed, 25 Apr 2018 18:03:31 +0200 From: Arnd Bergmann To: y2038@lists.linaro.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, tglx@linutronix.de, netdev@vger.kernel.org, deepa.kernel@gmail.com, viro@zeniv.linux.org.uk, albert.aribaud@3adev.fr, Peter Zijlstra , Darren Hart , "Eric W. Biederman" , Dominik Brodowski Subject: [PATCH 02/17] y2038: Remove newstat family from default syscall set Date: Wed, 25 Apr 2018 18:02:56 +0200 Message-Id: <20180425160311.2718314-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180425160311.2718314-1-arnd@arndb.de> References: <20180425160311.2718314-1-arnd@arndb.de> X-Provags-ID: V03:K1:pE1auycWNgZO/hfgRwIFxalukRSvFB3Cd6mBErg/NYXaNNYHjNb E1iw4heT9O4W9kShExjHVfzyTfJIj7lQ+RaPZuLfhnCr+xHsxYatExnkF35bJaUnlq62Lgq V7IP6qdHEVqbyKlfkQeUpY/K41xk/Gtia6f5K/VJjV0gR27tzRs1n8W6M3cwobXPk2JZrj+ 3xLUAVo6SHjyhG1PpH+Tg== X-UI-Out-Filterresults: notjunk:1; V01:K0:6BNbiC0a7NM=:fvuDX7pMuViaUVDw+V4FMl Eq+VYQMrnQ+OM7CS67AJ1vd58YvBWR0S9QfwiJzSJ/zuCjChuOyT2HPESB3ilXiLoEopGxUaN 6IHC26d8L+YTZgHqXEvq2GAySgFzSUPFY+fh0NqJVin2YkmIsLzXOkwBUOGLFATpMHZNmSUBG 2RWw425GpzcWmuIBgFSDHPtmT6hhgrFfJumEqCOtmlS076B68EJilqsMMT+u0JuD58xGscrHx LBrtK23ZvGfvhvb2agg5hLRZ1qvUp2VW7OIjY3PVWcel6T4OOs/KTEeBikl0BmIGYzumvF9kQ ltI/KxHeG9/ZJKUnyWOIl5HBSGYAfWhO6eJT4AA8Gy2fE95NXdByAH8FemOZhQC8qsCjnANl3 7SjociEzHhct5dyj0mDjekeXwt/lpZeXDFd8xMPtEpszYzeYTKQo8OECtYcyZ95CMk71cdwio Q/EV5U0J/xCjyn3dqjB3tiZJTYyAF0u8oMLCv9TCp3DNGKksfSHQWyTqtPHpYxt92IG5qJAIR HruLWmRC5x2DVf7Qq7NJ7JfZSCDkpi1qIN4JE+APHVClVY02+LG01jiM1D6r93afqfnQAug8z SKHj1ltkhHjMI8v3eHBXrZgsLPQ/p5EnocYY79Beid7vYKJBuX/qt6hKVJ6P87WbQrVCv9oRW NI9OguCqQpPnY/2z3YR9WoND+4cfuMvQsXSMZ1l3bZdZbNj5sCQ8sXwTFVOryJk4shks= 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. 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.9.0 Acked-by: Geert Uytterhoeven 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 9774e1d9507b..62ee12c247c1 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 daf1ba97a00c..d78c1f49272d 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 Wed Apr 25 16:02:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 134364 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1053035lji; Wed, 25 Apr 2018 09:06:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoToRrBVCxcR9X2IuiGw7bYGGm1vETFSTfGgyUQ5nUOn04+/FLLx5KFxvKPpreQDdni3TES X-Received: by 10.99.111.77 with SMTP id k74mr3947810pgc.112.1524672408204; Wed, 25 Apr 2018 09:06:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524672408; cv=none; d=google.com; s=arc-20160816; b=0eLFgmWZHY/zUfmPTzNgqe/02Wx7EnjxqKh1Oghtv/tLuy8Ei2/jj+qJ/DLR5h3KoF mSIOUo1nJnGXdDvOuvR/Toym1rC7APUEq2F2PFKqPygGlO4YMPY3uDThVRB22Qu6UHWz CstD2QAX9RtV4cpkJn0WsQj10qI6KeOBWz2cQayDrN9NSVgYihGsQzOiUsUQSHgvVp0S igkkZTEkBLXDEIx/jQnm6miMBLxP7AsR3E+61Io36Id0COl7/RppK9mctWpomroEcLZX es0oB/y1MKOdiwLIMHWyfeoKS155131L6wRvsGbFVWukvAGytwMz01Msc+KpHjGUwnqf 5pig== 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=1vslSxBrUCYGCHyX2gMYw3QKPqbUviD7Y8SWEN6v0dA=; b=0p4MhCj1bs2yBqUF7k66t2Dgu5l2VJVDbymGInHd2peqMRllcDvPxQ+KeJyqjXZYIk jF3yx/9JrQ3rsT7PAVyXFPPN8YLAwkOIP4UGAKeTWjuAY/6kSmm6ezEUDke/YiPo5C7K gWfTYo/NOpBa7nf6IJWcaXVeCjlamzXQ+hi6/U6XzJDguGd/7B5fyDGU5bHKJS4W4i5J /lZUYoADWZOd3RQeGJOenTAiCxOXcmMjrYqMdlTLyENofqFBP9j66xRjL+Jskv6pIvSU yJS0ZiYhLHXZnps8fBm5fntFjCfbw7XJOlqviaRKsppxGXVhK4qZqpkvtzeGsjz3MLAt PZaA== 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 j18si13801524pgn.78.2018.04.25.09.06.41; Wed, 25 Apr 2018 09:06:48 -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 S932210AbeDYQGi (ORCPT + 29 others); Wed, 25 Apr 2018 12:06:38 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:41621 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755156AbeDYQF1 (ORCPT ); Wed, 25 Apr 2018 12:05:27 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0MGAYZ-1f8s3X3Kb9-00FEfb; Wed, 25 Apr 2018 18:03:32 +0200 From: Arnd Bergmann To: y2038@lists.linaro.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, tglx@linutronix.de, netdev@vger.kernel.org, deepa.kernel@gmail.com, viro@zeniv.linux.org.uk, albert.aribaud@3adev.fr, Peter Zijlstra , Darren Hart , "Eric W. Biederman" , Dominik Brodowski Subject: [PATCH 04/17] asm-generic: Remove unneeded __ARCH_WANT_SYS_LLSEEK macro Date: Wed, 25 Apr 2018 18:02:58 +0200 Message-Id: <20180425160311.2718314-5-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180425160311.2718314-1-arnd@arndb.de> References: <20180425160311.2718314-1-arnd@arndb.de> X-Provags-ID: V03:K1:JxvRsHB1k6SJGigXsJjEGgLSwwZKUUr2rQ7A1SI1o5ybwwciWxb 1maoLkfrLvrV2VadmhBWMxrfsrhtaLU6dGWVciENpfB25CE8FKLFiCTqVN+I7aJ0NH1QYhL MM4uuJU4vN25g1n+NheSQtyCS6waybcO0jSce/hVyE72/v1WvO50m4OrHK8Ur21mZ8XnfTP w2/XTf9MdzORrAk+qkjLg== X-UI-Out-Filterresults: notjunk:1; V01:K0:ZniTOUg+Jak=:Gz78YFQtfeSdVTGvQZvNvU wFHxi82gMCU74Ntefd8i+zD50PAnIQlpYrKl/ionOx/BvEi9SIUt9bzKppvuY474F8/uKEbIy mgGOCyk0qM7S+9TE0QZljBumnwlHI6qKA7mGofc1A2q2yWNPdlYJeEkhXfglhj49CMpCCJ6pq SUfcwxV+mZJtlr2ieEYYxxu+luxkDkdjA22zIkDaTaMWg+XK/9Bh+9k6N/rDYOW23B8OqE5yA Zbt9vLI23NfntRJoanrAK3QCFI7sy6wT2x1RrwT+3Jk3VXzNsMTPp+FTFmjtI8nBQ449Wwthh Sjwh3+YfB+sSBDStgWiT0eK6/RswUBmx4dB0goi9YoQKRWfNFO0VTuIOMkXKckiblpKO+rN+G HEoMSW+qhMcezKQkndNSrX9oZuZOTMGznEjY11GVaVxcJ1QYwT4Me75a0z5yzai1helwDc0XW zvB4V9YhLiyiwksa4vJvCbniaQ4kgiZmblBLImKX0B2bkElrlQcAXs/GJ0FtkUhv0Fa0UyLol tcisl2StyOqS9w4M0nkacgfFdLPLl4klg3aMGcJJ0KKfyr32YLCHkG7tP1Lxia5mZnT3nrPAy KX3Mb8WoAQ4nv3p6mQAUGSyp3OwkU1EMbqVgPiKPulJOG0wQZ4EfzaRgfcmEVwnL5xnnzQ6xw SZdodsZ2RmIgwA/N1a0dAWVKXkgu5NC0U8OTuri3LDYbUO2iIJHz7YvrP7jJ4t5kNyz8= 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. 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.9.0 Acked-by: Geert Uytterhoeven 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 a0baa9af5487..5c3c1398c62e 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 62ee12c247c1..8921ba34d733 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 d78c1f49272d..fb8fb304ceaf 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 c4eabbfc90df..8f50b5f9bbd6 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 Wed Apr 25 16:03:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 134360 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1052086lji; Wed, 25 Apr 2018 09:06:04 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr/g6sO3Jk1e6TD9ez0VPSsw+xKn0AudX1lGJl1zAhTafsMNKT/8OB5v9Mt2Sb075hgq8wo X-Received: by 10.167.131.24 with SMTP id t24mr6230526pfm.245.1524672364230; Wed, 25 Apr 2018 09:06:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524672364; cv=none; d=google.com; s=arc-20160816; b=grR8cDYHlzxsnEm0K1s+5hY3MbebUtU7SIr++1/3KlU7OwYRxKIqslay6cxnKdPuSL E3h/ylBBanwKfCRnXe2+wh3RbiVeRkGx3v5G9LMl8xMPr/0BH5qkIWuvhWafR8YRupRW kaPbbOe6coh8BlacNlST30OZwEhPSD4vBiJJF3tj7FiMCj6zQ1OXF0JBVK6gR0J40Z+I OTacjlNxe7xGSvI67XvJ/AZ7iU03xsIsRACtQdD+Ib0OdguqZNvYipO/o+i2i8v/JOfO LmtPu2twPXv2EKcW3wid4NbNH8YGJbMhRc0n8Jxsf55wHEgAc/dxWAMgSeSKyK0kxBYV GOjA== 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=3SU59pJEAZkoPbilxunirE8O+T5UmhG12J7D3YGVQ2M=; b=GHbQCgPtQ+H3sEcGHNHR1aXokd8JBC/4UxvfxvPMXfDf+vJhcSTXhLVwutFrSfpTaU ws7gww2v63wtp7D1xumUe5vO6X+vHwfUILFULd/EDnZBSXC7RFcopt4x9CZJkeixCJIj +pnJpTxVkPM0SMngBtUlTG9dSw1HqiQRZ86D/yXMN6N36pn9Fw1dezWL/Rln4UA1IF3d xWVYS3yTD0AR6yc45MXZAQyNdKCNNLG5DRPeiT30AGDA5tT4Li/KpxTRsi9GNGgtRV4B yC9NrSOMwa0DVabRZd6TEGSR79VVZvGW6ODcf//W/eoQctAU48gUl1JRhdQxXrRxABx4 fvuQ== 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 z187si9171792pgd.646.2018.04.25.09.05.58; Wed, 25 Apr 2018 09:06:04 -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 S932181AbeDYQFd (ORCPT + 29 others); Wed, 25 Apr 2018 12:05:33 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:40947 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755481AbeDYQFS (ORCPT ); Wed, 25 Apr 2018 12:05:18 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0LlFaA-1edfxx1G9W-00b51u; Wed, 25 Apr 2018 18:03:35 +0200 From: Arnd Bergmann To: y2038@lists.linaro.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, tglx@linutronix.de, netdev@vger.kernel.org, deepa.kernel@gmail.com, viro@zeniv.linux.org.uk, albert.aribaud@3adev.fr, Peter Zijlstra , Darren Hart , "Eric W. Biederman" , Dominik Brodowski Subject: [PATCH 08/17] y2038: utimes: Rework #ifdef guards for compat syscalls Date: Wed, 25 Apr 2018 18:03:02 +0200 Message-Id: <20180425160311.2718314-9-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180425160311.2718314-1-arnd@arndb.de> References: <20180425160311.2718314-1-arnd@arndb.de> X-Provags-ID: V03:K1:RkQBWFxmMSs6VhgZEHLwj+HPL4sVgGt9m/xkAZ1w0zrusKH3Uk3 BOYhrGkdUUwM/L6sWsUnYp0fPvsIHiHQVt8iWJ/bPu8wzr0S6CvDDCbriINnRzGzWSKc9K2 l6CHv2ENpMhvPRqXa9rowcMRt7Ra/iT0OTYmGcfWwaqXfoPr09dyDbGe51q7W0n+oYX/mCK Pew0v4bi0nAr7xLV7qyqg== X-UI-Out-Filterresults: notjunk:1; V01:K0:FKjEMXyuwUA=:4Yo7CWjwpsdP4U4/Wvjo1Y 3Bt6qyClcOaNxI3NDauQzk1S8gy96AoZXz98qQI69YXT9Hv6PBRcf45d7PCmFwtTJjjHdNrWG 2r6V+Jx9Dyxe3T8GqnWUaZPuEU5IlsVIBoOh+S/TPtaT2ckkpVsaHiLDD+6RClyPMBeb8uS1u yA4rXILz1cy0t8nxTUvr3L45adjFcytw4arT7HaqYi//8UmIn1bMxUUwSeCtHan6zzwlWjx17 +4UH0nFi1r436x9Xxstpm62bh6NIQde5se8eM/YGUhc7hx0Bejwuoj9r75Wjb/ySvi7m9VPZN PUpSaem9sEUzKIHgfxfxR5ojZvdmQSrdYqXd8QvlRf+B20+f8NeRaalx1pqPpd+QuKfoxcqRD IW+eRs32gsQk/wLXiNryEtIbNZ/BG4jbQu89S/M3aEbc1GJAwVTXV7FKKW4PayXO6kilifuRc TNc1Kwzkm54wHHsM4CLPvvx+jsdOyYVRdprjfD0hNjOvDPfia6cDSWX1IaJRvlNopqqoNo/rb s46p/jAkf/O7kwjyzhVcbhooypdDM3kryK2Y00nVFAhaqA+SkEGjiqFAZeEDS9AGz8GCEswlY dGOOMu5XO9VADMG5aLCE036+Z2BHX9NkFjXdLwOfHhogGpLNFw9b9465b6wG+HpQj+csyb/71 l/73JJjQyYne40nf8VMHjnO0fVmqfAU+Yc3MnZaDsPU1NZA8OsX3XglwuWSS0fLd02Sw= 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_COMPAT_SYS_UTIME 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_COMPAT_SYS_UTIME instead of __ARCH_WANT_SYS_UTIME. Architectures using the generic syscall ABI don't need either of them. 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 --- 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 | 6 +++++- include/linux/compat.h | 5 ----- include/linux/compat_time.h | 5 +++++ 10 files changed, 17 insertions(+), 6 deletions(-) -- 2.9.0 diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h index 5c3c1398c62e..c4df478039f3 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_COMPAT_SYS_UTIME #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..f47058485f7f 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_COMPAT_SYS_UTIME #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..62ffafda0d50 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_COMPAT_SYS_UTIME #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 fb8fb304ceaf..3190c86e03ba 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_COMPAT_SYS_UTIME #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..b4ba7781d396 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_COMPAT_SYS_UTIME # 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..610f6a8a14de 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_COMPAT_SYS_UTIME #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..7d784b8bceb4 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_COMPAT_SYS_UTIME # 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 ebc7fb713d91..6318443de15d 100644 --- a/fs/utimes.c +++ b/fs/utimes.c @@ -218,11 +218,12 @@ 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_COMPAT_SYS_UTIME COMPAT_SYSCALL_DEFINE2(utime, const char __user *, filename, struct compat_utimbuf __user *, t) { @@ -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 compat_timespec __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_COMPAT_SYS_UTIME static long do_compat_futimesat(unsigned int dfd, const char __user *filename, struct compat_timeval __user *t) { @@ -285,3 +288,4 @@ COMPAT_SYSCALL_DEFINE2(utimes, const char __user *, filename, struct compat_time return do_compat_futimesat(AT_FDCWD, filename, t); } #endif +#endif diff --git a/include/linux/compat.h b/include/linux/compat.h index af5ac9de4bdf..7887b0a54c1e 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -112,11 +112,6 @@ struct compat_itimerspec { struct compat_timespec it_value; }; -struct compat_utimbuf { - compat_time_t actime; - compat_time_t modtime; -}; - struct compat_itimerval { struct compat_timeval it_interval; struct compat_timeval it_value; diff --git a/include/linux/compat_time.h b/include/linux/compat_time.h index 31f2774f1994..d1a787821168 100644 --- a/include/linux/compat_time.h +++ b/include/linux/compat_time.h @@ -17,6 +17,11 @@ struct compat_timeval { s32 tv_usec; }; +struct compat_utimbuf { + compat_time_t actime; + compat_time_t modtime; +}; + extern int compat_get_timespec64(struct timespec64 *, const void __user *); extern int compat_put_timespec64(const struct timespec64 *, void __user *); From patchwork Wed Apr 25 16:03:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 134362 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1052206lji; Wed, 25 Apr 2018 09:06:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+HZDrZSRZt2wx+iV9JostBcM2cMc99LyRe9+T8Xms392ZBTj3/kYXBvJLoL5zLCyubQDm7 X-Received: by 2002:a17:902:3381:: with SMTP id b1-v6mr29940196plc.248.1524672369275; Wed, 25 Apr 2018 09:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524672369; cv=none; d=google.com; s=arc-20160816; b=mxI8WMXqLGu6fAYAzJoyNSDxkRIz64D9TXAkMpHraSxF5OscJf0BYssQS1Tinnm/8U i6BrTuxRmr4YogJKcPILoN7FjXuqR9KmGcYzMRDcD8mxtothO6gog6kNUfM4iuiHhCWu 6XWCuHU7V+6fRl20Qqilb4VfokphDovZFCTal9DLTn/i+7PNV8lCFQpKhW+5V0SbNge0 ZxGe9DxkrxWD0vTbc8mbVxsu8T/RX2f3KV/AdpxCWPaXhTE2WSaVl5QSVWM6gccut/zV VrxJCk1J2MkUPh4Q36vPGa1OFy/9hkWry2Q74vC1CV2BNozcArD8613T6PTxGCUz9BU3 608g== 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=k6BKIDGNr4aRSihwjW8CDckp/YYb/FOq2x3qRhPOJUU=; b=JpY75DB4hPr/wTnIr/u51FrxPPBbgr8b3M1a+MWWHZxbxhYu0DXo5/MOnOifiH2AbW qYb8q81HJhG31si9kQihJSBBqDaRREvJ5R7yv7vmYSkoOfdN6jnbBtHJlHspDuniCPcu d7urc3R3fVzcM9rh1FERrwjPDWwX5djBB7CgmYrzBZTZphSmm6rSeKmkpOPt2lau1hka Mb4n4p82baOB0N7Af627ARmtoQZ9GDr+JYmqu6qs83ZJoe6zkbgu8oInXG46cpAgC9qd J467IoLZeQeA+lIOjJCFYdFJZivLlnh2be2ylZw9HCL/eIYuy4XkX0Xa+RtSL/nQNBdC StAQ== 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 z187si9171792pgd.646.2018.04.25.09.06.04; Wed, 25 Apr 2018 09:06: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 S932195AbeDYQFk (ORCPT + 29 others); Wed, 25 Apr 2018 12:05:40 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:35143 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932078AbeDYQFe (ORCPT ); Wed, 25 Apr 2018 12:05:34 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0MQNoq-1eoJAi2ILU-00TkiG; Wed, 25 Apr 2018 18:03:36 +0200 From: Arnd Bergmann To: y2038@lists.linaro.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, tglx@linutronix.de, netdev@vger.kernel.org, deepa.kernel@gmail.com, viro@zeniv.linux.org.uk, albert.aribaud@3adev.fr, Peter Zijlstra , Darren Hart , "Eric W. Biederman" , Dominik Brodowski Subject: [PATCH 10/17] y2038: futex: Add support for __kernel_timespec Date: Wed, 25 Apr 2018 18:03:04 +0200 Message-Id: <20180425160311.2718314-11-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180425160311.2718314-1-arnd@arndb.de> References: <20180425160311.2718314-1-arnd@arndb.de> X-Provags-ID: V03:K1:R+roZ20fps50o8bhsoif6KUk5c477hWheUOOag1vwJQdx4bczbN QfoGM98CTTlwDtNDkOVTpy9x7hipDga2Z2modAfJNO+sp9UQE12ChlKBhOWakNTbQeebGVb +i9ONbOAZiyXkLceKX56at7KkSGrGQM6M8UhohZejnRQcjjPnaKFP9ipHESkBuQYjuvatfo EZimJGfab/3bHGhZukeZw== X-UI-Out-Filterresults: notjunk:1; V01:K0:SUiMPOKmfI4=:3TDfbWFT8Wz6ivM86zMSPl nxR4bHy+me6XFt7hAkwwVHgBqen9LzU2HvTQlpkwrsELgFOHafxg8a3X9BWme7AhoOzPIdZiu CK/bfMKIwKusVy6U2blk+zpa4kWBgPe/DQ0hR99e0uRdNMhlz2QXV0R3egzBgSqn6afaXHfaB XI508Eog+6/4ccqONNBgPmWxlCtFcs/5VodCGWxVlcXLCfzGqczzbySnHmh06BGKFoPe1kPom 74/3LwC8tElpLiKBRsnIXeepQy0myvdcYNL1g1yu/TCA3jBstQ6KY+mapGzDaon/NmFuboFhC 2iAvSfK7sbWeAdTuI7oy458utB1lFhza2OCF5vk7NUqrqsCn+A7mSd1vurnwq5YS2kB6Rkwlt x8BL/bVQbUZPEdq63Gap4fT16a03foTqVBjAKBZrDCWcoq1Pndb+/GjmJX5CX8HsvhdPrKL14 lgMX2l2mL360WdNHrBHlamwxbzkefJAEIe+Mxy6U6kgBWqWIGGFQOD3SRsDTq+FGsbX/tJoxa ljD7EFNvyuCGl9Tmq08SChld/Cdg0KDRWNoAB43eAaW+LW1w/1ziattqg9DCOyUprcIqlcVsj aS4RAgOp+eAyfw8v5cCkEAbu/d45MLBcCtno/e/rtA0bcCktNSLgmppUn9jOzCIH5ocBy+Pqb 9tQK7yKpg0jUR8drLG9wg7eDduAG6s2xp3bEHc7qLgysZrnfHMkFrMqc/QLInx6lILhk= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This prepares sys_futex for y2038 safe calling: the native syscall is changed to receive a __kernel_timespec argument, which will be switched to 64-bit time_t in the future. All the internal time handling gets changed to timespec64, and the compat_sys_futex entry point is moved under the CONFIG_COMPAT_32BIT_TIME check to provide compatibility for existing 32-bit architectures. Signed-off-by: Arnd Bergmann --- include/linux/syscalls.h | 2 +- kernel/futex.c | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) -- 2.9.0 diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index d2b19e814218..c3d504dbba9c 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -528,7 +528,7 @@ asmlinkage long sys_unshare(unsigned long unshare_flags); /* kernel/futex.c */ asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val, - struct timespec __user *utime, u32 __user *uaddr2, + struct __kernel_timespec __user *utime, u32 __user *uaddr2, u32 val3); asmlinkage long sys_get_robust_list(int pid, struct robust_list_head __user * __user *head_ptr, diff --git a/kernel/futex.c b/kernel/futex.c index e9013d1e65a1..129555a3b64d 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -3556,10 +3556,10 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout, SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val, - struct timespec __user *, utime, u32 __user *, uaddr2, + struct __kernel_timespec __user *, utime, u32 __user *, uaddr2, u32, val3) { - struct timespec ts; + struct timespec64 ts; ktime_t t, *tp = NULL; u32 val2 = 0; int cmd = op & FUTEX_CMD_MASK; @@ -3569,12 +3569,12 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val, cmd == FUTEX_WAIT_REQUEUE_PI)) { if (unlikely(should_fail_futex(!(op & FUTEX_PRIVATE_FLAG)))) return -EFAULT; - if (copy_from_user(&ts, utime, sizeof(ts)) != 0) + if (get_timespec64(&ts, utime)) return -EFAULT; - if (!timespec_valid(&ts)) + if (!timespec64_valid(&ts)) return -EINVAL; - t = timespec_to_ktime(ts); + t = timespec64_to_ktime(ts); if (cmd == FUTEX_WAIT) t = ktime_add_safe(ktime_get(), t); tp = &t; @@ -3745,12 +3745,14 @@ COMPAT_SYSCALL_DEFINE3(get_robust_list, int, pid, return ret; } +#endif /* CONFIG_COMPAT */ +#ifdef CONFIG_COMPAT_32BIT_TIME COMPAT_SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val, struct compat_timespec __user *, utime, u32 __user *, uaddr2, u32, val3) { - struct timespec ts; + struct timespec64 ts; ktime_t t, *tp = NULL; int val2 = 0; int cmd = op & FUTEX_CMD_MASK; @@ -3758,12 +3760,12 @@ COMPAT_SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val, if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI || cmd == FUTEX_WAIT_BITSET || cmd == FUTEX_WAIT_REQUEUE_PI)) { - if (compat_get_timespec(&ts, utime)) + if (compat_get_timespec64(&ts, utime)) return -EFAULT; - if (!timespec_valid(&ts)) + if (!timespec64_valid(&ts)) return -EINVAL; - t = timespec_to_ktime(ts); + t = timespec64_to_ktime(ts); if (cmd == FUTEX_WAIT) t = ktime_add_safe(ktime_get(), t); tp = &t; @@ -3774,7 +3776,7 @@ COMPAT_SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val, return do_futex(uaddr, op, val, tp, uaddr2, val2, val3); } -#endif /* CONFIG_COMPAT */ +#endif /* CONFIG_COMPAT_32BIT_TIME */ static void __init futex_detect_cmpxchg(void) { From patchwork Wed Apr 25 16:03:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 134353 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1051124lji; Wed, 25 Apr 2018 09:05:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx48H5nz0gqwkrj05kv2KERIVM67yTqaqyvz6qJKYsBqBR/lvBYaDDTwKcKc838p+3iNoFnTJ X-Received: by 10.99.8.135 with SMTP id 129mr18509770pgi.17.1524672322555; Wed, 25 Apr 2018 09:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524672322; cv=none; d=google.com; s=arc-20160816; b=XV1e7DuJciyHsUVjTnnvXALzdOpIOgseXz0mmwtT8ChzJjcUVNDuheGGE+eX1e3Y+t ay83tEvAjtR2d16Puk1jOieEl1UnpzVfhfi76X0Lj1OC9kuFRsrBK8c7SvBKfDDaYEip +Mn4fK2kgD0cfk/Ioa2iY6+HyxbzNclxMVP9yBsyCBitw9pJZZUEVOOwSK8r95S5cwo1 8SuFSDsZuOdtsKuGar1f06BtVP4PpR/XBo08IudUCt4Oxkd5Owq3wGe290BOnb559AlN Ms9OpWfp9+SsOJt8LDzQnqU3EnPRjPWre8ZMJfaSAyiUNNjx5r6cAdlpudZAU7hq4Sh+ ae+A== 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=Wf44AQHoyx8V7CIpg2TofW7ulCpFq0SarNN3ewuRec0=; b=wjKjrrBiKGJNp6oCGls0ka0aDIwp4/RWYy07IrDCXKde4EoEIe9L99YyOMAs2ClRF8 DfNbmJ+L+a1GgpagWIupkdyajANgyp14UxKdgfWVwWRMKEn6WbVyIXuHNtC9QhNYJAhP TgbW6K1PzFE1WiCOLHqukYm39QmEtU/t52vMoH1eyhaM8LxeUQ0nYFK8hpTk+aQ4o0Qr yn+vb1ZTodP8LLbJvZjfbJh2vlOHlMqPd/21pQDX9DUE3ewjiwvE+6TcQRwWycU8dpXL D44KRDRINI0dcaNMSCnqujBFo5sGTqQh08WiJ+PvXITkFiWtvGS/5cE+vy4q+lJQzLHE Vp6A== 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 g14-v6si10617873plj.146.2018.04.25.09.05.17; Wed, 25 Apr 2018 09:05: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 S1755872AbeDYQFF (ORCPT + 29 others); Wed, 25 Apr 2018 12:05:05 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:52717 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755253AbeDYQE4 (ORCPT ); Wed, 25 Apr 2018 12:04:56 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0LuMNz-1eDaVq0d9T-011iYF; Wed, 25 Apr 2018 18:03:37 +0200 From: Arnd Bergmann To: y2038@lists.linaro.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, tglx@linutronix.de, netdev@vger.kernel.org, deepa.kernel@gmail.com, viro@zeniv.linux.org.uk, albert.aribaud@3adev.fr, Peter Zijlstra , Darren Hart , "Eric W. Biederman" , Dominik Brodowski Subject: [PATCH 11/17] y2038: Prepare sched_rr_get_interval for __kernel_timespec Date: Wed, 25 Apr 2018 18:03:05 +0200 Message-Id: <20180425160311.2718314-12-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180425160311.2718314-1-arnd@arndb.de> References: <20180425160311.2718314-1-arnd@arndb.de> X-Provags-ID: V03:K1:8jwDeyfmJKkciOyNw0bu2Tt8CtGOBeJN9yCrM2Scbqyw99Pz3kF kmBBkDi+c5gNlWYHPef3tIbeF/0q8IkMlQTvcunkQDNlbnE77ppLbI9WTQDWRQbpDolE3WW zHaHdKzFKNXZiYmpg2PZJytYwxpI0DvwHfuH4HtQXeLsiXbHgFvE9tGT0K8FXUgKH6SDrRt YCMhP1D6ErxbwNroaPXLA== X-UI-Out-Filterresults: notjunk:1; V01:K0:/FaaNQSDfXA=:9RI72P3/fCSIoEz5AehtOp Z0NMYXhTYhud0oBUDxmHd9qNcll4mgXzU48abDtcCQG19gl1v9ecytnu8ODKPuGt4AiGh8TPw s6LrO/81e57P0qTMNRPJxWUWA5Cbe7gPFLRtURoMU+xYria8cwhJN/imNhrl7qfTEER/kBqXl b3OuFRDxgdFaaok/4/IVQ8GiAIdaNGXsdQ2dJqxLuwtlbIr0hW2DpZNbjccwhyJH0BXGkT/yf ZH8dxheDMcN9KQpzZB8XAp083yKyJ8O3OT2O916M+pQTwgZhoBm+hQXRxGbNs0K5G8XnyDCm7 2isfPv9r2Q+jAbS2udojw46o2gc/ZOTEJaSZ1a0OmPkkM+Vp4a0weTkUhCd+0ohtQwhkOunE2 +iFhVYTxw7fzgVRp0MJcMfa2WoHRc2ebZ0hBg3lqJKIGWaBVcK3emr7yxMMUEsAA3PmY9Mp4r z5iP5BRJipbMlBjsb2J4Y2jhcY50C82fn7mOQHkzc+rREZVjJusf490JMvRJHYl0D7B7+lNGH Bp893+YyJbP3R4CngVkrR6gqLoFN3Xc3Ebr7BuPxpv0v7y+zanIcKS9UXoLqAJ59zdx+pZowH bmhxoZy69Y9WTYhaKtfytomJrOlkDFX+7FWRITNsqhkQvGlmtATdkzvROXZMRAFnsn+2QRv7Z GrUmTZ1JB3B5kXSM2EMStBP+8JJpk8vlEBBf3A+sYUulO1rxBb2ObdDNefFunkL5ahYA= 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.9.0 diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index c3d504dbba9c..2619678359ee 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -601,7 +601,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 5e10aaeebfcc..1e0afc42975b 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5272,7 +5272,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); @@ -5283,7 +5283,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 compat_timespec __user *, interval) From patchwork Wed Apr 25 16:03:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 134359 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1051949lji; Wed, 25 Apr 2018 09:05:58 -0700 (PDT) X-Google-Smtp-Source: AIpwx48UVKAOePoErf173jylJrhrHmTo6XazFIlMS62Glox7yjF3bdeJ3Ask+TMxEHMS40qpfZob X-Received: by 2002:a17:902:3181:: with SMTP id x1-v6mr29945479plb.198.1524672357962; Wed, 25 Apr 2018 09:05:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524672357; cv=none; d=google.com; s=arc-20160816; b=Q+pm32ZSIQReHxZqqZHVjjn1y9dP/QFa10QxEnsMqQ4FD0WCN+XzPsbcoTNRxBhM1V ZCK4xtuav2BGCWgBywPK2EVBAIiysF14tC2vYjmx7tHYXtWPalHC2y6xM1zHuylYt5tk avP36Eqbb0/0o7cheWmS2HothpHrW4wHtKDFgS+R2Ip3jfFSBfSMffHaK7sohAdiRtCt 4xzLVi4Rl5w6GD7gXuBp2OrBS+G5ZbsGTKmwtpUr012Qx5zSHD0vJP107mVnObAI73T/ uoj34mu5Xv8kko+bO6S20T2y134FktdiA56iL60b97fWQLDxrxZAU1uDyOArujZnbMS9 OGWQ== 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=WxtQMRQVO3QhYAd3QOXm5R4FIlC3dN62tAdEZpRCUg4=; b=IH9TOwx+DPBrXSsXp7qgoXgcVoQ7KZyWDwtCl16tF2PctwVFSan3VFr8Ce+gvyw5wE wDCI0hL93cGtdtzUSDs0wUYU/2MWbbSo9XZoWBGCAypSNuM05Nx2t26XCN9TLFl5P0cd 8POQTPXrO+Kd4S4Sj9LAI6IDMzVpMdx96KDhl6LIqzS/8kYTueOvWqhuYLxnxRr1entG KaONyb2n1oQa4Yp7fEMfuLPs6Ty9TxtKnt+Og8J5aTgZFxWwH3swyUoXehlC7sAngse4 tmrbOFgulOTrYkskfm1RASkHbJoXUepTHw/CUAjqupvlQ47H1oaw52C8XyTPiUwxKQJr QGQw== 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 z187si9171792pgd.646.2018.04.25.09.05.50; Wed, 25 Apr 2018 09:05:57 -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 S1755895AbeDYQF3 (ORCPT + 29 others); Wed, 25 Apr 2018 12:05:29 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:39363 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755453AbeDYQFO (ORCPT ); Wed, 25 Apr 2018 12:05:14 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0MhDJh-1eyWy22xQf-00MHwL; Wed, 25 Apr 2018 18:03:39 +0200 From: Arnd Bergmann To: y2038@lists.linaro.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, tglx@linutronix.de, netdev@vger.kernel.org, deepa.kernel@gmail.com, viro@zeniv.linux.org.uk, albert.aribaud@3adev.fr, Peter Zijlstra , Darren Hart , "Eric W. Biederman" , Dominik Brodowski Subject: [PATCH 15/17] y2038: signal: Change rt_sigtimedwait to use __kernel_timespec Date: Wed, 25 Apr 2018 18:03:09 +0200 Message-Id: <20180425160311.2718314-16-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180425160311.2718314-1-arnd@arndb.de> References: <20180425160311.2718314-1-arnd@arndb.de> X-Provags-ID: V03:K1:igsf2P3DT0IyMA/Ng6FqZQct7nSsdNtSCltmMXXdHoWd+BI90Y0 Hzwr1NPoV3JWOW0ImwJW9Bsb0VGPqW+srf4lhuWudCzoOCqkx+9VkCK/2DoP7XO+ZsWfEKj 97i+9xD2U68JEL1LkrUY2OWAr+K6r/EnBazhh8iuKmE6wrbKA00s2ilqOj5Z0qkur/igkz9 LMGb+QEIst4j8y0BBnVBw== X-UI-Out-Filterresults: notjunk:1; V01:K0:65jbx0DJbIk=:KWKqWzqjhcBy1utrBqYdqt mgvLBj5/KSyO/c38AMRkPzgZsb5LFL5gdXbUNrna6LXJ+ROGyGzo4/FcesmTY58V8u2IRDcv8 b/67hERSiO3Rn6qjF2BovO6tydFk3i1muhZeWVwaNUL6R7GGZtTnEOl/qTCD5t3Hjq4LNQKiv 9nzInNlEV9tJ0ktysDRznjvGMDU4TOp9/B2MqGbhscjNNH2AlxoF5enjBfDZCI0CqXI5j5D4n 9D68PL/jwbQ0J8trtz+Q9z/9tOtmuqXymPvpRK9mtmXQWk37tpyrWpyQJ6syXI4ew7E2ifEhJ KvWTGFErQ2Za94+Aesp+qr5ExvOQVP/3t/DsmCXM8eSpPMD2W8eCB86XV6nA0g2jd50bhupOz sMSp+PkQkgMsE7pyS/yiUOor0pY7Mw4APyj0KUsqzQ7ojiX7hERF6JN4dsYkE/fdwHU+EHduj M4eHPuEa4uz3kItFi86W8rLDdqCeXrsG+US/8wlia40fTazLmbRTPCP2+EFqHvsnzz0ZJtoE/ fA0HuNwy5RMhkaXF6CvHdqb99xCpoNLwC8AchEcFYLjQtmACWeIwAmuKYvHAX1mAS7fi4N2+E OrCeMr86o2zqp1wUa7yxw3t5QSijelOva2dCkul2AVi6BjxSYBX9JsfZ301ArfdJtz6oIsoF+ p2JpfShxx+IpaU/QewNrp/rv2Q2Fg68qhqZ6RpV9j8mkXUzvDN8mDbXfkWJJvXNepk2E= 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.9.0 diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index eaa32317f573..a756ab42894f 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -622,7 +622,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 d4ccea599692..d8d68a9556ae 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3113,7 +3113,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; @@ -3121,9 +3121,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; } @@ -3171,11 +3171,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; @@ -3187,7 +3188,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; } @@ -3207,7 +3208,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese, struct compat_timespec __user *, uts, compat_size_t, sigsetsize) { sigset_t s; - struct timespec t; + struct timespec64 t; siginfo_t info; long ret; @@ -3218,7 +3219,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese, return -EFAULT; if (uts) { - if (compat_get_timespec(&t, uts)) + if (compat_get_timespec64(&t, uts)) return -EFAULT; } From patchwork Wed Apr 25 16:03:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 134357 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1051747lji; Wed, 25 Apr 2018 09:05:50 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+/AtI7PJTZs01z7FvrL1WbrezOa4y3nbilirJFRxScLsrzwOYTgKSlvAW4YHJiGbpVlxop X-Received: by 10.98.89.89 with SMTP id n86mr28558014pfb.158.1524672349856; Wed, 25 Apr 2018 09:05:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524672349; cv=none; d=google.com; s=arc-20160816; b=h/b8fRai3yhEUeeranWPL8dhXayYk4MpKdU3Pcm4nHpCuU+WR52v1ym9cCuJXK+ccz 5hjFs9x3h3URbxcdEG0KIFC7NnUvD5i/K/VdyUvHJwedK6BNVZByQsJ3YnQQZOBpIA1j q2DMcHR5YFgv61scGb6Uz3ftNpbTFpUycsfMhsN9EvHPu8KYdfAFgqIsPcwzEVvDNJBX Kxoc2IPavLNH+0l7ldKIf7iKqk4TgL4MDy5wKUpIRqgLljkWw1wzoigT2eVPk0bD36Xm FxoH7cBb1NNVTa/moJuQfL1X7Cq76izNlhqVkow+HTZIvOUHOq4lrYQZbf4a0CHW16xq qnGg== 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=wF+p76L0GD+17hboodSoTXQq+yI0WScQEDNKiOtwDgo=; b=Pr2lMsyR07oq12xSu2hXJPerB3cPJ0WOiGKISiOGrO59rVHn+kU5BJaaMqQo2VvOwF HfW7jMCxg/HYA6dsIK3pG6KhuQPdSucULJPS6XLqqIDAC/Gh/UqY0UH3Wpo05iwCttQx ZYiuWm02b46lrgZecO6ZJ6a238uzoJbeVpPBBEvZTcmnOr4NoTqPhUqTDRk5eOdhX3S7 cuRq63HUIC8qfC10YuPrUR2VL9h7+ra/c4g64QWZimXjmxnbcUq0U/C4IFllp5A61FFc lrwJH2tjDmX2U19hU3/i+NOL+r3382YHGAB3EguBfF1dFkLVkyQdzkO0k5TMI2tW9pqu OlPQ== 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 z187si9171792pgd.646.2018.04.25.09.05.39; Wed, 25 Apr 2018 09:05: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 S932173AbeDYQFZ (ORCPT + 29 others); Wed, 25 Apr 2018 12:05:25 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:33469 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755156AbeDYQFQ (ORCPT ); Wed, 25 Apr 2018 12:05:16 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0LoYQs-1ejCo21Ubq-00gYgQ; Wed, 25 Apr 2018 18:03:40 +0200 From: Arnd Bergmann To: y2038@lists.linaro.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, tglx@linutronix.de, netdev@vger.kernel.org, deepa.kernel@gmail.com, viro@zeniv.linux.org.uk, albert.aribaud@3adev.fr, Peter Zijlstra , Darren Hart , "Eric W. Biederman" , Dominik Brodowski Subject: [PATCH 16/17] y2038: Make compat_sys_rt_sigtimedwait usable on 32-bit Date: Wed, 25 Apr 2018 18:03:10 +0200 Message-Id: <20180425160311.2718314-17-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180425160311.2718314-1-arnd@arndb.de> References: <20180425160311.2718314-1-arnd@arndb.de> X-Provags-ID: V03:K1:aYuytPY9ZxuY2n95IiT46hqOMd4w2WVT4T3/vU3FunrNWAx6sgi 9glSg5Px0nJMoKgRir6IVo7LLENiyWtav5papzV4OdHi/NztYQMDOYJxGTS4BQJtrbUM0J/ +c6dN1cccrq2elFQL6bY2rE4X7bngj855m8S2B21QKwzOB5EQU8ObCfoZq4mkjlvrf6KmRt nS/7OgRQTKZ+kMseQwg3Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:Oosdo68u2U4=:YgtEXDoXI5qJ6H7G2PvusM zIdSwc9AXiAlDF1nCmGGc96+LmtoSED9ItFomRSi9kelrWEktjQ8H6J5ZE+L+3kbeiAo0oBeW BUVQXpAkVA91FVuXpHZEYpNjvDqUl2oEQ/gScSkHwUc408RjWGqR4/0fw/TdhCQyEOHzt5oE0 QPy6eFTXhlB5ZzErWnDyqgJKq8SlEWtIu1o8kQEhObS6uWr+afe+3/dnbjZu+nboiE61wzu0V 6rdRvGZHFF4W1soGVrYynkr1Nit6lfBtWgIOuo1rNvZQI7nfFuZam6uoQPX+h9/kzPVcJcZLI MuDsfnOU+7Ctn1fX/k+qTLj0VpGSqdt+TVmkFVrjpg9DU0DzAE/0ky86dJ1NG2CfuZ26ZaOIM DEHLwf3s1FG2ji3Qbv0Io2Va0f3B+oMz8Lduw8p+7qY0WVqR6lWxF0GDHQt3uxn7SMYsqXgra hW1tbuWjj+dOxuuvezPAitiKDNqLfxogBt6O+58woFhcHS9sxJB0z7VkCZ37LKOSf6DySKaQ9 +goiy2827IoUnEA/gXcLC/3SDOCKlf6tEnA7zCxuD2WXTtBjDjPdgtNGUhqazlI3gtC0DT6eN rqLjL78uEml+wDejJRCqxZnJ3gPLKU5MmqT/1NCx3YeH+524gede1sflP6TGtLjRgI5Lkzdu/ 2fNVhnF22Kzyn3IpZGz/IVAOPzbeIknYUeVVLkV3JYMKhaSbDzMCcEVCo9XDEmn67FjA= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Once sys_rt_sigtimedwait() gets changed to a 64-bit time_t, we have to provide compatibility support for existing binaries. Using the compat_sys_rt_sigtimedwait() entry point is convenient because it allows to share the implementation with 64-bit architectures. Unfortunately, the get_compat_sigset() and copy_siginfo_to_user32() functions are used in that function, but we can replace them with trivial helpers that do the same thing as before. Signed-off-by: Arnd Bergmann --- kernel/signal.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) -- 2.9.0 diff --git a/kernel/signal.c b/kernel/signal.c index d8d68a9556ae..72609c6835fd 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3104,7 +3104,22 @@ int copy_siginfo_from_user32(struct siginfo *to, } return 0; } -#endif /* CONFIG_COMPAT */ + +#else /* !CONFIG_COMPAT */ + +/* 32-bit architectures only need to convert compat_time_t, not siginfo or sigset_t */ + +#define compat_siginfo siginfo +#define compat_sigset_t sigset_t +#define copy_siginfo_to_user32 copy_siginfo_to_user +static inline int get_compat_sigset(sigset_t *set, const sigset_t __user *compat) +{ + if (copy_from_user(set, compat, sizeof *set)) + return -EFAULT; + + return 0; +} +#endif /* !CONFIG_COMPAT */ /** * do_sigtimedwait - wait for queued signals specified in @which @@ -3202,7 +3217,7 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese, return ret; } -#ifdef CONFIG_COMPAT +#ifdef CONFIG_COMPAT_32BIT_TIME COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese, struct compat_siginfo __user *, uinfo, struct compat_timespec __user *, uts, compat_size_t, sigsetsize)