From patchwork Mon Jul 16 16:10:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 142044 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2604140ljj; Mon, 16 Jul 2018 09:12:06 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdBIHLUxG19DZs042wp5dGPbZtOEMNyUFsEg6tom/oPFfY4uOC57Gmxpm7j9HJDJhDK+bhz X-Received: by 2002:a17:902:321:: with SMTP id 30-v6mr17571570pld.122.1531757526308; Mon, 16 Jul 2018 09:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531757526; cv=none; d=google.com; s=arc-20160816; b=UQaJC8o8Vjg6fQbFtGj1uK+gR19Jl3jIp7mT1H9v4nx5WL+hQD1q+ka/IvLOnX4Ny5 +7rzvjw9NQ9QeA7nWxemfLSE8dSaHhxf5j3cRO+jJitwDIM/0d7tw5LJYNPxVSkPsYd0 IuaPVEUdfL9JkbGIus1IRxYUXztbASDFrdzy9yXuarjyREUB4QUdKfamBfQJiXLNc+KR bICzl887CTIYbpLyZqN65h7dyk4PkbLL38YEO7CseDFqNrjpQwciz3eZQwMFM5juv2VD RiUKVB8Qne50gfR+LTU//Dr/m9EXBRbYfvUZNGsirX4Y6+KiRWBm8UvuOLb36qZtl2CQ w7kQ== 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=i+hMGXGOKNYi0H8xLHUp/O4ysxzfA7phdsf4gPHNj0U=; b=0EL+PSqX8BqDRBOaVP9ZtinVB0h1jFuNnf7LmTx/FP4Hc9e7A9rbD3funQBMsYhOnj ZmxXFHyQwDHdO5U6z7yR0mnJAm3yTx1GWKMQPbyd1S0xSUdDW6UBUVPyzO8FpGN5FcYl sDXxMJq+Yi1wXoUVaobv5gvtdY/yDXg2TwajNYeGwCgnLgreMv1+Th2T74tIbTOS6yNI Ano9YIxApsqH73AF61+atNlcdQJTpWNZxVDOMgGNh5ARNvJTXA6ZclgN691rju0ZAGRO SFywqP1PmFtpu1fDVjHNudiZURJaw0CHswvJ6GSkfag2RvxOTLP3JG3wx7K5z7fi5tjd JFdw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 x18-v6si30410996pfh.84.2018.07.16.09.12.06; Mon, 16 Jul 2018 09:12:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730890AbeGPQkK (ORCPT + 10 others); Mon, 16 Jul 2018 12:40:10 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:43149 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727970AbeGPQkK (ORCPT ); Mon, 16 Jul 2018 12:40:10 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0M2CHo-1fvOUJ0kfU-00s8E6; Mon, 16 Jul 2018 18:11:07 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, hch@infradead.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, albert.aribaud@3adev.fr, netdev@vger.kernel.org, viro@zeniv.linux.org.uk, peterz@infradead.org, dvhart@infradead.org, ebiederm@xmission.com, linux@dominikbrodowski.net, Arnd Bergmann Subject: [PATCH v2 01/17] y2038: compat: Move common compat types to asm-generic/compat.h Date: Mon, 16 Jul 2018 18:10:47 +0200 Message-Id: <20180716161103.16239-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180716161103.16239-1-arnd@arndb.de> References: <20180716161103.16239-1-arnd@arndb.de> X-Provags-ID: V03:K1:TknBYfJlvcUaKkWIXorqOD1ATpXpCuCBmjFGqFoBY1/0qSVF3Jr jAJUn2WV2qW3NZPVsMIeGtKeatl8A9/YJHnW/C1Bm1Hfk53LLNDlQMKSdZLOhg6qihsBhjg KBdSOvuWIb8IdkLXancK4PDV4mSo4VaVwjOqN38ZIxroNq2qUsPXO+kVcPkb6246Xso9ado 1R4aewa3Cz1MgpYFpunng== X-UI-Out-Filterresults: notjunk:1; V01:K0:YUtOGFiVCvg=:kCWBTxI7tIt+uhQN2fWub4 eT00pxpcAiGdNUK4EBaMclDngzXtocJCZWPMFeCmDpQcCscfdf2agjw8R5itfgORJXgIhSJIR nrnB5GmPUsR4UOW/fMAaJObbxipJkYipP5YC6IXQwjNJPvHoCH0pXSpbibMObZgYTS1i35Myb UcRXPzwf3AWst2EpHLqelg5QsfPFHyWQ+7t1GKFBif+Ci8IM0Bw2HQ5qgHMSOkfnI4gMMIZoD 853hHFIRq7XVM1yxSdAQzfJg0rahOF/U/w2XctKBFqeh9L8SNHL4ImjsDm2Av19m1NeBzY31p N+fyXTKEKXoCbp+2vbIEsv5t81OPiWLDcg5WpLVkSt/P1vAhMZ2+dL/uz8xMHdxWjZ3wYdYAh j0nxxpCwcKiRbLojY62nfG/uXRF+Slobcg1AY+Bc5tRm7l7uaTUugs+VZMdC+SCs6wJIYoh+f E1Pgnv3ybMf/ChcLRKXMV1QRYHKNvSI/LEhw0hOnOLJAYWu4Ypmz+OvbXmEMQRuD+JPygiYFu PsuYaWIk00SAhidpboQZI8Ewti3t5xPdj75vk7XcoZz1k0x9R1eNKqbgXPtDtbaYrucYH5i7P IsJbwZ0gpL/iW8h8OdB1TJbmfIyxG75t7yAd+TxZI/u6zplsPiItyCX6woissx/MhxQnULWAN CbEhxqujcIkheHPtJek0uT8ixuMFhILAMnv6/eURJEns1jjCkqwY/XOPrSNmH329xCv4= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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. 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.9.0 Reviewed-by: Christoph Hellwig diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index 1a037b94eba1..a4c79f9e856d 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 78675f19440f..7033a7c93b48 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 ab8a54771507..f707e025f89b 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 85c8af2bb272..036b210b1582 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 4eb51d2dae98..985286b79891 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 1a3c4f37e908..c40bc39fe05f 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 Jul 16 16:10:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 142048 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2604229ljj; Mon, 16 Jul 2018 09:12:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpczSnOPLMRq4ZdrkrNPs6XWY3O9JEuH2QajGHOAua20NH9g5rj3E3QEz08Vd322E/TSBhJj X-Received: by 2002:a63:735d:: with SMTP id d29-v6mr16163916pgn.156.1531757531331; Mon, 16 Jul 2018 09:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531757531; cv=none; d=google.com; s=arc-20160816; b=izWvDAbPzIx7SKSlLbwjKiMVc/+Ft3JIyCXDe2+ZNUN7ePJ9/bHJ3S0xX2yZeZjpdL /wTkbtRsQu/Y0Op5IpH3N9Y4h0pcfR+a75iScsA6JRKq403hc3orT/GljyKD66AUYFa/ md1AZLiBBcvlmD3T1Yi2kMjbsKB+sgZL0O+p0xr/552dR+zJWXrrfQCixTxAdW5cD5Cx Jr47i9F5wjRZeqOccqNz3z3tYY37CA0Falw+zH6e4c1hpkJR12Rzi6o9peRhcJzUXGT8 T7UYAVe1q+X2CTJzDcPaIUFEPrRuVtdYyHBSV1y1vC4IcaBjpxOOlllKsqz5hScLN/wI lafg== 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=TdbG59BJERQtPqW085cha+IE6Iph8whQqO4K1h79yLw=; b=FJc0qJJaWVV/qkdUQIuOujOs+bX0LXpO+ueJAgCAu1nSzdfBy9gfC/Y4j0HOprQH4N VjOa0kvjqbzl6lxwJsrrU5npy2+C0wOQj9veRRXZqIbH4OotRSlvYjGBHZVtguzmFqJ6 5XESsLiMIBZQcRUOsv5iinaS/kRzAyIQzI/SJPPGwGzve/KwO7ebOiTRn5uH4fEItcNR 9V7842rgXeHQsiDePrw0Zj3MgQq8+BNOkGHboxJndzc6DaunU98Sy68QQ5pxg1n+2+9c BH0jFV/gfH5aTu8kDKothjYMyFmFtrJ8i5pr9kgbXUogyMBm/ywexv7SuYxS0LBiQh1q xAbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 x18-v6si30410996pfh.84.2018.07.16.09.12.11; Mon, 16 Jul 2018 09:12:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731198AbeGPQkP (ORCPT + 10 others); Mon, 16 Jul 2018 12:40:15 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:46517 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730897AbeGPQkP (ORCPT ); Mon, 16 Jul 2018 12:40:15 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0MEx1K-1fqhk12x5e-00FzJE; Mon, 16 Jul 2018 18:11:07 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, hch@infradead.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, albert.aribaud@3adev.fr, netdev@vger.kernel.org, viro@zeniv.linux.org.uk, peterz@infradead.org, dvhart@infradead.org, ebiederm@xmission.com, linux@dominikbrodowski.net, Arnd Bergmann Subject: [PATCH v2 02/17] y2038: Remove newstat family from default syscall set Date: Mon, 16 Jul 2018 18:10:48 +0200 Message-Id: <20180716161103.16239-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180716161103.16239-1-arnd@arndb.de> References: <20180716161103.16239-1-arnd@arndb.de> X-Provags-ID: V03:K1:iZeqkd6MZNuLUWBOU+RaV6nyUfRGDTNt1jV+8bm3IjE4CZuNuL8 bj5f6f3x/o2NcMdiKvJpDyM60CXSZXC/6a3L6mfFuzW3j38yx/CKz1IkWKE4gdXQNnvVY6e W8ropTeQlJVXqu6jb5ww6YfThwHOro8Mg4W2Fis6lNLRkxUWDwLgUL3NmCC76y+W/kCS2w0 teivXOLoPfKmmwufH7KIw== X-UI-Out-Filterresults: notjunk:1; V01:K0:1zNdvRFUY8s=:83xfpb0VrrRrIwbyFQWPwH K9vecdbTrZMZ5ypuUrEwkcuEf9WAkv5zQg/9C9CV+d2ux360tsZD9ckRvyy9HaryjBVnsttRV 724icrTPLxQRNeZBP2aq/n249x6ajlCfqgMAzaKraq5kO314RtGmbKmxmdhCz4O4gbK7dc945 riZ7QLDMzNDfrr5wQrIPgcOAdBLJ9q9FkjSdtXS8shuNNVprXbdFF73wx33V55Rk+53zZy5xm 1ctsrPIT8yj92izFI9gE/An117aE2emoPx8zv9Ed+xSi5TkrkSaqLh7pNnrr4okL0UsBqi3lg WuV/FL4ZGTgxRuGWCcTmvv+gGvevua0y7iWOPurZHFCm4ugvIDAkyK2BkeISTI/AugUwZYV9N v85EiK0L7mC1S7LeNtUpQnlJOBnXmpy5/BZB7Q80TqIHjvfros1+j744Jff77tlremwIQYfxh Mi8L0Hl0v4/OT4yeB9rNfpNe2iyPTPPicTo9Pm+aB67uDm3hT+CJX9tpH02uG0JV81QRLaWV4 nlIBqvbbpfFdzZDPj59bnMU50gKNAcvh+Tf7GlG2hu73n80grEPv2PE/TYukbDmxXeEsJuYki 9xKmSVcsItvmPUrAqcx2UaF7ehBbjs7WehvDTuLPcSxDadv6kADZL7X36bb9yxY9CeESUKxgQ FsfUTJyCw/I11bvVDrRTbOGtkc/rp593YMmyZ9gC7tnGEDZtrQ3ZF+3An5J07XAnoC8g= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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.9.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 Jul 16 16:10:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 142042 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2604069ljj; Mon, 16 Jul 2018 09:12:03 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd1pyF9eT0XxYZfN9+Jq3iAHz5gz5mAGcFkiQjMfkrtIQXPPXgCmztv7ga/zXGTlXDHjW8W X-Received: by 2002:a63:2404:: with SMTP id k4-v6mr15922718pgk.191.1531757523399; Mon, 16 Jul 2018 09:12:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531757523; cv=none; d=google.com; s=arc-20160816; b=L11l2u8SSsE4ZnMNxtH0ilBZguJ8q13ylDN1oGBTLs1B9Wa7R9WGoDX9+u6fCs0DEp Vg3KJ7sQ0hj8AJRyheOe7DgFKaRALkhFJR9v3tTmcyb2gcWweUkD/8nATIibKOPjQ6nW 1nAJ8SEFMoFw0odVp4ZoZgv6KRJO2urwtt7B+1A9zVx9XZsyOU+IhxLEeEPm61kWb2hJ DQ5Zb9TqWjFM445q9MQIlNJ9jcRrdGvH6yBER4EE55AH1/aUUVdNEzdWU8r87zCuvIiy R6qteB653bbdC/LybVQTvhKtre3rEGDRlnr9lf2XbLqWrQRoGtsO+5giEA9hBLqJIc5V MX/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=CDqe8uQ+zg5OyUP80GatEzJAtc7A7srpwZQRTZj6h44=; b=j/9+U3tjhJBDzdWAYlmhMx0GGxfjaw2Ct9XG+Je+VpDXBXo0LANeC2pUZ8pHfpqp+N 6g6WK3c5WmEDU6Iull/xe99zqqQYsA4WinrOQG2r0MYFcPdbP70vGNwj3/OS+eHhVcoV HgtJ1G5AoQj8at5gDH/0xs7y/BbxVvODVTy6qimNvcioLL9vsZldd1Uq6oPOl7cDIgve NjxL/jOzEnifEvvGqbAZ8vLZrDdFKPCRYjI5k/Z6+M1JvYhNyfys9eai5rZgEedmzACV WomVDC3mYlQ4TgkiyBeMYm3RkG01Cn5tg+Y8vE4zlqSQQUZUgWNCrQfp8cCUQkQJ2/WU uL9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 x18-v6si30410996pfh.84.2018.07.16.09.12.03; Mon, 16 Jul 2018 09:12:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730531AbeGPQkH (ORCPT + 10 others); Mon, 16 Jul 2018 12:40:07 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:54564 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730229AbeGPQkH (ORCPT ); Mon, 16 Jul 2018 12:40:07 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0Lowim-1gHTho0u2u-00eqWw; Mon, 16 Jul 2018 18:11:08 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, hch@infradead.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, albert.aribaud@3adev.fr, netdev@vger.kernel.org, viro@zeniv.linux.org.uk, peterz@infradead.org, dvhart@infradead.org, ebiederm@xmission.com, linux@dominikbrodowski.net, Arnd Bergmann Subject: [PATCH v2 03/17] y2038: Remove stat64 family from default syscall set Date: Mon, 16 Jul 2018 18:10:49 +0200 Message-Id: <20180716161103.16239-4-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180716161103.16239-1-arnd@arndb.de> References: <20180716161103.16239-1-arnd@arndb.de> X-Provags-ID: V03:K1:pY3F8YnfIK+B2l3m6BYnkWH8KFBj9SXQmwbAyO67HA9gWdBZGce M7wUucvVhu+N/FOykNBYpuzFS8x1ZDj5NbJaJUkZkrGKnOcqA89A4eeFdGoNfPgE33YbjrA lKsVqiSbJr0vSX/wNZgs4QV5/hLhPS9ysNTt2rGielj0pHdHyRYkgakqkhxf3z/HS5iXBwc DAYtiPtXKq6Ao5fvz0rsQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:+3Yg8jS244w=:X4zdws2qkbP8M+mj/SWYXV S5gGYl5ulZrI1GddFyZPHplrYzC0yiI4474UC3B+7zJDsjWh1Y2rvVXrMPaLXMKyvInEW+rF0 NSTAgOZpitwI7N8X1vcZTLG4Md3K8axaGQwp5FazQ+ziHtkQ45qQw4dMDSj9WBmny8fCFVF3o JijJKmuigbMCMX5FUrFqWrDA88p8l26KnwX3jYxJ6EZk9PqJ01CwjmAMDVNfeP0C3MfidKWv3 Wzcvp59/k0kiJJ5RcbTvRYyjE/pgPZYaq09b9T5QjVvHbUE6VyTvtA8K9wRbakLDXP48TRFuQ p90Z2h5RjLO73QmNSQV9O+VH1FhkeSzF6QGPQE86SpeL3sZA6N/+dIauLXb4H8BjYLlJtEJQK WvD+aE+h1El+vCQElBdrEVAoy/A9mLjp2pfcQEDO7jxGiCVoNI+rg7oBAswkgi6JOvDEPocIK v4xH0hPCyCOMOAk3dMquEr4k5GysXaGaLO8JNDCqR5p/ZKKLOactPPecAW6S1buS4SoXjLXAD iNQtIXEBvx2ErLA8v1Vs3IQ1oXg6IUZfeI9bR2T11kAPZc6Ox3j6+4YH5Dlv4xNDzgoUfYnel 9Z16dK+1+wW/cL7DPvatCvogVOL1pFxVCRKwRJRNV3uUeZIXEZ7VXvhd4I/KcGI0dWiAwHdLx sVyunfrGwBN9mw8NOnAmElrIJERUQ+tNmfwMmZ47iKuzuTg4M9e00Sn5QG8/ZyqIgea4= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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.9.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 Jul 16 16:10:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 142056 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2604694ljj; Mon, 16 Jul 2018 09:12:39 -0700 (PDT) X-Google-Smtp-Source: AAOMgpel9Y++a61RU0Lhbz3iUVVp0+ONqx85gUwFK/+k+eP/mVXeM8eQOvZKKnI6YRGtXLD7ZkTq X-Received: by 2002:a62:675b:: with SMTP id b88-v6mr18901346pfc.24.1531757559192; Mon, 16 Jul 2018 09:12:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531757559; cv=none; d=google.com; s=arc-20160816; b=WwGXlLZe922Zkq1bs/+SnCEcQANDWghjoeu78FgvBizNGn6fFopxppLOax5a70oXzi s4vW7hEFFKs84WofaMGqBWo/BADrE2SmaGCWURGt3wTRcesY1GVm26i/ASkWzHrRrx0V /GT0mxn7/WfXgCE2NZQ+7jIMBhThEve8BEIK7iynGN5Q8R7Oli1MK4GMv0RuIGT96iXF UthtlY9D50GmEoe0wjD9lb0+0/VBT9T5eZVprqV6K+nAcUZ2wXXBSMgU7kal/WWrcJWR pt1LoYkMWXfsoA+Lba/Lr/RAXytM48cF6JY5+OvmK61cm8IuPu+vUeh+FSTVfyrPMu/K Tjmg== 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=2A34kE2Ku2h7zZQ160gz8q5+ClIn1SKOzXl12K8m970=; b=aAnkmNjVxp513Q+GrS424Pb8z8/FKwTP5taVeF2zjbemvtszJNz+FKQyUWbqGlWGBV zJLbIhBoE3MCWa8hEa3lLMTg9/uDogIfo1NZiveu5B5GZlb/Q9T3nwPSSFnLaEWYiZ0r 00frDIlPCoOfAJTCQKkgRn6LEk3u5M1K2w+3enc+p++vKt6c2DRgrK+6scRwwJ80nqPc JalHaQirKARPLtJEA9E9ctKDvnCEsER/eNAn1YCr2+J9ra1v/v105X/mbyr7uVQ3GY7U qZ0n99ClAKUOvaSj2GgB4u5WR/QLM2+A9b3VGs7bh9tWb/zDIRzMtl9zJFA9rmZdlntc LKbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 k7-v6si27948588pgq.548.2018.07.16.09.12.38; Mon, 16 Jul 2018 09:12:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730304AbeGPQkn (ORCPT + 10 others); Mon, 16 Jul 2018 12:40:43 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:36868 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728794AbeGPQkI (ORCPT ); Mon, 16 Jul 2018 12:40:08 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0LnHlS-1gFpoI2wW6-00haLo; Mon, 16 Jul 2018 18:11:08 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, hch@infradead.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, albert.aribaud@3adev.fr, netdev@vger.kernel.org, viro@zeniv.linux.org.uk, peterz@infradead.org, dvhart@infradead.org, ebiederm@xmission.com, linux@dominikbrodowski.net, Arnd Bergmann Subject: [PATCH v2 04/17] asm-generic: Remove unneeded __ARCH_WANT_SYS_LLSEEK macro Date: Mon, 16 Jul 2018 18:10:50 +0200 Message-Id: <20180716161103.16239-5-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180716161103.16239-1-arnd@arndb.de> References: <20180716161103.16239-1-arnd@arndb.de> X-Provags-ID: V03:K1:7UWkSc8DtDMfT5GS01knjGBP+h0TWxFJq5nCcmNeLZFX1xBbcbE Z8ghqLxSvbIyXrWXYKEwahKsdmZKRq2kc0Qnc8d9uQjo/alu/FCS0f4EU2cCYw+NUAAkZrT TpKWjooFCb0C6hxrEpkDNHkdXtyfB+6jlrygPCdVzHTZjR9PabgYiCS4iW+77q/aJWYePK+ fYGYY91WuWQnwXvkl82gQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:gAgHxspmRH0=:YordqxV7dDMCVb/3nFKhXU nZGtlV0KvA0qW9nSN1/Du0p7GyqX4H0mMO0gv+25AKIp76LgheI+d20SOc/iRFGYNzZjs78CF F3vxjNZCGLNqwBCYncfV6jbRIqvaJw7tAuYfwrixK8WjbmBiBLREygSLNd95UqJYstV7hjg/h HB+qrMP7DntrWfwe8W7z+ca2lEpSyZrUO26TmplwTlDmPCO7H1TiDtKXgTOZcclePQjK59kh6 zo74Ia6dV2HOhrk9TCAyOOYfAj2Z34QtUeGhODN5oSD23i23Uqq9rOoJlC8+b/VJTxDOR8ICo BfNYLs0oSUbjVcYwUmkZMPr6mRchDsDREBQ7yitzFwsObgSdssNYwWnBxhQaj7b97uZaMwsH1 E8Qg7hGDNyYPgnyEb4cudffp9Tpn/qfyeRrCQsKZQ+pNkLWqSZcCZixX7yzQOwXjQ1l4fAH0p q1iQDIRQzTMAvYU9SEqpnh7XGNR/xjnbf2eFReEzHdfD2jrUrA1wLuqh3S5et+7CQgiMnzjT6 Ja7Y4PMH9ORWBwzPtCrrp4K2YkJpX2ai7tq4B1XBfb2336CURD+7wRPLEK1xlqpoTvC3ciV8I byCk8Vsd7jRriqN0bg+Fya0b5yTdgl4caTXQrme2YBYjD7i6v2F0GTRGkY8UaFZBUQl1H6bX+ 3/hrhVU3uRH9S5Q9NxK1nhlKdJQeyGWxDncANOFriZCmEaaSzXGnqM8QoGENV9ZrHXt8= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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 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 Reviewed-by: Christoph Hellwig 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 Jul 16 16:10:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 142040 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2604012ljj; Mon, 16 Jul 2018 09:12:00 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdIFtKnNbADSDSEw+VTYKRy05Q4H9V1zbQelnpU2fDHGQL1kGhVadG7zdDz+IfRRPicorfE X-Received: by 2002:a63:5d09:: with SMTP id r9-v6mr15815722pgb.303.1531757520262; Mon, 16 Jul 2018 09:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531757520; cv=none; d=google.com; s=arc-20160816; b=G52GOOiwBBIuDkagMhqjBMAQuBgIhdoGklwzP7+B7Z5VH3HQoasWV4LgQajrxB1Jv4 HmstsHT/SoLm/GRgAQB+cqLlzxvqBaY9rVpdpQse/azTZSD6EKil6kYghUayk9t2+/Fg sRjt0BgkkZT50XFbAQFml8e5f/nCySWfn9V5s8sTulYQMbdhY9Bztek+nt2hvzTgWVKV +PbrYUDdWXKyOrYnZ2GWFrO8GdEIM7KTs7Q0+MGgG0tSDETm7uZFv5pdvku8pIKkP0Oq rGWOshbbjuu+ZvX77T6I2TbAR5Z/uxa2KCS+fxEGHfJmGSnYXVj9h9mHpfbea9O7Ikvp vsnw== 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=6PCetevrWYZvGNLi2gm6bBVctHkkolEnb0pEIoemcAk=; b=ZYLdMxZpqnBYoOf2bVbHTCB+WRw2WI91p2YCeYECLDBmtUKtHMRHq6fAMDsLkCOazH CxKOyzrHD73eDy1+a3GuwgjNyGFdg7x+JA8y/wq+7qSok/OkKNhdGKp1SGIsAWX3kDMs LbDQ0g6KK9lKdYxQtNyze5DcmqJfXa01scqncaB9n15gy0f70p9vkVgJzFV4jZgnPE0E fri2rI9K6sRcJ4qFHdsa7HqQ8jWWcQaJmKpSNzP2MgpwJS8h0r4A3tdOdyUzZgxrdfHF Ne/n87s/AeQ23DLgv8UpnqkwSQEjCBr69XTSNG0hn+m5QBfzQpUyNORf1KJ/5A6ze7cj uRCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 x18-v6si30410996pfh.84.2018.07.16.09.11.59; Mon, 16 Jul 2018 09:12:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730063AbeGPQkE (ORCPT + 10 others); Mon, 16 Jul 2018 12:40:04 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:56147 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727970AbeGPQkD (ORCPT ); Mon, 16 Jul 2018 12:40:03 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0MOHTM-1fiQ0H0ywO-005ViE; Mon, 16 Jul 2018 18:11:09 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, hch@infradead.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, albert.aribaud@3adev.fr, netdev@vger.kernel.org, viro@zeniv.linux.org.uk, peterz@infradead.org, dvhart@infradead.org, ebiederm@xmission.com, linux@dominikbrodowski.net, Arnd Bergmann Subject: [PATCH v2 05/17] asm-generic: Remove empty asm/unistd.h Date: Mon, 16 Jul 2018 18:10:51 +0200 Message-Id: <20180716161103.16239-6-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180716161103.16239-1-arnd@arndb.de> References: <20180716161103.16239-1-arnd@arndb.de> X-Provags-ID: V03:K1:51hoQvFD6pnpevcyPFmV7xoL1+ZwtXT6Qk65hazo10UHnG0a4JI jLYkUIPwDkP10r/Fab/8VUWj2Bz+0QZiAUPfrbBL1t1eLmzcqsfZkF/K/dldeWBZBuZmyjL wWPPAylAc/VhSOhOJJqULytpNlrEyqwxE7ehgFVGghFdxXbEkeKCCnhHk/5RT4tlVSNCZPl TBa5PS31W6gZnMBSQGpNQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:BILD6LIWm0A=:5BEm5ASej8O35gW/QwSHcG 1RUY4roJhmOEcct1PP0Cq4bd2mrMo23g1MOG9jhlAyqYIOgiKIfgcHZV8RmbS2uqLgXBoQzKc KM5Y26TwWQS5A3n/sy0pX0eDpkp8H1VRgV6sp2Kyz8XdeDcNASKWesyXxJmupUqMvVwpeiSGw aDTAh8ZJdZJcndIVNvJySI/XCr/yn9Xcme7q/VNDAfpxaX42P4UAkuwJ8OiAmkZOKkeNn5zQg 5p0ZvMt8O0BRG4ztUZiJxk5AjGeYzmMD0ncopZBTD4J8EPU62K0LaYmD/2/+CFi0ESUX4oUp9 HQk4lGU1VSzmyrsEWNgCCAKs9DfUNMklTmWGBiJ6HwNU1UNRnfEevoVuMwJRxVQ7uwr7qJOS9 m/BprcHqFWzTCYpOe9JMw74dY7tcOWN+t13lxRPpuSj+Hf3PfM5jd1nxiDJV9tWonSFhWk/I+ cvlbeYVicO8Pa363bQuOfTjU7TbYrGebzriIppxhY8zu5satjKgK496KYQd7Ob4yg8ZpbXa1a JbfdaVgOW+giHhN8c/Mf94bvwOZRQKFVn1oucJXeX2OzI2y6Tx/2/hXsECM2ySewuXmYUwRtA lW3WoAqS3jjfRE6OAcumzR0JQEWYDv4jqYKOZiD9KjGyLkhBWa6P08LvnSFbAlpCzNCfVAgC2 2EMtPUkkWz249V84kuO7aL/sbK8KcDu+YU23zgQWAPHW8s4g1iTmfJMy2nhPswlQZcGE= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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. 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.9.0 Reviewed-by: Christoph Hellwig 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 Jul 16 16:10:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 142043 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2604107ljj; Mon, 16 Jul 2018 09:12:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfXlJsq7TnYUbPngqJMdV8e9ZvBjIS2/kJDiOJfJHWTp1ucoRPKKJd/pFY2mdym+75HODhB X-Received: by 2002:a63:5c10:: with SMTP id q16-v6mr16016805pgb.452.1531757525060; Mon, 16 Jul 2018 09:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531757525; cv=none; d=google.com; s=arc-20160816; b=v8hXheDPWverywRDHV69ZM/FQXPGGgP0zWtm517Q0gKMh4/XT1NV1NoHurKDHCoepJ IV9WcLe2gwxKdwbnwA+DB+55ASP/gAg9EkXgCF3WT9SS0j65Ayvk4TgMqAmkTlQ14a8i dToZXKPDyj5VNuAIxHvXd7OyWGCM45u4rqzPBQkcptmL+uS9sYXsvhPOlgyYJDDWtadL Do85NtUHJwyBguIb0q8TG+ucHDakT9r1t9UVx1Q5PAR6W6N/QRKHQjeU3wNANQA5kY/E yG8EH5/S3Zs7BYl3QbssmL8vmB+m7ljZSUoRLS7tT1Mb9I/4RRQibf++HW1QXFFniRay N6Mw== 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=OlECP7fOxVe8dNo6xDpLknyaDUc4A/y5FGLEtPWDcLg=; b=N8PL46NmlodaaPKr4wyTlYD795YoppbLdwDsZz4EjMEuc1MdgrcoliguhIJnd2d7wX s6+ZJtGS5ypV+2+7jpdJDPz5YKI6BmUtaIFhIz9keKq2xkLNUpM4Ze8XhhHICUEneGGx 3C3xshR/rracYKNnBtS3/htht0XtlhLzi+vgbdrzUn229DI4ccxGkNLSdVb2BW9g9RkW Cdu914nzCMyE3R/fKg18DFJXP1sfe0qDGD+pR+Th2CcjHlnPMye88I5TSzel3x7jA3N8 PU8V+fR2X7kAGxoLrg7K0/avRKzY18dnj/pJ2XzmgfQv/+c1hzC4+GJlZGhuoi6+wyLN Sayw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 x18-v6si30410996pfh.84.2018.07.16.09.12.04; Mon, 16 Jul 2018 09:12:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730710AbeGPQkI (ORCPT + 10 others); Mon, 16 Jul 2018 12:40:08 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:46951 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730079AbeGPQkI (ORCPT ); Mon, 16 Jul 2018 12:40:08 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0M6t73-1g05JT0wOT-00wmvD; Mon, 16 Jul 2018 18:11:10 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, hch@infradead.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, albert.aribaud@3adev.fr, netdev@vger.kernel.org, viro@zeniv.linux.org.uk, peterz@infradead.org, dvhart@infradead.org, ebiederm@xmission.com, linux@dominikbrodowski.net, Arnd Bergmann Subject: [PATCH v2 07/17] y2038: Compile utimes()/futimesat() conditionally Date: Mon, 16 Jul 2018 18:10:53 +0200 Message-Id: <20180716161103.16239-8-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180716161103.16239-1-arnd@arndb.de> References: <20180716161103.16239-1-arnd@arndb.de> X-Provags-ID: V03:K1:AIKjKnAv/8yUsKblZ6iCmDsRB5OJVhUFV1UYn2eDpG7tHQ7bZwa R/Hptho2x6kRu8YU1OQw3VGim+sMYzwAdsYka7+yC7RtPoNEBcWdPkcy0glwKmsGzifThK+ UUAkF56ZQ64NZeeoFodjieCM4wFfPqJZMInqGJnezdmzeiyHxF0gYtg9KZhuMsh8qupmXLY Ji1iJA6PdIESrc4ryFaDA== X-UI-Out-Filterresults: notjunk:1; V01:K0:3jUKL2eKf5c=:BtCnuBOB2lDJ0zaf9iR1ep JxCR2IbsXR/EfTKVWUTtozBl8cCufgTH1DdSRbo6rGhVaiDorS8spTQJvxawvQOcocp00q985 nVzZB3njAhGjz0a3BW0LSW9XblnNYPbO+zmcpkhBG8khp0YV7YNIjfWlRWdcJ2QFHxPQEzqBB IXfpntTkC7RkjSRB4ZhlskDthbtI1ICMaLCY5sG5Lic8uMRux6XtPrAIbxSuaEVHRWqbBJs21 ONTryp/WeeG/jM1ThiDtsn1BJJZ3M1IUNnoEbIGJjgQ5qQKZBF4QicrGBoKOdZb5ZzoM4qHel Q3c3sz/Eo/hNTU0EOd8TU1IMUARxjvsfGNwolBxLD76hvhyeCib+k0HC6xxwYv76chKKILWYx aewDmwm+nkJX3tWGCaWyGglQbT4NQ/twsGubOx6hdGluY8eX4rw/sjjniMWj2/gURk4OdVHBs 1zZ0aDiSvJfx2jQWaDRjVrfk1+sTfECmUAgxJYuIc/+T+JXHsnLQTC9ujARrLJE6VB/zL2zr2 VPcIOQTroHj90dQADOPcb6CIjeMMrye24ak8JTJoGuxFyKn8A3DR+BN4z5dkkEZWGP7gQb1DM SdR7bUU7ofQmDcztOgltp8KRg9c1gLiArxgICTfaNapj+sWRmrq2xgW6wCmUtTEQnZnQL2+uK JLN3HfDgIUeFN4BO/j9VuoxUZGevg+32QkEapAcuB27OQPc6Qsycl5oo0PPkqT6C5/DE= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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.9.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 ca2c02a7985c..ebc7fb713d91 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 45c04d75eb95..312c248f1fe6 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -965,8 +965,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); @@ -996,14 +994,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 Jul 16 16:10:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 142045 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2604164ljj; Mon, 16 Jul 2018 09:12:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdrLP+gu3oMSSgUXkwUda/nr5X9omdWRe80MFhYJPWytt0/BtcAylkfBejDBcAoVNFrgmFn X-Received: by 2002:a62:57dc:: with SMTP id i89-v6mr18661684pfj.65.1531757527946; Mon, 16 Jul 2018 09:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531757527; cv=none; d=google.com; s=arc-20160816; b=a77KAbazmfL0hDS+dqb33XNq4XiFoBwn5Jd3mz8Vn0tKbL2iB3mFIWV96u4fbjIRBa AeL36PG29jsk7dBVkYmaUvxQwj41vVkplpQJY6HH8BxzTR54NmN/9CRB38Uk0ob5fnjk nhgN0D4lio1PFCu3MxYjwX7UQjUyl1Jh7lM6WkxxP6sMqnisN4v8i42GhepHmhpVZ89m Lc6NDuHv4mAW4pNDPWE+aVZYSYM4cmYjk/XNTWRN0lCuFuMJdmWF6RhzoDxKjIK2fEKM 23EPeWHKuim/T0j2pv94n2nuINw8IBnMoi8ckJbYVHe6tOwKA+Xdn3IaByzglNiY56Bm TnGg== 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=IwH3xqdAxvnjO23XFtPn6AuPrPHIM3PrZwyxlC4Hldc=; b=zMeGD2lYgTybh2ReLg/p28baKhSoHVGRt5mtr4tMuM5Q34s2fbY8xhh3WPpzypQf/F gG/VkguFlfPqqNz/dMqWAl6Lb1Nxj/YmSdaaTSeoRnFtA2ilqtxQQo+ASLDbh1x5YkOf GbP38ygVmXzYTIUNWxU4L6B/a+HRh5wJKxApj4Seuii7+RLonUWuUXLEjWj+f3ton+0U JMguARy6hvYFDNcxV7hlGFwkSKERYrfO1dFlnqzS7wrQZ58l0+H9O61lxhm2IzR/K+G8 Nik030tuUmmSfNhdUDQN2Rwrx3aNXlPOOeurjxDtfT7SeQj2r9ivxOMPiMOvdunfWD1z NyIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 x18-v6si30410996pfh.84.2018.07.16.09.12.07; Mon, 16 Jul 2018 09:12:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731012AbeGPQkM (ORCPT + 10 others); Mon, 16 Jul 2018 12:40:12 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:35478 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730079AbeGPQkL (ORCPT ); Mon, 16 Jul 2018 12:40:11 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0LqJdN-1gIqcR2zuT-00e1aJ; Mon, 16 Jul 2018 18:11:10 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, hch@infradead.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, albert.aribaud@3adev.fr, netdev@vger.kernel.org, viro@zeniv.linux.org.uk, peterz@infradead.org, dvhart@infradead.org, ebiederm@xmission.com, linux@dominikbrodowski.net, Arnd Bergmann Subject: [PATCH v2 08/17] y2038: utimes: Rework #ifdef guards for compat syscalls Date: Mon, 16 Jul 2018 18:10:54 +0200 Message-Id: <20180716161103.16239-9-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180716161103.16239-1-arnd@arndb.de> References: <20180716161103.16239-1-arnd@arndb.de> X-Provags-ID: V03:K1:JY+Std/jQm+mN0iMWogdbWV9/JM4AOLXoILJbsB4AmEaKYkxtbP e/6QaNrAbt02s1ZbvPxCmly5k0o4pSmyJTRPsZChiulpQ91xoQydckoWzCmH4/Lur9oMGoF S/OiEiCBjMTrvljfUspbHOp9jnc9PLo3yq/gT+e3C/5adoRwiuh89tyPEnZjLQddCF8r0RF z20VtI4pjO2v1XDURN4BA== X-UI-Out-Filterresults: notjunk:1; V01:K0:7jz0qRybv4Q=:Rbn143lSd6Q6DGDxbqg8Zh yT8ay+SDhRuRkWnYxNVnsBqBC+VYpFeNVuLZUFe9Gm8ua2GsvpaLskeLKXPIXLjOurFLk44l3 uoF+GW4lrbK9WgHyAM5g47jiCgSCREnIRF+oMj2NK9sVvxM1/S9F/qw0HJ9fzymZQF5xmBV+j 7mpFxVezDcJs8HQq3CMDV4TdaeCK7AD5U0PMvTcv0+kv4THjt64vT6Ki/4Mk7YwfGZzPYsyxB 6l/S1MdrYpAV+wHrc02g9mvFrYoT1GijkHsEDzNb7wjB6XJoRXFehbB86FsLvbpCtYDoQfCmd jaWmfYUBtFqTha9lu+XLoLQONd6HDeF1YhiO23sapdfqu5P8bGtrG43TEcKHZsV+l1kESGWGs LLSYlJrlfJa7fffWuWV01RAHGIyTH6wG0nQgvt0huLq2s6Z9l0z6uLPOCdcJ27xRwuc4KUk0K l/igbADcpl81BcZUAOCEXWbjUcjqGE98COnWA2oP4daESzkmr0DWKDEPRlRyn849fGPq8/eMJ 0PhtRYeAbVKogNPYATtq0Q90fg2eUMliEGX+jFt+Sqm6O24wHtal0V6eDQ/R10b/NAZlJkBL4 Rsfq+CTKGzQRMaqOS8XFgraaUkeLPfn6rTLmFn8eambvZnzZsHBLyL/1SiliPP56FtPB6OqBq 9C0Sk99jnXHYGe++qVJTXoNkgxQ6wAXzAcIW9onca/9MKYFxsNnmPYvEbv84BuaDLE7c= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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 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 --- If we proceed with Christoph's suggestion of renaming all the compat time handling to something that doesn't have compat in the name, the new macro here would have to get renamed as well. --- 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 2af308f13463..17f2211e20f2 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 9326c9133516..51e56d85815a 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 c40bc39fe05f..ab0b1f48dc5b 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 { - 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 e70bfd1d2c3f..df1b2c638f32 100644 --- a/include/linux/compat_time.h +++ b/include/linux/compat_time.h @@ -22,6 +22,11 @@ struct compat_itimerspec { struct compat_timespec it_value; }; +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 *); extern int get_compat_itimerspec64(struct itimerspec64 *its, From patchwork Mon Jul 16 16:10:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 142047 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2604204ljj; Mon, 16 Jul 2018 09:12:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf26biWypgt83TtV1BRYQuJYsUK0uJDWc120DPDSNqGPTpFupbI9Vp4rESaInPkc+Qe6852 X-Received: by 2002:a62:4308:: with SMTP id q8-v6mr18939551pfa.86.1531757530548; Mon, 16 Jul 2018 09:12:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531757530; cv=none; d=google.com; s=arc-20160816; b=OA9W/b2GN+713SsmqkDdCzu6xYn9CH7QBIye1xvFGs3hVwvFui1xW4/+YLrbtFc/tb 4mi2CNbkdG+K3qbTJFYS8w2r0vBpQ6chlVDvByBvv3UHADl4n/JArw/eGcPP0GzgcWLZ 1kERQe3LM+Uk/8jWR6flJPRmzSgDGqL282FW+3YES3gheUppZqeaJfuqPlOhJZYFjiZ8 j2VcnReMa0kRj7u5hT/V8jEHkd2mQZEjleF/si3bqI6KkbuuXqMbOP1x8BlH2hYRepZZ 3EvMCI3znGpKFw1MKDTif66xy1KTkM4+ieBd6rzYBbKRsdNcVrA/cXX5Itu/Y+LbtpIX nDsA== 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=+ebaR0Hlge/KfMdjinA/Vn4S6UmxI0FOFPhykmF9yPM=; b=UNKLqEw1qk3yGKpRKKv0tvDImeYh0wQCm5BWGgFOKadbEBdOtYkDUuun/DQwyUF0fm KPGE3BcVUpmtiQXcGuyV46IoNG+DM4+STDIl/T768hw6H+hYAUj0l2ieHoGdZCwndBxy zN379B8APR9zQaF6t2zBcz2wWvExzo2kCHEXaXMorEOp3uVTIVHGn1pQnDjoxTRcwjfl op62dp8b2oIJBqgoX3mj1icQQaROkHCIL7nFyLNRk91pF4nHELk+if6Mn9wo9I3lPLKk 2Xym9MFWkfAo3SsNpl6t4b+doRZCLXGjqRl70LvOpWsiqh5fZgNoY03kKmhiVs0Fl66O 3Q5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 x18-v6si30410996pfh.84.2018.07.16.09.12.10; Mon, 16 Jul 2018 09:12:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731175AbeGPQkO (ORCPT + 10 others); Mon, 16 Jul 2018 12:40:14 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:47067 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730621AbeGPQkO (ORCPT ); Mon, 16 Jul 2018 12:40:14 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0MTrXg-1fWGQ30pdY-00QXBW; Mon, 16 Jul 2018 18:11:11 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, hch@infradead.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, albert.aribaud@3adev.fr, netdev@vger.kernel.org, viro@zeniv.linux.org.uk, peterz@infradead.org, dvhart@infradead.org, ebiederm@xmission.com, linux@dominikbrodowski.net, Arnd Bergmann Subject: [PATCH v2 09/17] y2038: futex: Move compat implementation into futex.c Date: Mon, 16 Jul 2018 18:10:55 +0200 Message-Id: <20180716161103.16239-10-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180716161103.16239-1-arnd@arndb.de> References: <20180716161103.16239-1-arnd@arndb.de> X-Provags-ID: V03:K1:Kgt2Q5fIjXWoSGBaADrtlyO2LyhMoi3DhtgqeXhR7MiUTwSame3 xBlmJ9rBh4wHT01tc52GDpnWmLnFxZfWVYwnhUm+K3IBk6A6mP+ZFyDm4yI/DzezmVswM0H brBfleLR3SXyT/vqQiQYBh2CfdqMKg8iU2Q+1Wdj2hSUDRAropbidYSRSvXZeDGtK65A4Yc ahEswYU2o3xdWhnCQcYRw== X-UI-Out-Filterresults: notjunk:1; V01:K0:KKIs+bEbAF0=:+So299GCu/sS05kGhL+fdb J6nOS+lHm/i6voNu+vpRImn/43QkIN/YdN4BeGQAYwEQ2H5aAy3H8iaoucftNVJ164ARfeExt n6tOwVJ+aLOMsY8oNdFu7Ef7bpR9XJFvysS9WeqUMRKNxP/xFfHZBhMkLZgKxCCtN1K3kQkd0 Byki7bVUSJuq99+kBLMFLTLk0obCT+PMszPQv+3jmwO1fdviMqlmOT9X6Fi/z/lPMyZLrm6of Ohj4rOduLqk/dY4h4m1eLBoK6B9EmR7YYw4qYO29nEbBvfwyv/7i+aVV26Ebjo6EyfIjd2eUs EyX2/17QRgiZgZRX21ynXii4Wm/dhFc4/5N6osW7hSiAwBmNVQRqpGHeI+F9mFzdnYuPoLG86 zgbCYDB00+DobtmwAl95NAlHAGgfxWswXgtnCKQEnx+xigtE4AGHO4uMpBN4Zjv+kbX1hfH9c aXwKxQ97X0k2ocYH0Zb+LM3u19CIHvIrDUyyqEc9KNmdqB5EM+KXvpPhUtTb3Ie1vvUjnivMV JmSN112Of9cgQ2qJvvCDbj5iEU9TRHpv5tr14EBLQKns1wZlZT8MNKmthyKT+V0w0PIOQSCjq ggcHsAzfU49GE4ZiUw9/cYkZiKh1aG2nJj9jWKlbOn84x/l8mzM7zZeDWFMD5Uzrg7E3yGnuU jUdwNGZDjtRP08c5xrIEsaFdZcvP8ywcQDvIfDfwsFnwmNNP/iNO5K4WB1iX9Hc4uExs= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We are going to share the compat_sys_futex() handler between 64-bit architectures and 32-bit architectures that need to deal with both 32-bit and 64-bit time_t, and this is easier if both entry points are in the same file. In fact, most other system call handlers do the same thing these days, so let's follow the trend here and merge all of futex_compat.c into futex.c. In the process, a few minor changes have to be done to make sure everything still makes sense: handle_futex_death() and futex_cmpxchg_enabled() become local symbol, and the compat version of the fetch_robust_entry() function gets renamed to compat_fetch_robust_entry() to avoid a symbol clash. This is intended as a purely cosmetic patch, no behavior should change. Signed-off-by: Arnd Bergmann --- Regardless of whether we rename all compat time calls or not, moving the compat futex code into the main file helps us clean up the implementation. --- include/linux/futex.h | 8 -- kernel/Makefile | 3 - kernel/futex.c | 195 +++++++++++++++++++++++++++++++++++++++++++++++- kernel/futex_compat.c | 202 -------------------------------------------------- 4 files changed, 192 insertions(+), 216 deletions(-) delete mode 100644 kernel/futex_compat.c -- 2.9.0 diff --git a/include/linux/futex.h b/include/linux/futex.h index 821ae502d3d8..ccaef0097785 100644 --- a/include/linux/futex.h +++ b/include/linux/futex.h @@ -9,9 +9,6 @@ struct inode; struct mm_struct; struct task_struct; -extern int -handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi); - /* * Futexes are matched on equal values of this key. * The key type depends on whether it's a shared or private mapping. @@ -55,11 +52,6 @@ extern void exit_robust_list(struct task_struct *curr); long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout, u32 __user *uaddr2, u32 val2, u32 val3); -#ifdef CONFIG_HAVE_FUTEX_CMPXCHG -#define futex_cmpxchg_enabled 1 -#else -extern int futex_cmpxchg_enabled; -#endif #else static inline void exit_robust_list(struct task_struct *curr) { diff --git a/kernel/Makefile b/kernel/Makefile index 7343b3a9bff0..8e40a6742d23 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -49,9 +49,6 @@ obj-$(CONFIG_PROFILING) += profile.o obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-y += time/ obj-$(CONFIG_FUTEX) += futex.o -ifeq ($(CONFIG_COMPAT),y) -obj-$(CONFIG_FUTEX) += futex_compat.o -endif obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o obj-$(CONFIG_SMP) += smp.o ifneq ($(CONFIG_SMP),y) diff --git a/kernel/futex.c b/kernel/futex.c index 1f450e092c74..e9013d1e65a1 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -44,6 +44,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include #include @@ -173,8 +174,10 @@ * double_lock_hb() and double_unlock_hb(), respectively. */ -#ifndef CONFIG_HAVE_FUTEX_CMPXCHG -int __read_mostly futex_cmpxchg_enabled; +#ifdef CONFIG_HAVE_FUTEX_CMPXCHG +#define futex_cmpxchg_enabled 1 +#else +static int __read_mostly futex_cmpxchg_enabled; #endif /* @@ -3360,7 +3363,7 @@ SYSCALL_DEFINE3(get_robust_list, int, pid, * Process a futex-list entry, check whether it's owned by the * dying task, and do notification if so: */ -int handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi) +static int handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi) { u32 uval, uninitialized_var(nval), mval; @@ -3587,6 +3590,192 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val, return do_futex(uaddr, op, val, tp, uaddr2, val2, val3); } +#ifdef CONFIG_COMPAT +/* + * Fetch a robust-list pointer. Bit 0 signals PI futexes: + */ +static inline int +compat_fetch_robust_entry(compat_uptr_t *uentry, struct robust_list __user **entry, + compat_uptr_t __user *head, unsigned int *pi) +{ + if (get_user(*uentry, head)) + return -EFAULT; + + *entry = compat_ptr((*uentry) & ~1); + *pi = (unsigned int)(*uentry) & 1; + + return 0; +} + +static void __user *futex_uaddr(struct robust_list __user *entry, + compat_long_t futex_offset) +{ + compat_uptr_t base = ptr_to_compat(entry); + void __user *uaddr = compat_ptr(base + futex_offset); + + return uaddr; +} + +/* + * Walk curr->robust_list (very carefully, it's a userspace list!) + * and mark any locks found there dead, and notify any waiters. + * + * We silently return on any sign of list-walking problem. + */ +void compat_exit_robust_list(struct task_struct *curr) +{ + struct compat_robust_list_head __user *head = curr->compat_robust_list; + struct robust_list __user *entry, *next_entry, *pending; + unsigned int limit = ROBUST_LIST_LIMIT, pi, pip; + unsigned int uninitialized_var(next_pi); + compat_uptr_t uentry, next_uentry, upending; + compat_long_t futex_offset; + int rc; + + if (!futex_cmpxchg_enabled) + return; + + /* + * Fetch the list head (which was registered earlier, via + * sys_set_robust_list()): + */ + if (compat_fetch_robust_entry(&uentry, &entry, &head->list.next, &pi)) + return; + /* + * Fetch the relative futex offset: + */ + if (get_user(futex_offset, &head->futex_offset)) + return; + /* + * Fetch any possibly pending lock-add first, and handle it + * if it exists: + */ + if (compat_fetch_robust_entry(&upending, &pending, + &head->list_op_pending, &pip)) + return; + + next_entry = NULL; /* avoid warning with gcc */ + while (entry != (struct robust_list __user *) &head->list) { + /* + * Fetch the next entry in the list before calling + * handle_futex_death: + */ + rc = compat_fetch_robust_entry(&next_uentry, &next_entry, + (compat_uptr_t __user *)&entry->next, &next_pi); + /* + * A pending lock might already be on the list, so + * dont process it twice: + */ + if (entry != pending) { + void __user *uaddr = futex_uaddr(entry, futex_offset); + + if (handle_futex_death(uaddr, curr, pi)) + return; + } + if (rc) + return; + uentry = next_uentry; + entry = next_entry; + pi = next_pi; + /* + * Avoid excessively long or circular lists: + */ + if (!--limit) + break; + + cond_resched(); + } + if (pending) { + void __user *uaddr = futex_uaddr(pending, futex_offset); + + handle_futex_death(uaddr, curr, pip); + } +} + +COMPAT_SYSCALL_DEFINE2(set_robust_list, + struct compat_robust_list_head __user *, head, + compat_size_t, len) +{ + if (!futex_cmpxchg_enabled) + return -ENOSYS; + + if (unlikely(len != sizeof(*head))) + return -EINVAL; + + current->compat_robust_list = head; + + return 0; +} + +COMPAT_SYSCALL_DEFINE3(get_robust_list, int, pid, + compat_uptr_t __user *, head_ptr, + compat_size_t __user *, len_ptr) +{ + struct compat_robust_list_head __user *head; + unsigned long ret; + struct task_struct *p; + + if (!futex_cmpxchg_enabled) + return -ENOSYS; + + rcu_read_lock(); + + ret = -ESRCH; + if (!pid) + p = current; + else { + p = find_task_by_vpid(pid); + if (!p) + goto err_unlock; + } + + ret = -EPERM; + if (!ptrace_may_access(p, PTRACE_MODE_READ_REALCREDS)) + goto err_unlock; + + head = p->compat_robust_list; + rcu_read_unlock(); + + if (put_user(sizeof(*head), len_ptr)) + return -EFAULT; + return put_user(ptr_to_compat(head), head_ptr); + +err_unlock: + rcu_read_unlock(); + + return ret; +} + +COMPAT_SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val, + struct compat_timespec __user *, utime, u32 __user *, uaddr2, + u32, val3) +{ + struct timespec ts; + ktime_t t, *tp = NULL; + int val2 = 0; + int cmd = op & FUTEX_CMD_MASK; + + if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI || + cmd == FUTEX_WAIT_BITSET || + cmd == FUTEX_WAIT_REQUEUE_PI)) { + if (compat_get_timespec(&ts, utime)) + return -EFAULT; + if (!timespec_valid(&ts)) + return -EINVAL; + + t = timespec_to_ktime(ts); + if (cmd == FUTEX_WAIT) + t = ktime_add_safe(ktime_get(), t); + tp = &t; + } + if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE || + cmd == FUTEX_CMP_REQUEUE_PI || cmd == FUTEX_WAKE_OP) + val2 = (int) (unsigned long) utime; + + return do_futex(uaddr, op, val, tp, uaddr2, val2, val3); +} +#endif /* CONFIG_COMPAT */ + static void __init futex_detect_cmpxchg(void) { #ifndef CONFIG_HAVE_FUTEX_CMPXCHG diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c deleted file mode 100644 index 83f830acbb5f..000000000000 --- a/kernel/futex_compat.c +++ /dev/null @@ -1,202 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/kernel/futex_compat.c - * - * Futex compatibililty routines. - * - * Copyright 2006, Red Hat, Inc., Ingo Molnar - */ - -#include -#include -#include -#include -#include -#include - -#include - - -/* - * Fetch a robust-list pointer. Bit 0 signals PI futexes: - */ -static inline int -fetch_robust_entry(compat_uptr_t *uentry, struct robust_list __user **entry, - compat_uptr_t __user *head, unsigned int *pi) -{ - if (get_user(*uentry, head)) - return -EFAULT; - - *entry = compat_ptr((*uentry) & ~1); - *pi = (unsigned int)(*uentry) & 1; - - return 0; -} - -static void __user *futex_uaddr(struct robust_list __user *entry, - compat_long_t futex_offset) -{ - compat_uptr_t base = ptr_to_compat(entry); - void __user *uaddr = compat_ptr(base + futex_offset); - - return uaddr; -} - -/* - * Walk curr->robust_list (very carefully, it's a userspace list!) - * and mark any locks found there dead, and notify any waiters. - * - * We silently return on any sign of list-walking problem. - */ -void compat_exit_robust_list(struct task_struct *curr) -{ - struct compat_robust_list_head __user *head = curr->compat_robust_list; - struct robust_list __user *entry, *next_entry, *pending; - unsigned int limit = ROBUST_LIST_LIMIT, pi, pip; - unsigned int uninitialized_var(next_pi); - compat_uptr_t uentry, next_uentry, upending; - compat_long_t futex_offset; - int rc; - - if (!futex_cmpxchg_enabled) - return; - - /* - * Fetch the list head (which was registered earlier, via - * sys_set_robust_list()): - */ - if (fetch_robust_entry(&uentry, &entry, &head->list.next, &pi)) - return; - /* - * Fetch the relative futex offset: - */ - if (get_user(futex_offset, &head->futex_offset)) - return; - /* - * Fetch any possibly pending lock-add first, and handle it - * if it exists: - */ - if (fetch_robust_entry(&upending, &pending, - &head->list_op_pending, &pip)) - return; - - next_entry = NULL; /* avoid warning with gcc */ - while (entry != (struct robust_list __user *) &head->list) { - /* - * Fetch the next entry in the list before calling - * handle_futex_death: - */ - rc = fetch_robust_entry(&next_uentry, &next_entry, - (compat_uptr_t __user *)&entry->next, &next_pi); - /* - * A pending lock might already be on the list, so - * dont process it twice: - */ - if (entry != pending) { - void __user *uaddr = futex_uaddr(entry, futex_offset); - - if (handle_futex_death(uaddr, curr, pi)) - return; - } - if (rc) - return; - uentry = next_uentry; - entry = next_entry; - pi = next_pi; - /* - * Avoid excessively long or circular lists: - */ - if (!--limit) - break; - - cond_resched(); - } - if (pending) { - void __user *uaddr = futex_uaddr(pending, futex_offset); - - handle_futex_death(uaddr, curr, pip); - } -} - -COMPAT_SYSCALL_DEFINE2(set_robust_list, - struct compat_robust_list_head __user *, head, - compat_size_t, len) -{ - if (!futex_cmpxchg_enabled) - return -ENOSYS; - - if (unlikely(len != sizeof(*head))) - return -EINVAL; - - current->compat_robust_list = head; - - return 0; -} - -COMPAT_SYSCALL_DEFINE3(get_robust_list, int, pid, - compat_uptr_t __user *, head_ptr, - compat_size_t __user *, len_ptr) -{ - struct compat_robust_list_head __user *head; - unsigned long ret; - struct task_struct *p; - - if (!futex_cmpxchg_enabled) - return -ENOSYS; - - rcu_read_lock(); - - ret = -ESRCH; - if (!pid) - p = current; - else { - p = find_task_by_vpid(pid); - if (!p) - goto err_unlock; - } - - ret = -EPERM; - if (!ptrace_may_access(p, PTRACE_MODE_READ_REALCREDS)) - goto err_unlock; - - head = p->compat_robust_list; - rcu_read_unlock(); - - if (put_user(sizeof(*head), len_ptr)) - return -EFAULT; - return put_user(ptr_to_compat(head), head_ptr); - -err_unlock: - rcu_read_unlock(); - - return ret; -} - -COMPAT_SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val, - struct compat_timespec __user *, utime, u32 __user *, uaddr2, - u32, val3) -{ - struct timespec ts; - ktime_t t, *tp = NULL; - int val2 = 0; - int cmd = op & FUTEX_CMD_MASK; - - if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI || - cmd == FUTEX_WAIT_BITSET || - cmd == FUTEX_WAIT_REQUEUE_PI)) { - if (compat_get_timespec(&ts, utime)) - return -EFAULT; - if (!timespec_valid(&ts)) - return -EINVAL; - - t = timespec_to_ktime(ts); - if (cmd == FUTEX_WAIT) - t = ktime_add_safe(ktime_get(), t); - tp = &t; - } - if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE || - cmd == FUTEX_CMP_REQUEUE_PI || cmd == FUTEX_WAKE_OP) - val2 = (int) (unsigned long) utime; - - return do_futex(uaddr, op, val, tp, uaddr2, val2, val3); -} From patchwork Mon Jul 16 16:10: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: 142052 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2604470ljj; Mon, 16 Jul 2018 09:12:25 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeMsTkFWwJ4lwUHQeL3XVPtyD4sh/CXn45ZJk//spUvHrFkhzVN1+EnTGPfnkTBGFGxwD4q X-Received: by 2002:a63:3c0c:: with SMTP id j12-v6mr15831509pga.440.1531757545624; Mon, 16 Jul 2018 09:12:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531757545; cv=none; d=google.com; s=arc-20160816; b=BCQprWUzl04bCWUYYexlmPU725xcKqOHz4nKA8bkNg30fc8ZGhAKc0jjqMJg5vGshC zEqd/jtuBYNkRG3eu02IVfBIXveeLaNFi8mZPR6Qqt+bS4/WGl25BXQYc3oDctgSf4zW x8DUS8VVLQDr0DswAlAEPOz1QyRJvRN+S3yoyLnW6ru+pxpfmRoWhIDFVY4whcRzIByC Zj54SUNmLGtSNQ8AW1isSNu3SA4DoMl1qD5kHvFGqqGmvK/iJk+ThTzpKkFrQcmFrDaO dGOwGBKQE6eEflVn3ZAUsuKvN5BzM9XrqJzk/jhJr+RCh8hddQjsiTrHvALGTZDRS9dG 0zvg== 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=QxNMuqkZ3ovgxhi8bOveNI2F06Gt6inRaUk0Hke4ewQ=; b=W51hYgLgRjRJOqtGVqm+lYcRiTw9tB41NI8N0kKynWrkXGGIQFL9olmuByirLiIzns 3lmVqpB24GUzAwN9V8TP/ACjOa20HdQ1k1ciuAyvbQwZVThRR3EJAfmN0kkW7O3EKMO0 dWHFxDu4OgbKWnvzfvCf4xEQibrdZ65pdSrwB93AhOCHoqUlTk1hF/p25tvVzRR/J4eU zGn345+tRA24e00VVgaCSGR7LkX9LPPbzORmK42Zjw1cPbre4cZsL8u7LFHg6e30oD3W tKeQab6j53au5w4QwxUBcAt/NwS43oobWWxKluATdlNs2qff7s7hivWzliVZHq24l+zn dLQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 l7-v6si30064885pgc.650.2018.07.16.09.12.25; Mon, 16 Jul 2018 09:12:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731239AbeGPQk3 (ORCPT + 10 others); Mon, 16 Jul 2018 12:40:29 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:41887 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728300AbeGPQkL (ORCPT ); Mon, 16 Jul 2018 12:40:11 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0MKgZn-1fep6e2pol-001wwj; Mon, 16 Jul 2018 18:11:11 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, hch@infradead.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, albert.aribaud@3adev.fr, netdev@vger.kernel.org, viro@zeniv.linux.org.uk, peterz@infradead.org, dvhart@infradead.org, ebiederm@xmission.com, linux@dominikbrodowski.net, Arnd Bergmann Subject: [PATCH v2 10/17] y2038: futex: Add support for __kernel_timespec Date: Mon, 16 Jul 2018 18:10:56 +0200 Message-Id: <20180716161103.16239-11-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180716161103.16239-1-arnd@arndb.de> References: <20180716161103.16239-1-arnd@arndb.de> X-Provags-ID: V03:K1:qXNVyDZCrYx+HhRT/7b6IG95YRXh6WE/UB5jbxdkhxM9kyxPquh 0USH2T/mQoyZv2cHtoW2kFdMq9JySnjecnZtlLP7BxT7WOegHw3VqoyAQwRNPPg35edSaI/ eQv9gatltOBeAr4R7FxFz412jU1oZ78qTrMMmOGMKFg6L9782zk3s8gb+PgA9uPaiMoBtA9 XUNB+fw4JjX32zfuBa6SQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:WMH+hWlI/SI=:pCZ57ecD3rJpMoojHmHisU OFvhKnh2XGDp6ILJA+Y4ZUbjB7O4kq8oGeIpPWaDsOQj8Mjw2DDTdQMKCkh17p3lxyknunHHb KZ/dNwZ2Lgo0oIQSAUjLf/NUZmrD9u09zWP2jvEdPrGi3UZb8fGhWrknPGjTxp3mjfS+Um0Rb 3h56vrhjbFrYeOq1lzf+Em5ZhEBQfVYJ8fmeIZ6vjDMaenC7jnUN1f+yqnk5D+tmYaZT3lolq 0eM8dGWx5somRgPZIk9PmQEO75J8alRMVLYOw1/2Tolt9Lm0a4dhk1/NBQ17HwlmtdFBLfvH1 lRVexoNCZjSvK7COLMazowiq6hAVE7lKfhdxEXgmJ35ZwNm9cTHts+uN9xYYLVwnKLWTIoYpj g3UrP2zjbujZMMvxgKu8zE3n8R6K0rACyfy05Rm3R0lQUqk/4RUmTsgBdMhWBc5yV1rtSIh6a YT71yb6G8sgYOo2vSmnub/UJNQGwhwfsw4RqMk+nxcwzV12M/egw7S0hx49VOjy1P64ssMNqA lKkX0AIbK1oZ3lohVhnnjx4wtyRLkG7E8zagkSP/FDxI/m97d7gzESUnBkY5UxTNJJ8aiF/Ol TqteJkvca9B1spThJvIw0Ape5NzkZqxTDs0Xpqf7stoPnmsNo8T8ysK4yseN5hXiBcjzeUcvL RpIstORzoTsZYERs3Q13JLI4lgJUe6Zdr9iJSGv+x/Ozr6poiDazxRCYNq50OidN2RXo= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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 312c248f1fe6..fc98024d3b5e 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -541,7 +541,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 Mon Jul 16 16:10: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: 142054 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2604556ljj; Mon, 16 Jul 2018 09:12:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcR+uVwTRbezFK359B0JVNgb2hjs5jZtscRdVowL+D9SCPEoMf8bz56EAHAdNuRmIJIlVd5 X-Received: by 2002:a63:d15:: with SMTP id c21-v6mr16316787pgl.322.1531757551569; Mon, 16 Jul 2018 09:12:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531757551; cv=none; d=google.com; s=arc-20160816; b=o8647shYYxxrPLvyvV8oTHY0/3B8gtGh9llUBLNiMZEaIAtPIxD0RmfhFkrUaEoCcD zU4DQN8W13ilT+4YWN2slcvbCeO+anWbKjGLEmcVNajxWWNt11xvOc0Qh4dPJ8qX4i+K 9Jt4NNtAgS6Sy684gaUAKP4Di7svIhRYL0Z32U5Q3AePj3OCyP1cewhN+EWPBXby5aSU dnJ3kk2jVP9t2gDGYwR9It5Q7RXvSNd33PexuUQlKeXumzq2mzG5H6urpSeFUoAEXyz5 6MP4STPKhG9p3K/4MW4KD25LuJgp5h/SdWQNnMkB6wV75tKW4y608TUmiH1WxZdJ/RhK i/WA== 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=GfF7HocEVZK1W6cuTeSo3UFl01CcpZK4U45naFYaGGI=; b=OefaZHuthTqM1/czB4uYIbTfpxlA2WqptzGku90HJGEp7lwxCVhEcLf3Obp1xHaL4/ uptSED+7la+QJMMe316S6I6UGm32T2jZ1jx5bEFUyZSCXQy4PzgXoT6Uomt1EJfDWhea NMRcOlPsA4HoUSv+E+DnggF7VXUChZ0u5CGDXneqvWb0/8SEtdZZ6ybI8lRGSqztofpr UOXIRzARgGIdaMr7KOv6l9MHVbAvHOM4aN+v65xW19Qfbf2pgarLkeLP6ZXg+WT7467P tnARuwmjOp3Ml5bR+1Ny0w+ZWFiyr/xPs7GbqHxUQg4AzkKn2J/wqsjAiFnC0WpCdv2j bRIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 l7-v6si30064885pgc.650.2018.07.16.09.12.31; Mon, 16 Jul 2018 09:12:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730795AbeGPQkJ (ORCPT + 10 others); Mon, 16 Jul 2018 12:40:09 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:59874 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730229AbeGPQkJ (ORCPT ); Mon, 16 Jul 2018 12:40:09 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0LthqL-1g4V9x2h1B-011Euh; Mon, 16 Jul 2018 18:11:12 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, hch@infradead.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, albert.aribaud@3adev.fr, netdev@vger.kernel.org, viro@zeniv.linux.org.uk, peterz@infradead.org, dvhart@infradead.org, ebiederm@xmission.com, linux@dominikbrodowski.net, Arnd Bergmann Subject: [PATCH v2 12/17] y2038: aio: Prepare sys_io_{p, }getevents for __kernel_timespec Date: Mon, 16 Jul 2018 18:10:58 +0200 Message-Id: <20180716161103.16239-13-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180716161103.16239-1-arnd@arndb.de> References: <20180716161103.16239-1-arnd@arndb.de> X-Provags-ID: V03:K1:a3KpSrkjY4tJOq+MSle/NPLPP0gxPpg5PEIvtEgjC02x9fA7SnJ hbu2nhxm+9ux/NXSGzVbTjULSwOa/BYubElV/6yy4V8gijGVxnpKOX1rjuiPPvHZogWCKXx vyemW+nXUlkcpaExioQFSCPKTs4mODKAXBu6o7C711JTjkDfeGNaj0l8eoP54TfTf3F3qep MwTK2tNzjKVIDS30PNPGw== X-UI-Out-Filterresults: notjunk:1; V01:K0:/gMvg9jEAq4=:URz0SuCnEXhL7h1tH/Mu2O VyeWBb/kpuDv769N8QqlYF9SwxTv5UGmCPzdJicZo6lsf5nkxKJE2L3iNVs/K3eOyvcht8wes BbvNCQLGyPDcXTAtaWhgHAxMB6FakdEMB3K7+eisv0odH+pPIkljvbglm/V0POIuo/QLhVQy5 dg2Wg8vk4rR5rdEel04ndO+13PTmjQvABauRYTphrrxUV8/5qoivnyGw0N4CQnzO/SOfb2JpL UkNK3NASLUBnSRqyN7WemOvuS2AMb45K+hFTQkJifmd6xeZAGMQb5MUXraHYaCCpbrhhbZVSm Ex7bAaCx6O0ARcVcKaOiAezpo14S3FOT5uNEBmWyVEcmwoeNZhgGqbsrvBmZubhHg1jiMzAz0 cry6AcjS/4sNLIyD8HVnSLAGMdz8IMWrYUIaD/C0A28t+CEFAqp4AkER5gbE9k2WrjCaaI4R9 b7Zk44KJI+HjNrprCziEqMmWi2zMWxLnjNTrKjv5Sp0s+fs9o2felC9jaxYh45f/eATDHkrfX Sz169dy3CMheFyR4LW7ZzycRZFcmG10UHK19bwg7BK0o8ttj3nfB6W9pAsb82F/7+IOjr2Kt3 Z+db+HkZztJFBKt7AK3J76T+49XPzgqfVLr9U2ogt9J4Oj28u78pGOWHz9MmFNTBFRoTAOOy0 o5t8ZPdByyVWbYoPwgW65LN7vdZj8FdW50+srMJrVCU4gTXY1NhXJ2cakNKrJ1rVoUMY= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This is a preparation patch for converting sys_io_pgetevents to work with 64-bit time_t on 32-bit architectures. The 'timeout' 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. We now have five entry points into do_io_getevents(). Until we set CONFIG_64BIT_TIME, the arguments are sys_io_getevents(): native aio_context_t, old-style timespec sys_io_pgetevents(): like sys_io_getevents(), but with added aio_sigset argument compat_sys_io_getevents(): 32-bit aio_context_t, 32-bit timespec compat_sys_io_pgetevents(): like compat_sys_io_getevents(), but with added aio_sigset argument compat_sys_io_pgetevents_time64(): like compat_sys_io_pgetevents(), but with 64-bit timespec Once a 32-bit architecture sets CONFIG_64BIT_TIME, sys_io_getevents() is no longer available, and sys_io_pgetevents() takes a 64-bit timespec argument, whiel compat_sys_io_getevents() and compat_sys_io_pgetevents() implement the traditional behavior. compat_sys_io_pgetevents_time64() is only used on 64-bit architectures, to provide compatibility with the new 32-bit version of sys_io_pgetevents() taking a 64-bit timespec combined with a __compat_aio_sigset. Signed-off-by: Arnd Bergmann --- fs/aio.c | 77 +++++++++++++++++++++++++++++++++++++++++++----- include/linux/syscalls.h | 4 +-- 2 files changed, 71 insertions(+), 10 deletions(-) -- 2.9.0 diff --git a/fs/aio.c b/fs/aio.c index 76def7523ece..f306a48b0a9f 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -1869,7 +1869,7 @@ SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id, long, min_nr, long, nr, struct io_event __user *, events, - struct timespec __user *, timeout) + struct __kernel_timespec __user *, timeout) { struct timespec64 ts; int ret; @@ -1888,7 +1888,7 @@ SYSCALL_DEFINE6(io_pgetevents, long, min_nr, long, nr, struct io_event __user *, events, - struct timespec __user *, timeout, + struct __kernel_timespec __user *, timeout, const struct __aio_sigset __user *, usig) { struct __aio_sigset ksig = { NULL, }; @@ -1929,6 +1929,73 @@ SYSCALL_DEFINE6(io_pgetevents, } #ifdef CONFIG_COMPAT +struct __compat_aio_sigset { + compat_sigset_t __user *sigmask; + compat_size_t sigsetsize; +}; + +COMPAT_SYSCALL_DEFINE6(io_pgetevents_time64, + compat_aio_context_t, ctx_id, + compat_long_t, min_nr, + compat_long_t, nr, + struct io_event __user *, events, + struct __kernel_timespec __user *, timeout, + const struct __compat_aio_sigset __user *, usig) +{ + struct __compat_aio_sigset ksig = { NULL, }; + sigset_t ksigmask, sigsaved; + struct timespec64 t; + int ret; + + if (timeout && get_timespec64(&t, timeout)) + return -EFAULT; + + if (usig && copy_from_user(&ksig, usig, sizeof(ksig))) + return -EFAULT; + + if (ksig.sigmask) { + if (ksig.sigsetsize != sizeof(compat_sigset_t)) + return -EINVAL; + if (get_compat_sigset(&ksigmask, ksig.sigmask)) + return -EFAULT; + sigdelsetmask(&ksigmask, sigmask(SIGKILL) | sigmask(SIGSTOP)); + sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved); + } + + ret = do_io_getevents(ctx_id, min_nr, nr, events, timeout ? &t : NULL); + if (signal_pending(current)) { + if (ksig.sigmask) { + current->saved_sigmask = sigsaved; + set_restore_sigmask(); + } + if (!ret) + ret = -ERESTARTNOHAND; + } else { + if (ksig.sigmask) + sigprocmask(SIG_SETMASK, &sigsaved, NULL); + } + + return ret; +} +#endif + +#ifdef CONFIG_COMPAT_32BIT_TIME +#ifndef CONFIG_COMPAT +#define compat_sigset_t sigset_t +struct __compat_aio_sigset { + compat_sigset_t __user *sigmask; + compat_size_t sigsetsize; +}; + +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 + COMPAT_SYSCALL_DEFINE5(io_getevents, compat_aio_context_t, ctx_id, compat_long_t, min_nr, compat_long_t, nr, @@ -1947,12 +2014,6 @@ COMPAT_SYSCALL_DEFINE5(io_getevents, compat_aio_context_t, ctx_id, return ret; } - -struct __compat_aio_sigset { - compat_sigset_t __user *sigmask; - compat_size_t sigsetsize; -}; - COMPAT_SYSCALL_DEFINE6(io_pgetevents, compat_aio_context_t, ctx_id, compat_long_t, min_nr, diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 1a22bb4285bf..4fc93fbc0d00 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -296,12 +296,12 @@ asmlinkage long sys_io_getevents(aio_context_t ctx_id, long min_nr, long nr, struct io_event __user *events, - struct timespec __user *timeout); + struct __kernel_timespec __user *timeout); asmlinkage long sys_io_pgetevents(aio_context_t ctx_id, long min_nr, long nr, struct io_event __user *events, - struct timespec __user *timeout, + struct __kernel_timespec __user *timeout, const struct __aio_sigset *sig); /* fs/xattr.c */ From patchwork Mon Jul 16 16:10:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 142046 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2604182ljj; Mon, 16 Jul 2018 09:12:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfe6aQpx17iZQBYdVr2q+bJrIzKcUimJex+sYDxMNIxu0rgFXA78rsbu2Xq6viWX27GWw1S X-Received: by 2002:a17:902:780d:: with SMTP id p13-v6mr15142470pll.119.1531757529242; Mon, 16 Jul 2018 09:12:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531757529; cv=none; d=google.com; s=arc-20160816; b=k+3r9WlwWFgvpbOTTuodtviJP6txIflM3QfhW2TcktSFUDsezMZFly0TgX/2DrcFJe ijyQwxeAYYsOWZVsgUg+3COS+DVeAY3IEGJxQ7td5mF3SQmuRaIdRepJysdiXgjY5Yn+ Fsfh7AWDBUXX8jGXZsoCrZWlhqNYejj8SPXS3sNV/gcw2DQvUZ/PXf/iK5XbY76zhnVM OXanVft5MPDxgzZ9cLmGb70aCn2v6/M34KVR0OekCRu027/vGGt+5YruRXg3SU6fv35V yuGGa0ugVbIFyp5QNTHCBEK59RJl6uZdhQ8L36gjMyNEM5mzCdtDAphdtNTLGaWRqKWI tT2Q== 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=jM92TYr38EI8PxJEXuli2RRBR5c1pWqNPCMcYX/yVSc=; b=m+DhhMWdUapBmoZ49RLz6pcc0mrNv2q+26g+ze+cw7ZI7UGE6qEgfk0BvRU3j3fojM zi8HsVO58LhRvdWcayqzWaeh/t0N0ESWdi1Yj0UXz0A6eL9THqCJ7GI48jQwlZhwtK+G hPFgEEuqejeCrkYT5gmRzkB4GieGyZlcU4Lpc/hC9GsNolvaJR5TRpnSEi2zGetC1VI4 LqnAbqMjb/nSB3fvBznPy7viGZnnBsggm5Hk7iLtyI+oY/o4RJHJYcOY1/qeQQQcwPXn Ooog/8Fb/v+/UudyfT0m5A+wxU6fFzOdxQmLJGtjQba7QpHL3GuKfkzzcMeQZtJYXAoK DZpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 x18-v6si30410996pfh.84.2018.07.16.09.12.09; Mon, 16 Jul 2018 09:12:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731117AbeGPQkN (ORCPT + 10 others); Mon, 16 Jul 2018 12:40:13 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:36886 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730897AbeGPQkN (ORCPT ); Mon, 16 Jul 2018 12:40:13 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0May0k-1fLmp90Yqg-00KRIi; Mon, 16 Jul 2018 18:11:13 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, hch@infradead.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, albert.aribaud@3adev.fr, netdev@vger.kernel.org, viro@zeniv.linux.org.uk, peterz@infradead.org, dvhart@infradead.org, ebiederm@xmission.com, linux@dominikbrodowski.net, Arnd Bergmann Subject: [PATCH v2 13/17] y2038: socket: Convert recvmmsg to __kernel_timespec Date: Mon, 16 Jul 2018 18:10:59 +0200 Message-Id: <20180716161103.16239-14-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180716161103.16239-1-arnd@arndb.de> References: <20180716161103.16239-1-arnd@arndb.de> X-Provags-ID: V03:K1:5bWc/HsfL0/50LXeDf7poFvAdqUUpdbjEKOGR7+CsFqtOLP/xdu ffvWZpo8nL0gwHtUEb0R5Q6ashnXxfCylMS8438N/BG31lJt6+3mtRdqzKjC4uNMTdelHKm Alk0iSh1EyTXpzsAGLaa5ppJDAlUsNVs9p8P/rHi0t/YkiMP3lJ+E9PIbEMRYcofyj3y9ZE Rr7BgG61CPYjQC83dwY7Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:F+biWiHrHhY=:1qdi6onJMX4jjp/Rs5Hdcf aH193+gx4DNJcQvgjUMKtfeJny2A8YcoBDPgQaJiIzv6mzKFwdj6eTiVnpVdK6ryX6aUJwEN0 EUA4R9Eun2+lOApl2qjR3pF+h/gXdxiPFYPHhpOqeTCwgBx5H0sllev4jQEgQP3v4HzTV2BVr UCkzx4+KN1B/J5lSVCzR8dxa1TNVjxDzDtE2Qk6IUEzVG7nQ25vNqinQxlqIEfY8wTVjcbqKG A2PY26pOfUKqFobh7ho00QL9htdxahELCTx3a3mp6gXl6Op6isArjrfO798R/6JH9gkZRuaPz Sr03QaebRZLkt7sXDaQfYm2ddO2HpiSXw5VSPTwYuk3C7N3nwQPX/XlSDPoBN0SO/xqyKpmp8 Utnmm181wWLJ6vbQozgQG7KjIgGKSMyTs6PnjriyixlSamAstQrM5ShqnoasLD0IX9dttxAr4 WXFq/+XkfJ21WICrvG3Fr4oI/SMODXdhvdY31127UMZllfD9J6w1HDv8m0Md/3dyUP9bjRliC SpqK7/1WweUrkMAXX3pG/iCPluUx6ELSet31zdlJIwZl9bcHY/b9a14+lZx8YuumSTvt7XpEt Q1mxcaDMEI4iHGCYAOJFe4EjizZ/23OnmLMwKie087aX/P9svpr+ikVqoznLzVOVFPKt10U2H 9WQqrZoTshncSRvyK54FZdD4omgPbCsZraDptfX2GZ8RR5z65bL1OIkh7ReU8O9A7rO0= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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.9.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 4fc93fbc0d00..6871f6901a70 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 7242cce5631b..0380fbb9a321 100644 --- a/net/compat.c +++ b/net/compat.c @@ -817,18 +817,18 @@ static int __compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, struct compat_timespec __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 173d7c949218..c0838a278cfd 100644 --- a/net/socket.c +++ b/net/socket.c @@ -2333,7 +2333,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; @@ -2398,8 +2398,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; @@ -2445,10 +2444,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; @@ -2456,13 +2455,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; @@ -2470,7 +2468,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); } @@ -2593,7 +2591,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 Jul 16 16:11:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 142049 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2604290ljj; Mon, 16 Jul 2018 09:12:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfsB0qTi2rEpkLneoim5tRksazJd/+O7sijSeA1z7zwr0IHs+61Pt6ng99Rox4dnCD/pcPy X-Received: by 2002:a62:57dc:: with SMTP id i89-v6mr18662144pfj.65.1531757535201; Mon, 16 Jul 2018 09:12:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531757535; cv=none; d=google.com; s=arc-20160816; b=cK/S3dSET5VMhRSnVsyVm4gdXcdAGGpfqkMjvfcJD6GybOe2GKM3oIkJnU2tLqHd7I +lIdppYc+E+HSTLC3q2QoDEiCmU3ZJOCa8Zurl1dxXuSCN+7CquzZobzd5EA+LMk9dd6 19nVBjEnQ/sk9p7WitE2aH24kt85CLzM8f/5VcWf/H84Q/gIHJzAnOQeciZUQECzxRgI UcaczZk+J0s6JUDRIwNReAPsIrGy9kCQxuW7epoq6eMwxGrgGxE/wDpgtMIc/rv/K2uj nQrcBHF75rdIER4fQwpZJx2tAIGclbOqanUZPDVWx4UgNHUFo5op8mUOBpob6FlTQAwP op0A== 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=W9TyeCWG9I51J9sblrkiEmSH42YxmcOdv1Q5qDUnaZI=; b=BpVuz/KuVE+Xcwoj5f0yJ6Js8y7dhRsooPTd3qXKbSj/jSHgFqdqGyqQGyVhDqJUwT Kgwg8VT5EoWwaBPq8IrADeXNTOZLDwqzDtLKSCicjChBYZKSipuaTTPEATvO62+LB7Rt 4JyzFfRygdm+x0UaXGbXG/KclJbTVgRKJs0853TG18kIyHUKS2RgroSknrWfcLfJDPBn P/j/7qjAHmWXCDK65/hnAxkJr3O+lyvHnSKmPCtDaNZdJYZgmq6yKLgxAsRmTqRCVLUx qTmgdsEfElBtz4vbiFGkkBPcAjZz6qUsJ0E6l8CDQTc8mOXLNQ7pbfDHV1xAKvpy08HJ eUUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 x18-v6si30410996pfh.84.2018.07.16.09.12.14; Mon, 16 Jul 2018 09:12:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731228AbeGPQkT (ORCPT + 10 others); Mon, 16 Jul 2018 12:40:19 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:37721 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731178AbeGPQkT (ORCPT ); Mon, 16 Jul 2018 12:40:19 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0MTrXg-1fWGP32aG0-00QXBW; Mon, 16 Jul 2018 18:11:13 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, hch@infradead.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, albert.aribaud@3adev.fr, netdev@vger.kernel.org, viro@zeniv.linux.org.uk, peterz@infradead.org, dvhart@infradead.org, ebiederm@xmission.com, linux@dominikbrodowski.net, Arnd Bergmann Subject: [PATCH v2 14/17] y2038: socket: Add compat_sys_recvmmsg_time64 Date: Mon, 16 Jul 2018 18:11:00 +0200 Message-Id: <20180716161103.16239-15-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180716161103.16239-1-arnd@arndb.de> References: <20180716161103.16239-1-arnd@arndb.de> X-Provags-ID: V03:K1:sqMhgMKuO7X7VSSFswGJblrWZxPOOy6aMZe20r/MUJGT+wTW9Us AiMg98uaZdpx1xG5Qyx58SgYdK58soBG/+A2Hkt38/xBFP3O8dlpDHVyBBu1qHcj/RoOqTX q4YqW9xwxKqVH2ZwzKFEXXLUjIdsvKiOLS+eqn5MK1VLO4J6lG4j4upVTJj3wWetIqErG1Z fh4m4IDNUmsDEksbm6xXQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:qPF2d23m6d4=:UqY0JiXjsXnEN4PGdNrF64 o9yGd7Gj2KRkyssyFaodth11WuiuipipP+iRPxjb/OHBLiu0B2ggFWjMjd4w0MbcrCrjdcYMc oZsjbANl/tocvpR+9Vd+bXYHEMoWA+KdGAGHg1BrRbrBhWH69gIn0rymlmmcSywcgzIcfr468 RGSFXhoW71C5q7X+MWJIdsw00YoBW8LrTO2C8TjXqRdAV2bjyM0xW6hrp2LwdC7p5nUYpfSPY b21NBdKO2DAJStUcjBuKxAQhurw+AshnEhBDtO8ozRyOpqhdZ5TcImpWmei1r7Kmu35+UHyyt q5XlVS0uYlLVBGIUKYoM8S03Ixoz0Mel/wQN0z+nX/3DgyYk1X0axF5sCBkW1m4KZF1JOOulj 1S7iYBLFlh+ReGjsom16rTCHo8UDCfmo6gBW6IKBlvnKNF01+xnT1hzrqWuQucTg4nsHrKMrn VvK78tQnJwbJviMtQzO0WgukKLWR/C+Xx0CMC/fNOCNAR4lNrgPUMdzA/Ob30H+5nu8F1fZyE 3n1B6t/q46QKMgWU9wfQQPzXYvXlvcFMDg0wEurQqpaqUW/Almw3ciLoVei/aLD15ge/MyyaQ VDo3JRW9Ymc1XjAMN+ZbWexDXzpih9oHwZ2tJulEVUKYDO70iQ3z2XMBoGbYa36WdscbAuJdY ta9KdPp1X1e8rSMY3oKgHtVtm/rQJ/kPPakVnLVwoYHZoNgtm7qlh09/fcklsY39rhz8= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org recvmmsg() takes two arguments to pointers of structures that differ between 32-bit and 64-bit architectures: mmsghdr and timespec. For y2038 compatbility, we are changing the native system call from timespec to __kernel_timespec with a 64-bit time_t (in another patch), and use the existing compat system call on both 32-bit and 64-bit architectures for compatibility with traditional 32-bit user space. As we now have two variants of recvmmsg() for 32-bit tasks that are both different from the variant that we use on 64-bit tasks, this means we also require two compat system calls! The solution I picked is to flip things around: The existing compat_sys_recvmmsg() call gets moved from net/compat.c into net/socket.c and now handles the case for old user space on all architectures that have set CONFIG_COMPAT_32BIT_TIME. A new compat_sys_recvmmsg_time64() call gets added in the old place for 64-bit architectures only, this one handles the case of a compat mmsghdr structure combined with __kernel_timespec. In the indirect sys_socketcall(), we now need to call either do_sys_recvmmsg() or __compat_sys_recvmmsg(), depending on what kind of architecture we are on. For compat_sys_socketcall(), no such change is needed, we always call __compat_sys_recvmmsg(). I decided to not add a new SYS_RECVMMSG_TIME64 socketcall: Any libc implementation for 64-bit time_t will need significant changes including an updated asm/unistd.h, and it seems better to consistently use the separate syscalls that configuration, leaving the socketcall only for backward compatibility with 32-bit time_t based libc. Signed-off-by: Arnd Bergmann --- include/linux/compat.h | 5 ++++- include/linux/socket.h | 15 ++++++++++++++- kernel/sys_ni.c | 1 + net/compat.c | 14 +++++++------- net/socket.c | 39 +++++++++++++++++++++++++++++++++++++-- 5 files changed, 63 insertions(+), 11 deletions(-) -- 2.9.0 diff --git a/include/linux/compat.h b/include/linux/compat.h index ab0b1f48dc5b..0ede0543b84f 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -867,7 +867,10 @@ asmlinkage long compat_sys_move_pages(pid_t pid, compat_ulong_t nr_pages, asmlinkage long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig, struct compat_siginfo __user *uinfo); -asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, +asmlinkage long compat_sys_recvmmsg_time64(int fd, struct compat_mmsghdr __user *mmsg, + unsigned vlen, unsigned int flags, + struct __kernel_timespec __user *timeout); +asmlinkage long compat_sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned vlen, unsigned int flags, struct compat_timespec __user *timeout); asmlinkage long compat_sys_wait4(compat_pid_t pid, diff --git a/include/linux/socket.h b/include/linux/socket.h index 8b571e9b9f76..65b8db095f1d 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -2,8 +2,8 @@ #ifndef _LINUX_SOCKET_H #define _LINUX_SOCKET_H - #include /* arch-dependent defines */ +#include #include /* the SIOCxxx I/O controls */ #include /* iovec support */ #include /* pid_t */ @@ -349,6 +349,7 @@ extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_sto extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); struct timespec64; +struct compat_timespec; /* The __sys_...msg variants allow MSG_CMSG_COMPAT iff * forbid_cmsg_compat==false @@ -359,6 +360,18 @@ 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 timespec64 *timeout); +#ifdef CONFIG_COMPAT_32BIT_TIME +extern int __compat_sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, + unsigned int vlen, unsigned int flags, + struct compat_timespec __user *timeout); +#else +static inline int __compat_sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, + unsigned int vlen, unsigned int flags, + struct compat_timespec __user *timeout) +{ + return -EINVAL; +} +#endif extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, unsigned int flags, bool forbid_cmsg_compat); diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c index df556175be50..c3fdba58565a 100644 --- a/kernel/sys_ni.c +++ b/kernel/sys_ni.c @@ -285,6 +285,7 @@ COND_SYSCALL(perf_event_open); COND_SYSCALL(accept4); COND_SYSCALL(recvmmsg); COND_SYSCALL_COMPAT(recvmmsg); +COND_SYSCALL_COMPAT(recvmmsg_time64); /* * Architecture specific syscalls: see further below diff --git a/net/compat.c b/net/compat.c index 0380fbb9a321..5af2af1b9723 100644 --- a/net/compat.c +++ b/net/compat.c @@ -812,9 +812,9 @@ COMPAT_SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, buf, compat_size_t, len return __compat_sys_recvfrom(fd, buf, len, flags, addr, addrlen); } -static int __compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, +static int __compat_sys_recvmmsg_time64(int fd, struct compat_mmsghdr __user *mmsg, unsigned int vlen, unsigned int flags, - struct compat_timespec __user *timeout) + struct __kernel_timespec __user *timeout) { int datagrams; struct timespec64 ktspec; @@ -823,22 +823,22 @@ static int __compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, flags | MSG_CMSG_COMPAT, NULL); - if (compat_get_timespec64(&ktspec, timeout)) + if (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_timespec64(&ktspec, timeout)) + if (datagrams > 0 && put_timespec64(&ktspec, timeout)) datagrams = -EFAULT; return datagrams; } -COMPAT_SYSCALL_DEFINE5(recvmmsg, int, fd, struct compat_mmsghdr __user *, mmsg, +COMPAT_SYSCALL_DEFINE5(recvmmsg_time64, int, fd, struct compat_mmsghdr __user *, mmsg, unsigned int, vlen, unsigned int, flags, - struct compat_timespec __user *, timeout) + struct __kernel_timespec __user *, timeout) { - return __compat_sys_recvmmsg(fd, mmsg, vlen, flags, timeout); + return __compat_sys_recvmmsg_time64(fd, mmsg, vlen, flags, timeout); } COMPAT_SYSCALL_DEFINE2(socketcall, int, call, u32 __user *, args) diff --git a/net/socket.c b/net/socket.c index c0838a278cfd..f4b6be81c6af 100644 --- a/net/socket.c +++ b/net/socket.c @@ -2473,6 +2473,37 @@ SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg, return do_sys_recvmmsg(fd, mmsg, vlen, flags, timeout); } +#ifdef CONFIG_COMPAT_32BIT_TIME +int __compat_sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, + unsigned int vlen, unsigned int flags, + struct compat_timespec __user *timeout) +{ + int datagrams; + struct timespec64 ktspec; + + if (timeout == NULL) + return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, + flags | MSG_CMSG_COMPAT, NULL); + + 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_timespec64(&ktspec, timeout)) + datagrams = -EFAULT; + + return datagrams; +} + +COMPAT_SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg, + unsigned int, vlen, unsigned int, flags, + struct compat_timespec __user *, timeout) +{ + return __compat_sys_recvmmsg(fd, mmsg, vlen, flags, timeout); +} +#endif + #ifdef __ARCH_WANT_SYS_SOCKETCALL /* Argument list sizes for sys_socketcall */ #define AL(x) ((x) * sizeof(unsigned long)) @@ -2590,8 +2621,12 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args) a[2], true); break; case SYS_RECVMMSG: - err = do_sys_recvmmsg(a0, (struct mmsghdr __user *)a1, a[2], - a[3], (struct __kernel_timespec __user *)a[4]); + if (IS_ENABLED(CONFIG_64BIT) || !IS_ENABLED(CONFIG_64BIT_TIME)) + err = do_sys_recvmmsg(a0, (struct mmsghdr __user *)a1, a[2], + a[3], (struct __kernel_timespec __user *)a[4]); + else + err = __compat_sys_recvmmsg(a0, (struct mmsghdr __user *)a1, a[2], + a[3], (struct compat_timespec __user *)a[4]); break; case SYS_ACCEPT4: err = __sys_accept4(a0, (struct sockaddr __user *)a1, From patchwork Mon Jul 16 16:11:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 142050 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2604404ljj; Mon, 16 Jul 2018 09:12:21 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcsHBriOT03pPmwowbZmKkjNhli1jm30G3TzgpyTu4N9WxKao1ze5NDDNQ+HbMmo6fnIQtk X-Received: by 2002:a17:902:7688:: with SMTP id m8-v6mr17134055pll.338.1531757541720; Mon, 16 Jul 2018 09:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531757541; cv=none; d=google.com; s=arc-20160816; b=UWNNy9kHksQKNCUHh2+iSl8hTwGE6Ri2vB4hhd9hrtnr+7oCC2NGJBc3JtzffY3ksv bCsFzv0TQIMNnq9D35UCR42A82yTmpPf4IafmygCcylwzphijATTHRKexpzrAmtPDlYf EtvJdEVZJr/lC8Db+46oYIrkXDCHOeAjE0k3rRKIq3KDPWYHitT/0gZnNaNMhcbgmb97 ohyplK5UDkVHdYfDwQmR2yRu8ugRUzwwvkyDHuOBdLNPk7CjLTHpHbThXJ/xVKqxvVBY qWWqgflJ+lMZGyGUa6QKUZVIlWi0jiuuyoM00ov9PgCySvax9Tn2Xf5tPbajewO12rrM 5uXw== 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=6a4ZCRkp6qRpNc1SCN9u0GM6knrRsqgsu368x2Ch7qo=; b=AYh6KbTbqZbSwTqgXr67nsj5SY+AWld13F7iRgBanck7KGAeAuxgu/vfCZ+owrc15x iD4H1bGT6GkrX9F1SaKFimevbNnrdzhOytfSuzP1bclfVkIth0Um9yXHB7XFTSSosL4Q 0qW3H3UnXQjxLEn8Ndxw52iHdRMEP6Z3CPhRU8pMifg1gIMh+uw71ZAg/NfwXjf9B+L+ egOitIYhYpJl0dyMHt3EKmsgfvlvygMgpBJItozkb1oUsI5KFxkAxW6P9q5NLD0eibqK SrNESb3h4812jB7nOkloYWFbr7iVjh9tEzpddzrsV0O88kh/OBV3WxaRwjCDColdYZUI IXBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 l7-v6si30064885pgc.650.2018.07.16.09.12.21; Mon, 16 Jul 2018 09:12:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731075AbeGPQkM (ORCPT + 10 others); Mon, 16 Jul 2018 12:40:12 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:57732 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727970AbeGPQkM (ORCPT ); Mon, 16 Jul 2018 12:40:12 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0M3qBK-1fx2Nk0TgY-00raGK; Mon, 16 Jul 2018 18:11:14 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, hch@infradead.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, albert.aribaud@3adev.fr, netdev@vger.kernel.org, viro@zeniv.linux.org.uk, peterz@infradead.org, dvhart@infradead.org, ebiederm@xmission.com, linux@dominikbrodowski.net, Arnd Bergmann Subject: [PATCH v2 15/17] y2038: signal: Change rt_sigtimedwait to use __kernel_timespec Date: Mon, 16 Jul 2018 18:11:01 +0200 Message-Id: <20180716161103.16239-16-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180716161103.16239-1-arnd@arndb.de> References: <20180716161103.16239-1-arnd@arndb.de> X-Provags-ID: V03:K1:MJMf8M44KxCDluKOHJYbdp1uKcxmm4nl6kLnUVTpNFl36PsezzX aMAQ9dbWp+Wt+VIPpDiGe/yXX1XvhEpxC19xDyETQaZvh51QUXZx7wUmR0fkrg3neVzxinh NXamdzjjxae/qd6bKFmfzRphJoQpspSG+p0FbUB81TPMbS3tGcFnifONhjhpBTV4PPkQZj3 PNwZM2zx4bWNZRGtV6K4Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:rJzzpnK2rHM=:k+unioP7w8ElRem10eorc5 f+GaEkQFsm+pGMaK7tP4OjfQfuiGiRrTgvUINhvERSSqz912Z65axGu5XEmswMniXgiM4WEjZ 93Qk7wDKWnFdJu/hP4NrpFWcjHgZj7Zk27qvIgSYckU77eVOtHUsjtddCPEs9xmLC9I1CR/ar FQsC4760GdcLM4yiC+nDpuQ/5kGtihxW4NwRw2KP2iJwjO2PEGaWrcFS6IaT7tOXnMOdt9+bl ef1SOxkRpyXDYJz8zP8GxcR8oouuPwEe+zhNNlKDITYza3s6/VaikrYlQ+ZcXi8DZJCMjrgoQ GRzYEQVWkt/B5ySWUe+lsGIgsNWOyo3npfDQ8BcLUrQAta0lixu3FjzhL756bhPlVhuJFBIXl jLkVHFlFvem0mt2jNAS6jeR9+wNmeXXti+P44bWqBuQt7EPZbbvrT0wuB0vXwyOvtaA6pUFw+ QE7bRFSR4b2/aQMqoVAxqoeTcI8+wAk5zYS1NwRzBR/2QAKw5Wou3VlNEzo3yhcuiMzSZgh1e JfesG6yrobHmN7Ke71cjVNDcDuTdSaRPVbS2WFhy4Rdf0Qa4z3QMoHTIpQfp9g4w3wgNrAEGH QzwY57W/h4a8NnjC3C1n9UxzGO5PvkwZ2nG8fr7gNayQ3eZZ5Rj5h8/F5c/1CWs+XGNW7fsMM 3eez4gXEhFprRRo/UGvxcBu9UwlHa97OVS6Zq1hgVM0yPRj2kxwk/P7k0iGS8iXo9zGI= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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 6871f6901a70..9c1da8752724 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 786bacc60649..0418a499b9f3 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3036,7 +3036,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; @@ -3044,9 +3044,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; } @@ -3094,11 +3094,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; @@ -3110,7 +3111,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; } @@ -3130,7 +3131,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; @@ -3141,7 +3142,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 Mon Jul 16 16:11: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: 142055 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2604632ljj; Mon, 16 Jul 2018 09:12:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfWe++esZGnzzFuxZvbDZN/qtlhQ6panj08e/QEeRI8mqXb9Dhg3Ft/A1IiC3860yNxxO/J X-Received: by 2002:a17:902:7147:: with SMTP id u7-v6mr16930194plm.154.1531757555595; Mon, 16 Jul 2018 09:12:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531757555; cv=none; d=google.com; s=arc-20160816; b=WhYLjiqylw0Ff2P/vB5v7oI+lbySRUxsK2gRm3H0LZJ2s7RQPNOFGkYVeJMSzBe03n iXRcuN27kmm7a0qZp2XEAhaa5dRcJE2IaEJuE4XJYC+XsvSIZf0kn5fehX3ReQFiQk3M CGbOeGOyUbbnf7inBMY8607HJePkibIcwniCliW8Goec2A5Jl9BkdgaFNeaxov92xC0w tOd7DBB9yKYvrvqHMTXRBcQurlYbjvwYzQpsN/9iA53ilyzaRM1kxOzNdrF+vOi2VnLz I4eYeNmWPuTZHktYXNtBrWVDFhyYkczDwoHL3u3N12SelLiS4qABjugQxYNn0fsJK5OL zBIA== 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=LberCnEAn4JaP0Ytk0nK3DG8wyhMR7evDpijrNoo0Qw=; b=CEn3asyxEpVWdpaNK5xcDk0hKiRXcCtbT1MgESl1+mf4rk/BAos/+VzuggMtQZikpG JdLLlFT5m70a3TO7m+q4LaVWbutoW92KjB72R1/LpTll+GwxRjiboQREzVtvaUY8IJox 8laPPY6nGZoV0kAslGNaq50NLT1QvZMjLgQtPhPUrYmizEO6u0eUI0uc3b7fgc0GUL0L bwK/YTejHz10IhlHTkZRBnzT0GYxkr9dn0ocM7qJnkHOOOwoMCb/i1Dfo7w19+x8ezh/ SS0WOd1yTecBlN36OykfHgB6046CB683N2xJSVUy+z3tadaQHt79Ueh9vc4cIwLABXcX 7fmw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 k7-v6si27948588pgq.548.2018.07.16.09.12.35; Mon, 16 Jul 2018 09:12:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731244AbeGPQkk (ORCPT + 10 others); Mon, 16 Jul 2018 12:40:40 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:44122 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730304AbeGPQkI (ORCPT ); Mon, 16 Jul 2018 12:40:08 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0MXjQA-1fa8I82Vni-00WYn2; Mon, 16 Jul 2018 18:11:14 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, hch@infradead.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, albert.aribaud@3adev.fr, netdev@vger.kernel.org, viro@zeniv.linux.org.uk, peterz@infradead.org, dvhart@infradead.org, ebiederm@xmission.com, linux@dominikbrodowski.net, Arnd Bergmann Subject: [PATCH v2 16/17] y2038: Make compat_sys_rt_sigtimedwait usable on 32-bit Date: Mon, 16 Jul 2018 18:11:02 +0200 Message-Id: <20180716161103.16239-17-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180716161103.16239-1-arnd@arndb.de> References: <20180716161103.16239-1-arnd@arndb.de> X-Provags-ID: V03:K1:SAw4Tq8XH8G7p6wFx6/YJEqMJS4uan6mPWN7tCANUAclCm7NaZm 1O0r8bOsQH6rFOQl6RQaviKDTtceSd1QtRHZGSXWAduVCOMT0h0WvVWpiIZdwFCwb5HASPl sZs1aMvIoIFMX5QATXkwz2f1P2g2lqLiwOE47RpaofeESpmUfFKxQPkvZkQqpxfPvZahY+C XFixwTiat7NepiKvS4pBg== X-UI-Out-Filterresults: notjunk:1; V01:K0:eAH8wR4ZJM8=:sQCIqnNciQq60hbr1xpRVw QrdjgdyK+B0vdv04NTerCH7hhqqcrHL1zHegu+mDmzE6oj55fOjpQdYbvKKqrFnM03NoDO/Mn R2bAkJs8x1sGXPY+UERzpbF0YPJEwa+uGmQ7toRtk1g0pTx03wF89VU02ZXlKFN0WQJoImZf4 CZWY9v/+DWHPpoXPXU++8gVUSnJhL1G3xTlGVCzQitjEm4hHd6BbtX/hWdSLqCzs+jK6hvUK6 tvlSoV/V5zgU9kx5YOxz91GDkyBXy86Xvw85rP8BRtVpAXfKSW7leAdAsssQskyC8xUdYjrSI TV228l3QZb45vITMsq6yFFGzXBurOJT/dHVrDl4I2Orc1IgBEiVGyEPF0ihbat48iZ6weG/wf B00TMgXWGNp6YRaa5SYvjoPzYltRDKh7JSP0tifnAHikQ02ZrMY4ywxTVWPlp+YxpBLTRr7yZ YQlsDSwy0BrS3MvGj9rg/gSrsoGQcSosS12PONaGoTZwU/bXfxrW9M+GGYkqUkmvbFnEUvahC VtQdLfRud3Vagbv5jXNEwXuk+AV0wrBQ7cyKCwW8LGvoiD2VS40lHWPPfeNsGJZLERihaXTtA bfQg9acjudVdJrs+at8F4xiG20bq8b+85LXlIGm4m+stv8BN53Qvien+X6Hir40uIpPndpO6b RN5MpLESG0HcZLwnZmjWwn//fELXwHNpnXga0hidsWEov1Vhbrx1Dbz9sVPbY8oZTByw= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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 0418a499b9f3..8d4382d5182f 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3027,7 +3027,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 @@ -3125,7 +3140,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) From patchwork Mon Jul 16 16:11:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 142041 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2604041ljj; Mon, 16 Jul 2018 09:12:01 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfmepHegD/BlK8vAGN/NUL7v3+y2x5iJ/zvR6Yg7mhSRq6D2IoQiOZdRmDAw0DpkK8xyvED X-Received: by 2002:a63:62c4:: with SMTP id w187-v6mr15966959pgb.55.1531757521841; Mon, 16 Jul 2018 09:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531757521; cv=none; d=google.com; s=arc-20160816; b=jk8Z0CxJd4EnG38qDYZP0pdXS6BjD3glXv/L2oizPwxAgJKhDSlyMivOk8NdpiMVYi wjkNgO9t0L6VQnFWchUz8A6Gpinll6UJnNiarEllxemgfgYIy7ZM0dYFGh8IYgDP2mhk GqGoaOfXgSuR8rgcbA18hRLEhHwZgo3kWabQJBAR8o6Qk6NVz7yByLLumodI2J7Dbo4d xLx9aT/G3ZLC2kMwSlWt33I2+q8Kt3wS2YQapLyKNwzyX3N9fUOeBsc/mHfHEwTyozu3 TbiiwATM7RSkn3Iplh12/+vDG8NdIv9P1M4IJjzXclGU4n+TCFR36fuUW/XpexhsYgtf UxMQ== 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=uxsMAIH9gbKkv1JWpxuuiklcuEIwLTH4r2KNDbEqh0Q=; b=Olbi174mZRyKRGMEWE/etiKzUrwVLpXj0bf49HfrXwEkd1Ot0NU4TzfwGvDGUc/IDp JIb3h+xnAShkbnqGB9XYZLwz4M2IUY2t+lhIYfyHwo3TuLAVYFwfGcHJI4YCGnDmdo0H vhjJqIS4dhF9NFilcGvlCodHvs//N6NbEfHRqLCXSl21xKk7/0Snq8hxD4XT1xt6RdCZ PIFfg5Eksz0mEtB36MCx/61vi+CuwoFcmZXy/mjEGgmrErz4flfSCb9mgPAznA459RCj zYpQoScut7XfdYWbGMBv5fU7eobW8lVJrrP2RCfLBv/vm1ESZpfjh7TQtHXULrB87TpG yxnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 x18-v6si30410996pfh.84.2018.07.16.09.12.01; Mon, 16 Jul 2018 09:12:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730301AbeGPQkG (ORCPT + 10 others); Mon, 16 Jul 2018 12:40:06 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:37023 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727970AbeGPQkF (ORCPT ); Mon, 16 Jul 2018 12:40:05 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0MP6Q7-1fjExg0QRb-006Kev; Mon, 16 Jul 2018 18:11:15 +0200 From: Arnd Bergmann To: tglx@linutronix.de Cc: y2038@lists.linaro.org, hch@infradead.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, albert.aribaud@3adev.fr, netdev@vger.kernel.org, viro@zeniv.linux.org.uk, peterz@infradead.org, dvhart@infradead.org, ebiederm@xmission.com, linux@dominikbrodowski.net, Arnd Bergmann Subject: [PATCH v2 17/17] y2038: signal: Add compat_sys_rt_sigtimedwait_time64 Date: Mon, 16 Jul 2018 18:11:03 +0200 Message-Id: <20180716161103.16239-18-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180716161103.16239-1-arnd@arndb.de> References: <20180716161103.16239-1-arnd@arndb.de> X-Provags-ID: V03:K1:40zNK9JfrNweTaqlK0Ah2eHvE1kIbB5bvNRYnw1vbgETF2raHkI KmKSUAFOjisd5MGyfWLOiaLD0pJDYMsQuQgfR+ph6XvKOyYfn43XaOKo0m1tLlMuzpe0XG3 wsNxyv4pjBx+a4rBLSvgk7ERgfYZdSDmvZHtIQfhAalATkVykjHFtFgWk+YtSlImcVYXZbx y84Bn/J/wGwBjR6f1zrng== X-UI-Out-Filterresults: notjunk:1; V01:K0:LEVD/ozFT/E=:v4w/xApCuhVSetNoTsSlIO St5kbOxT8OZxe+8cnIe0fOuzrGpO0yZ4QDEOhdzoHIioDLH0tYu0H6TbRHityGchF+wfocQqN Mf2KIfUxt1ofsGCPBGFBd4tHOA9v3Zlyy7HF8Qg/HZP32jIHQAba/OuxZ0KRWWSFoJZz7+gKS 1RImODr5bz4IouAVKDsTKwsnL6Mu8UoS9bQvfRbqST3fNpvErWIUxFiHKdymyWVsvr9ag8wH1 zY/6PYwHXJjJ1rH3FL/wrAhdA3YaqLLIbPZQCmty9UQwsjFZ6r4Id3p/X88oJ8aRAOXNGL9+Y JjoC7vesgWlaKsBJiSXafMd5yq0Uec2W1mY5ovj0sn2TvoywG6P3COoMAM5f7XpJjOd89OS6j xA6KJRNPP17zl/XEp6B9o1rCNL15fT9W3EckG6i4jnraWLV/112Pk9wSdyongRU8gafzqNgHn u6u4WDsBMcYakXEm5Yt66gsBdYFx987rMQyMGDrd/imGpqdR/eICGMeO4xe0Pj1/ZcPvXvlxj oGb4LRHKWeir+UuIh8c5nRzfW5sh+6WD5u+eeQsonOzeOvw7yPtUgsfg0H5O++lanCbV8GlST bom2Y2Tzuz4AM+vLbXlAMBlUYr8ygssUrMXHpcsirQ3pM2MC/WNEAG+ruiTw9dm0ZTvFg+ePm 9WuUnW1egbjXh1mMrhUAO+hDQ/MsQ0d7V/vc5sUmB5Zhgv0YLmreooEgWzVpYkClPPS0= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now that 32-bit architectures have two variants of sys_rt_sigtimedwaid() for 32-bit and 64-bit time_t, we also need to have a second compat system call entry point on the corresponding 64-bit architectures. The traditional system call keeps getting handled by compat_sys_rt_sigtimedwait(), and this adds a new compat_sys_rt_sigtimedwait_time64() that differs only in the timeout argument type. Signed-off-by: Arnd Bergmann --- kernel/signal.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) -- 2.9.0 diff --git a/kernel/signal.c b/kernel/signal.c index 8d4382d5182f..332f019dc421 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3172,6 +3172,38 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese, } #endif +#ifdef CONFIG_COMPAT +COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait_time64, compat_sigset_t __user *, uthese, + struct compat_siginfo __user *, uinfo, + struct __kernel_timespec __user *, uts, compat_size_t, sigsetsize) +{ + sigset_t s; + struct timespec64 t; + siginfo_t info; + long ret; + + if (sigsetsize != sizeof(sigset_t)) + return -EINVAL; + + if (get_compat_sigset(&s, uthese)) + return -EFAULT; + + if (uts) { + if (get_timespec64(&t, uts)) + return -EFAULT; + } + + ret = do_sigtimedwait(&s, &info, uts ? &t : NULL); + + if (ret > 0 && uinfo) { + if (copy_siginfo_to_user32(uinfo, &info)) + ret = -EFAULT; + } + + return ret; +} +#endif + /** * sys_kill - send a signal to a process * @pid: the PID of the process