32-bit userspace ABI: introduce ARCH_32BIT_OFF_T config option
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 <ynorov@caviumnetworks.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Yury Norov <ynorov@marvell.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
parent
0d0216c03a
commit
942fa985e9
10
arch/Kconfig
10
arch/Kconfig
|
@ -276,6 +276,16 @@ config ARCH_THREAD_STACK_ALLOCATOR
|
||||||
config ARCH_WANTS_DYNAMIC_TASK_STRUCT
|
config ARCH_WANTS_DYNAMIC_TASK_STRUCT
|
||||||
bool
|
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
|
||||||
|
still support 32-bit off_t. This option is enabled for all such
|
||||||
|
architectures explicitly.
|
||||||
|
|
||||||
config HAVE_REGS_AND_STACK_ACCESS_API
|
config HAVE_REGS_AND_STACK_ACCESS_API
|
||||||
bool
|
bool
|
||||||
help
|
help
|
||||||
|
|
|
@ -14,6 +14,7 @@ config ARC
|
||||||
select ARCH_HAS_SYNC_DMA_FOR_CPU
|
select ARCH_HAS_SYNC_DMA_FOR_CPU
|
||||||
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
||||||
select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC
|
select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC
|
||||||
|
select ARCH_32BIT_OFF_T
|
||||||
select BUILDTIME_EXTABLE_SORT
|
select BUILDTIME_EXTABLE_SORT
|
||||||
select CLONE_BACKWARDS
|
select CLONE_BACKWARDS
|
||||||
select COMMON_CLK
|
select COMMON_CLK
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
config ARM
|
config ARM
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
|
select ARCH_32BIT_OFF_T
|
||||||
select ARCH_CLOCKSOURCE_DATA
|
select ARCH_CLOCKSOURCE_DATA
|
||||||
select ARCH_DISCARD_MEMBLOCK if !HAVE_ARCH_PFN_VALID && !KEXEC
|
select ARCH_DISCARD_MEMBLOCK if !HAVE_ARCH_PFN_VALID && !KEXEC
|
||||||
select ARCH_HAS_DEBUG_VIRTUAL if MMU
|
select ARCH_HAS_DEBUG_VIRTUAL if MMU
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
config C6X
|
config C6X
|
||||||
def_bool y
|
def_bool y
|
||||||
|
select ARCH_32BIT_OFF_T
|
||||||
select ARCH_HAS_SYNC_DMA_FOR_CPU
|
select ARCH_HAS_SYNC_DMA_FOR_CPU
|
||||||
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
||||||
select CLKDEV_LOOKUP
|
select CLKDEV_LOOKUP
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
config CSKY
|
config CSKY
|
||||||
def_bool y
|
def_bool y
|
||||||
|
select ARCH_32BIT_OFF_T
|
||||||
select ARCH_HAS_SYNC_DMA_FOR_CPU
|
select ARCH_HAS_SYNC_DMA_FOR_CPU
|
||||||
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
||||||
select ARCH_USE_BUILTIN_BSWAP
|
select ARCH_USE_BUILTIN_BSWAP
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
config H8300
|
config H8300
|
||||||
def_bool y
|
def_bool y
|
||||||
|
select ARCH_32BIT_OFF_T
|
||||||
select GENERIC_ATOMIC64
|
select GENERIC_ATOMIC64
|
||||||
select HAVE_UID16
|
select HAVE_UID16
|
||||||
select VIRT_TO_BUS
|
select VIRT_TO_BUS
|
||||||
|
|
|
@ -4,6 +4,7 @@ comment "Linux Kernel Configuration for Hexagon"
|
||||||
|
|
||||||
config HEXAGON
|
config HEXAGON
|
||||||
def_bool y
|
def_bool y
|
||||||
|
select ARCH_32BIT_OFF_T
|
||||||
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
||||||
select ARCH_NO_PREEMPT
|
select ARCH_NO_PREEMPT
|
||||||
select HAVE_OPROFILE
|
select HAVE_OPROFILE
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
config M68K
|
config M68K
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
|
select ARCH_32BIT_OFF_T
|
||||||
select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA
|
select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA
|
||||||
select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
|
select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
|
||||||
select ARCH_NO_COHERENT_DMA_MMAP if !MMU
|
select ARCH_NO_COHERENT_DMA_MMAP if !MMU
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
config MICROBLAZE
|
config MICROBLAZE
|
||||||
def_bool y
|
def_bool y
|
||||||
|
select ARCH_32BIT_OFF_T
|
||||||
select ARCH_NO_SWAP
|
select ARCH_NO_SWAP
|
||||||
select ARCH_HAS_DMA_COHERENT_TO_PFN if MMU
|
select ARCH_HAS_DMA_COHERENT_TO_PFN if MMU
|
||||||
select ARCH_HAS_GCOV_PROFILE_ALL
|
select ARCH_HAS_GCOV_PROFILE_ALL
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
config MIPS
|
config MIPS
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
|
select ARCH_32BIT_OFF_T if !64BIT
|
||||||
select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT
|
select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT
|
||||||
select ARCH_CLOCKSOURCE_DATA
|
select ARCH_CLOCKSOURCE_DATA
|
||||||
select ARCH_DISCARD_MEMBLOCK
|
select ARCH_DISCARD_MEMBLOCK
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
config NDS32
|
config NDS32
|
||||||
def_bool y
|
def_bool y
|
||||||
|
select ARCH_32BIT_OFF_T
|
||||||
select ARCH_HAS_SYNC_DMA_FOR_CPU
|
select ARCH_HAS_SYNC_DMA_FOR_CPU
|
||||||
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
||||||
select ARCH_WANT_FRAME_POINTERS if FTRACE
|
select ARCH_WANT_FRAME_POINTERS if FTRACE
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
config NIOS2
|
config NIOS2
|
||||||
def_bool y
|
def_bool y
|
||||||
|
select ARCH_32BIT_OFF_T
|
||||||
select ARCH_HAS_SYNC_DMA_FOR_CPU
|
select ARCH_HAS_SYNC_DMA_FOR_CPU
|
||||||
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
||||||
select ARCH_NO_SWAP
|
select ARCH_NO_SWAP
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
config OPENRISC
|
config OPENRISC
|
||||||
def_bool y
|
def_bool y
|
||||||
|
select ARCH_32BIT_OFF_T
|
||||||
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
||||||
select OF
|
select OF
|
||||||
select OF_EARLY_FLATTREE
|
select OF_EARLY_FLATTREE
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
config PARISC
|
config PARISC
|
||||||
def_bool y
|
def_bool y
|
||||||
|
select ARCH_32BIT_OFF_T if !64BIT
|
||||||
select ARCH_MIGHT_HAVE_PC_PARPORT
|
select ARCH_MIGHT_HAVE_PC_PARPORT
|
||||||
select HAVE_IDE
|
select HAVE_IDE
|
||||||
select HAVE_OPROFILE
|
select HAVE_OPROFILE
|
||||||
|
|
|
@ -128,6 +128,7 @@ config PPC
|
||||||
#
|
#
|
||||||
# Please keep this list sorted alphabetically.
|
# Please keep this list sorted alphabetically.
|
||||||
#
|
#
|
||||||
|
select ARCH_32BIT_OFF_T if PPC32
|
||||||
select ARCH_HAS_DEBUG_VIRTUAL
|
select ARCH_HAS_DEBUG_VIRTUAL
|
||||||
select ARCH_HAS_DEVMEM_IS_ALLOWED
|
select ARCH_HAS_DEVMEM_IS_ALLOWED
|
||||||
select ARCH_HAS_DMA_SET_COHERENT_MASK
|
select ARCH_HAS_DMA_SET_COHERENT_MASK
|
||||||
|
|
|
@ -11,6 +11,7 @@ config 32BIT
|
||||||
|
|
||||||
config RISCV
|
config RISCV
|
||||||
def_bool y
|
def_bool y
|
||||||
|
select ARCH_32BIT_OFF_T if !64BIT
|
||||||
# even on 32-bit, physical (and DMA) addresses are > 32-bits
|
# even on 32-bit, physical (and DMA) addresses are > 32-bits
|
||||||
select PHYS_ADDR_T_64BIT
|
select PHYS_ADDR_T_64BIT
|
||||||
select OF
|
select OF
|
||||||
|
|
|
@ -62,6 +62,7 @@ config SUPERH
|
||||||
|
|
||||||
config SUPERH32
|
config SUPERH32
|
||||||
def_bool "$(ARCH)" = "sh"
|
def_bool "$(ARCH)" = "sh"
|
||||||
|
select ARCH_32BIT_OFF_T
|
||||||
select HAVE_KPROBES
|
select HAVE_KPROBES
|
||||||
select HAVE_KRETPROBES
|
select HAVE_KRETPROBES
|
||||||
select HAVE_IOREMAP_PROT if MMU && !X2TLB
|
select HAVE_IOREMAP_PROT if MMU && !X2TLB
|
||||||
|
|
|
@ -49,6 +49,7 @@ config SPARC
|
||||||
|
|
||||||
config SPARC32
|
config SPARC32
|
||||||
def_bool !64BIT
|
def_bool !64BIT
|
||||||
|
select ARCH_32BIT_OFF_T
|
||||||
select ARCH_HAS_SYNC_DMA_FOR_CPU
|
select ARCH_HAS_SYNC_DMA_FOR_CPU
|
||||||
select GENERIC_ATOMIC64
|
select GENERIC_ATOMIC64
|
||||||
select CLZ_TAB
|
select CLZ_TAB
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
config UNICORE32
|
config UNICORE32
|
||||||
def_bool y
|
def_bool y
|
||||||
|
select ARCH_32BIT_OFF_T
|
||||||
select ARCH_HAS_DEVMEM_IS_ALLOWED
|
select ARCH_HAS_DEVMEM_IS_ALLOWED
|
||||||
select ARCH_MIGHT_HAVE_PC_PARPORT
|
select ARCH_MIGHT_HAVE_PC_PARPORT
|
||||||
select ARCH_MIGHT_HAVE_PC_SERIO
|
select ARCH_MIGHT_HAVE_PC_SERIO
|
||||||
|
|
|
@ -47,6 +47,7 @@ config X86
|
||||||
select ACPI_LEGACY_TABLES_LOOKUP if ACPI
|
select ACPI_LEGACY_TABLES_LOOKUP if ACPI
|
||||||
select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
|
select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
|
||||||
select ANON_INODES
|
select ANON_INODES
|
||||||
|
select ARCH_32BIT_OFF_T if X86_32
|
||||||
select ARCH_CLOCKSOURCE_DATA
|
select ARCH_CLOCKSOURCE_DATA
|
||||||
select ARCH_CLOCKSOURCE_INIT
|
select ARCH_CLOCKSOURCE_INIT
|
||||||
select ARCH_DISCARD_MEMBLOCK
|
select ARCH_DISCARD_MEMBLOCK
|
||||||
|
|
|
@ -17,6 +17,7 @@ config 64BIT
|
||||||
config X86_32
|
config X86_32
|
||||||
def_bool !64BIT
|
def_bool !64BIT
|
||||||
select HAVE_AOUT
|
select HAVE_AOUT
|
||||||
|
select ARCH_32BIT_OFF_T
|
||||||
select ARCH_WANT_IPC_PARSE_VERSION
|
select ARCH_WANT_IPC_PARSE_VERSION
|
||||||
select MODULES_USE_ELF_REL
|
select MODULES_USE_ELF_REL
|
||||||
select CLONE_BACKWARDS
|
select CLONE_BACKWARDS
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
config XTENSA
|
config XTENSA
|
||||||
def_bool y
|
def_bool y
|
||||||
|
select ARCH_32BIT_OFF_T
|
||||||
select ARCH_HAS_SYNC_DMA_FOR_CPU
|
select ARCH_HAS_SYNC_DMA_FOR_CPU
|
||||||
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
|
||||||
select ARCH_NO_COHERENT_DMA_MMAP if !MMU
|
select ARCH_NO_COHERENT_DMA_MMAP if !MMU
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
O_NOATIME | O_CLOEXEC | O_PATH | __O_TMPFILE)
|
O_NOATIME | O_CLOEXEC | O_PATH | __O_TMPFILE)
|
||||||
|
|
||||||
#ifndef force_o_largefile
|
#ifndef force_o_largefile
|
||||||
#define force_o_largefile() (BITS_PER_LONG != 32)
|
#define force_o_largefile() (!IS_ENABLED(CONFIG_ARCH_32BIT_OFF_T))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BITS_PER_LONG == 32
|
#if BITS_PER_LONG == 32
|
||||||
|
|
Loading…
Reference in New Issue