From patchwork Mon Feb 18 21:07:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 158646 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2935476jaa; Mon, 18 Feb 2019 13:08:45 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia19rPisNf9/ZF9fWBMPRK7UemZ53x1z9PuDieN4pxWsAWwtQF/sljTFKrlGQpN0eeNHw8/ X-Received: by 2002:a17:902:f64:: with SMTP id 91mr27269639ply.132.1550524125412; Mon, 18 Feb 2019 13:08:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550524125; cv=none; d=google.com; s=arc-20160816; b=y/Fhb2w+1KjvCHRd9wD/PpCz7+PLkr8PdtuYCUlH0ENecknzHNAB5134cVsC+3t6HZ vTS2yJuZ2bjMK8jXaNnKb7TL2VJJLbFwxZufEOKuz01f9bbNT3M1HBxQ57t4uu6UoG/O nuqjjaFcOr60E4zDGvM0ES5BdXcukZ4uV/KcStlon1I6l/bk3YYEpgSK3vQul1Xf2I2I gs49HVyLlkcj6ytw3vdaHdRr4I1inGKnhozR6e4y9kvrAC5h2um6YSjtlWjMikRLA0XD 4dyTyhmLUKVkHRMHbMdPqMAD5jj5JvuA47eDzNk8zBJ7SIFc9wvlD/QkiMydYRfFg+Xw 1CEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=aAamalPIZB7Hgkkeu6R9mqg8IMwOJz/BtXxbYOZTbC4=; b=o/KL2ZeU9kRaoviuq4A1rDJRptSXR6qnq7eVfloulPsuKo9NTjlvZXZUgINTrnzzTw Oz6uPLtAuNWsTmcx1gdla2m3mS9vKJATIt0AVLPp61EQJGAcdI+E+2wNKRqY83Ll4hr4 zHBNqKI84lJhX9C3DSAyiKjrnd0ncy7Y4LDk2p7o6mxITKmnqCjdWVblPdoHmsJlO/HJ d/752QHKK8v5LrbzKDBVPlacrprAzb1QaR9SteSqn9saLIhJz02jbFahkDTWecXZdRoH 5KK8nK88ysq3aqEb0LUoocJIDbOkUN1ZmlfffvfixbZ4sazHmS+SM6d076ew8DxDic3T RIZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si14295361pfe.159.2019.02.18.13.08.44; Mon, 18 Feb 2019 13:08:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730137AbfBRVIm (ORCPT + 32 others); Mon, 18 Feb 2019 16:08:42 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:50651 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728107AbfBRVIB (ORCPT ); Mon, 18 Feb 2019 16:08:01 -0500 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mna0x-1hNEPB43e9-00jWQB; Mon, 18 Feb 2019 22:07:25 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org Cc: Thomas Gleixner , linux-arch@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, yury.norov@gmail.com, linux-arm-kernel@lists.infradead.org, linux-hexagon@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp, Stafford Horne , Vineet Gupta , Palmer Dabbelt , Guo Ren , Greentime Hu , arnd@arndb.de, linux-riscv@lists.infradead.org, Guan Xuetao , Yury Norov , Yury Norov Subject: [PATCH 2/8] 32-bit userspace ABI: introduce ARCH_32BIT_OFF_T config option Date: Mon, 18 Feb 2019 22:07:06 +0100 Message-Id: <20190218210712.3503891-3-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190218210712.3503891-1-arnd@arndb.de> References: <20190218210712.3503891-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:63NPbzA6d/O5+QCRnWWyskF7l+TMw62sD+M/rq21tRTBUX+7Oql 0bmuLcxIAOzoKAPpI/WXQ2KszumzS+joEl/jnpIC9cpoMMIQR4Emb3kZp/RqqPb0WWfflQc av8LGKqvJt6JtLy2DhGE1hbLS3xVfZbeMsmuRGhF5ZJ/iCgcofyzuOJdOlqUH7W2WxwOIdy ay4zMFEkMeqxs7SWZGPNQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:QLVFiTv766c=:W6j07WuUQjDTKkcnckdPeB LRDcm3WxenVj4eKXtarGm3J+ef58JQa5pu2V2FrF9Jw9i0/iz43GYnS/xarIxr956AnpjgusM xeeYfosTRUYMfY2vKi7EFgVSqaisdEkgwkVsmmU+mq4zA51P7T0JYBXi3VfYv7Xo3BNuLZ3eI kkOwMwAWhINjYcXDJ/+/61WsiDmu14F9bWNuqp+msqbtVh/rWkryS9zeBJoQ06ReEkTiD+6Wc MoXVKId8HNHQQTPXGrvGNN05U4P4jXSibQ9LSNh/sMRHMpFFifEWP/725y3jmKJOR3QDni1PU BwJO5K8o68wmE858KrGwZwrZxA7EPGKS40XCnUleBWXONBIxSWnSqhkqzxRqSe2PUNI9DEpjP sC34RrUSS3SNcq9hKAdEO9Cd9IjoILJ1d5loD9og+g7MJ6eBxE3qQG3j0NdIpRHgj8/TKBl8a DtPSQOT4KEeLp9idlX1zRb4ZfIeR5j30CrYwVQM9194sXR6QTpjoSRSE44SsAzYlqcmNzgrLG iIEu1BKqVTzLrXwHFMC85r9r5WwwpZzcdn1sn14mLNg36VYwdJpPplNZRgdigtw2qqZ6qwnfu G0t5KCAABjRv0I4L3UmT+fsaBB+1ldmWzlvWTEfKe8h4hgUx9RK5hmbxrL0ZLPrZrDW7vki3u z7mk6VZdoQtpyUgOEMTmPQsbiJ3eIwxtc9Wpddy2qIA4LAhHuQ5t5JDnsmLEF5MmGhzMNCsar nOyAMBCkJmy15nRM/g10nUgujgk1/CrDjCyUWw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yury Norov All new 32-bit architectures should have 64-bit userspace off_t type, but existing architectures has 32-bit ones. To enforce the rule, new config option is added to arch/Kconfig that defaults ARCH_32BIT_OFF_T to be disabled for new 32-bit architectures. All existing 32-bit architectures enable it explicitly. New option affects force_o_largefile() behaviour. Namely, if userspace off_t is 64-bits long, we have no reason to reject user to open big files. Note that even if architectures has only 64-bit off_t in the kernel (arc, c6x, h8300, hexagon, nios2, openrisc, and unicore32), a libc may use 32-bit off_t, and therefore want to limit the file size to 4GB unless specified differently in the open flags. Signed-off-by: Yury Norov Acked-by: Arnd Bergmann Signed-off-by: Yury Norov Signed-off-by: Arnd Bergmann --- arch/Kconfig | 15 +++++++++++++++ arch/arc/Kconfig | 1 + arch/arm/Kconfig | 1 + arch/c6x/Kconfig | 1 + arch/csky/Kconfig | 1 + arch/h8300/Kconfig | 1 + arch/hexagon/Kconfig | 1 + arch/m68k/Kconfig | 1 + arch/microblaze/Kconfig | 1 + arch/mips/Kconfig | 1 + arch/nds32/Kconfig | 1 + arch/nios2/Kconfig | 1 + arch/openrisc/Kconfig | 1 + arch/parisc/Kconfig | 1 + arch/powerpc/Kconfig | 1 + arch/riscv/Kconfig | 1 + arch/sh/Kconfig | 1 + arch/sparc/Kconfig | 1 + arch/unicore32/Kconfig | 1 + arch/x86/Kconfig | 1 + arch/x86/um/Kconfig | 1 + arch/xtensa/Kconfig | 1 + include/linux/fcntl.h | 2 +- 23 files changed, 37 insertions(+), 1 deletion(-) -- 2.20.0 Acked-by: Geert Uytterhoeven diff --git a/arch/Kconfig b/arch/Kconfig index 46db715a7f42..89fe3d651349 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -276,6 +276,21 @@ config ARCH_THREAD_STACK_ALLOCATOR config ARCH_WANTS_DYNAMIC_TASK_STRUCT bool +config ARCH_32BIT_OFF_T + bool + depends on !64BIT + help + All new 32-bit architectures should have 64-bit off_t type on + userspace side which corresponds to the loff_t kernel type. This + is the requirement for modern ABIs. Some existing architectures + already have 32-bit off_t. This option is enabled for all such + architectures explicitly. Namely: arc, arm, blackfin, cris, frv, + h8300, hexagon, m32r, m68k, metag, microblaze, mips32, mn10300, + nios2, openrisc, parisc32, powerpc32, score, sh, sparc, tile32, + unicore32, x86_32 and xtensa. This is the complete list. Any + new 32-bit architecture should declare 64-bit off_t type on user + side and so should not enable this option. + config HAVE_REGS_AND_STACK_ACCESS_API bool help diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 376366a7db81..1cfe4197146f 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -14,6 +14,7 @@ config ARC select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC + select ARCH_32BIT_OFF_T select BUILDTIME_EXTABLE_SORT select CLONE_BACKWARDS select COMMON_CLK diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 664e918e2624..8933f7337e56 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -2,6 +2,7 @@ config ARM bool default y + select ARCH_32BIT_OFF_T select ARCH_CLOCKSOURCE_DATA select ARCH_DISCARD_MEMBLOCK if !HAVE_ARCH_PFN_VALID && !KEXEC select ARCH_HAS_DEBUG_VIRTUAL if MMU diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig index 456e154674d1..e5cd3c5f8399 100644 --- a/arch/c6x/Kconfig +++ b/arch/c6x/Kconfig @@ -6,6 +6,7 @@ config C6X def_bool y + select ARCH_32BIT_OFF_T select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE select CLKDEV_LOOKUP diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig index 398113c845f5..6959e0b1e956 100644 --- a/arch/csky/Kconfig +++ b/arch/csky/Kconfig @@ -1,5 +1,6 @@ config CSKY def_bool y + select ARCH_32BIT_OFF_T select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE select ARCH_USE_BUILTIN_BSWAP diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index 6472a0685470..c071da34e081 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 config H8300 def_bool y + select ARCH_32BIT_OFF_T select GENERIC_ATOMIC64 select HAVE_UID16 select VIRT_TO_BUS diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig index fb2fbfcfc532..ac441680dcc0 100644 --- a/arch/hexagon/Kconfig +++ b/arch/hexagon/Kconfig @@ -4,6 +4,7 @@ comment "Linux Kernel Configuration for Hexagon" config HEXAGON def_bool y + select ARCH_32BIT_OFF_T select ARCH_HAS_SYNC_DMA_FOR_DEVICE select ARCH_NO_PREEMPT select HAVE_OPROFILE diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index e173ea2ff395..b54206408f91 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -2,6 +2,7 @@ config M68K bool default y + select ARCH_32BIT_OFF_T select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA select ARCH_MIGHT_HAVE_PC_PARPORT if ISA select ARCH_NO_COHERENT_DMA_MMAP if !MMU diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index 58aff2653d86..a51b965b3b82 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig @@ -1,5 +1,6 @@ config MICROBLAZE def_bool y + select ARCH_32BIT_OFF_T select ARCH_NO_SWAP select ARCH_HAS_DMA_COHERENT_TO_PFN if MMU select ARCH_HAS_GCOV_PROFILE_ALL diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 787290781b8c..d80ccabd3c06 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -2,6 +2,7 @@ config MIPS bool default y + select ARCH_32BIT_OFF_T if !64BIT select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT select ARCH_CLOCKSOURCE_DATA select ARCH_DISCARD_MEMBLOCK diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig index dda1906bba11..addb7f5f5264 100644 --- a/arch/nds32/Kconfig +++ b/arch/nds32/Kconfig @@ -5,6 +5,7 @@ config NDS32 def_bool y + select ARCH_32BIT_OFF_T select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE select ARCH_WANT_FRAME_POINTERS if FTRACE diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig index 532343eebf89..c3e913ef4f0c 100644 --- a/arch/nios2/Kconfig +++ b/arch/nios2/Kconfig @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 config NIOS2 def_bool y + select ARCH_32BIT_OFF_T select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE select ARCH_NO_SWAP diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig index 09ab59e942ae..a5e361fbb75a 100644 --- a/arch/openrisc/Kconfig +++ b/arch/openrisc/Kconfig @@ -6,6 +6,7 @@ config OPENRISC def_bool y + select ARCH_32BIT_OFF_T select ARCH_HAS_SYNC_DMA_FOR_DEVICE select OF select OF_EARLY_FLATTREE diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index 7ca2c3ebad64..c8e621296092 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 config PARISC def_bool y + select ARCH_32BIT_OFF_T if !64BIT select ARCH_MIGHT_HAVE_PC_PARPORT select HAVE_IDE select HAVE_OPROFILE diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 2890d36eb531..375d0dc0dc7d 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -128,6 +128,7 @@ config PPC # # Please keep this list sorted alphabetically. # + select ARCH_32BIT_OFF_T if PPC32 select ARCH_HAS_DEBUG_VIRTUAL select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_DMA_SET_COHERENT_MASK diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index feeeaa60697c..09fa3a87bf30 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -11,6 +11,7 @@ config 32BIT config RISCV def_bool y + select ARCH_32BIT_OFF_T if !64BIT # even on 32-bit, physical (and DMA) addresses are > 32-bits select PHYS_ADDR_T_64BIT select OF diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index a9c36f95744a..d9a9144dec35 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -62,6 +62,7 @@ config SUPERH config SUPERH32 def_bool "$(ARCH)" = "sh" + select ARCH_32BIT_OFF_T select HAVE_KPROBES select HAVE_KRETPROBES select HAVE_IOREMAP_PROT if MMU && !X2TLB diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index d5dd652fb8cc..40f8f4f73fe8 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -49,6 +49,7 @@ config SPARC config SPARC32 def_bool !64BIT + select ARCH_32BIT_OFF_T select ARCH_HAS_SYNC_DMA_FOR_CPU select GENERIC_ATOMIC64 select CLZ_TAB diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig index c3a41bfe161b..a7f1ae58d211 100644 --- a/arch/unicore32/Kconfig +++ b/arch/unicore32/Kconfig @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 config UNICORE32 def_bool y + select ARCH_32BIT_OFF_T select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 15af091611e2..7aac274c2849 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -47,6 +47,7 @@ config X86 select ACPI_LEGACY_TABLES_LOOKUP if ACPI select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI select ANON_INODES + select ARCH_32BIT_OFF_T if X86_32 select ARCH_CLOCKSOURCE_DATA select ARCH_CLOCKSOURCE_INIT select ARCH_DISCARD_MEMBLOCK diff --git a/arch/x86/um/Kconfig b/arch/x86/um/Kconfig index f518b4744ff8..ab14e6f73ca4 100644 --- a/arch/x86/um/Kconfig +++ b/arch/x86/um/Kconfig @@ -17,6 +17,7 @@ config 64BIT config X86_32 def_bool !64BIT select HAVE_AOUT + select ARCH_32BIT_OFF_T select ARCH_WANT_IPC_PARSE_VERSION select MODULES_USE_ELF_REL select CLONE_BACKWARDS diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 20a0756f27ef..2033b4485cc4 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 config XTENSA def_bool y + select ARCH_32BIT_OFF_T select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE select ARCH_NO_COHERENT_DMA_MMAP if !MMU diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h index 27dc7a60693e..d019df946cb2 100644 --- a/include/linux/fcntl.h +++ b/include/linux/fcntl.h @@ -12,7 +12,7 @@ O_NOATIME | O_CLOEXEC | O_PATH | __O_TMPFILE) #ifndef force_o_largefile -#define force_o_largefile() (BITS_PER_LONG != 32) +#define force_o_largefile() (!IS_ENABLED(CONFIG_ARCH_32BIT_OFF_T)) #endif #if BITS_PER_LONG == 32