Commit e6d26bce authored by Yury Norov's avatar Yury Norov Committed by Yang Yingliang
Browse files

32-bit userspace ABI: introduce ARCH_32BIT_OFF_T config option



hulk inclusion
category: feature
bugzilla: NA
CVE: NA
---------------------------

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: default avatarYury Norov <ynorov@caviumnetworks.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>

 Conflicts:
	arch/x86/um/Kconfig
[wangxiongfeng: conflicts in arch/x86/um/Kconfig. We only need to add
'select ARCH_32BIT_OFF_T' and ignore others. ]

Signed-off-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: default avatarHanjun Guo &lt;guohanjun@huawei.com <mailto:guohanjun@huawei.com&gt;>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent 680f1b10
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ config ARC
	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
	select ARCH_HAS_SG_CHAIN
	select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC
	select ARCH_32BIT_OFF_T
	select BUILDTIME_EXTABLE_SORT
	select CLONE_BACKWARDS
	select COMMON_CLK
+1 −0
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
# 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
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ comment "Linux Kernel Configuration for Hexagon"

config HEXAGON
	def_bool y
	select ARCH_32BIT_OFF_T
	select ARCH_NO_PREEMPT
	select HAVE_OPROFILE
	# Other pending projects/to-do items.
Loading