* [PATCH 0/2] ABI: handle 32-bit off_t for 32-bit and compat ABIs @ 2015-12-26 16:06 Yury Norov 2015-12-26 16:06 ` [PATCH 1/2] compat ABI: use non-compat openat and open_by_handle_at variants Yury Norov 2015-12-26 16:06 ` [PATCH 2/2] 32-bit ABI: introduce ARCH_32BIT_OFF_T config option Yury Norov 0 siblings, 2 replies; 8+ messages in thread From: Yury Norov @ 2015-12-26 16:06 UTC (permalink / raw) To: linux-arch, arnd; +Cc: linux-kernel, klimov.linux, Yury Norov 32-bit off_t is supported only for old 32-bit and compat ABIs. New ABIs are 64-bit length only. This patchset makes 64-bit length the default for off_t, and reverts it for old architectures where needed. It does not change the behaviour of existing code. First patch makes all compat users of generic unistd.h to use non-compat versions of openat and open_by_handle_at. Tile that requires old behaviour is turned around. Second patch introduces ARCH_32BIT_OFF_T config option, disabled by default, but enables it explicitly for existing 32-bit architectures. Yury Norov (2): ABI: compat: use non-compat openat and open_by_handle_at variants 32-bit ABI: introduce ARCH_32BIT_OFF_T config option arch/Kconfig | 4 ++++ arch/arc/Kconfig | 1 + arch/arm/Kconfig | 1 + arch/blackfin/Kconfig | 1 + arch/cris/Kconfig | 1 + arch/frv/Kconfig | 1 + arch/h8300/Kconfig | 1 + arch/hexagon/Kconfig | 1 + arch/ia64/Kconfig | 1 + arch/m32r/Kconfig | 1 + arch/m68k/Kconfig | 1 + arch/metag/Kconfig | 1 + arch/microblaze/Kconfig | 1 + arch/mips/Kconfig | 1 + arch/mn10300/Kconfig | 1 + arch/nios2/Kconfig | 1 + arch/openrisc/Kconfig | 1 + arch/parisc/Kconfig | 1 + arch/powerpc/Kconfig | 1 + arch/s390/Kconfig | 1 + arch/score/Kconfig | 1 + arch/sh/Kconfig | 1 + arch/sparc/Kconfig | 1 + arch/tile/Kconfig | 1 + arch/tile/kernel/compat.c | 3 +++ arch/unicore32/Kconfig | 1 + arch/x86/Kconfig | 1 + arch/x86/um/Kconfig | 1 + arch/xtensa/Kconfig | 1 + include/linux/fcntl.h | 3 ++- include/uapi/asm-generic/unistd.h | 5 ++--- 31 files changed, 38 insertions(+), 4 deletions(-) -- 2.5.0 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] compat ABI: use non-compat openat and open_by_handle_at variants 2015-12-26 16:06 [PATCH 0/2] ABI: handle 32-bit off_t for 32-bit and compat ABIs Yury Norov @ 2015-12-26 16:06 ` Yury Norov 2015-12-28 11:18 ` Arnd Bergmann 2015-12-26 16:06 ` [PATCH 2/2] 32-bit ABI: introduce ARCH_32BIT_OFF_T config option Yury Norov 1 sibling, 1 reply; 8+ messages in thread From: Yury Norov @ 2015-12-26 16:06 UTC (permalink / raw) To: linux-arch, arnd; +Cc: linux-kernel, klimov.linux, Yury Norov The only difference is that non-compat version forces O_LARGEFILE, and it should be the default behaviour for all architectures, as we don't support 32-bit off_t. The only exception is tile32, that continues with compat version of syscalls. Signed-off-by: Yury Norov <ynorov@caviumnetworks.com> --- arch/tile/kernel/compat.c | 3 +++ include/uapi/asm-generic/unistd.h | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c index 4912084..489ae19 100644 --- a/arch/tile/kernel/compat.c +++ b/arch/tile/kernel/compat.c @@ -94,6 +94,9 @@ COMPAT_SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned int, offset_high, #define compat_sys_readahead sys32_readahead #define sys_llseek compat_sys_llseek +#define sys_openat compat_sys_openat +#define sys_open_by_handle_at compat_sys_open_by_handle_at + /* Call the assembly trampolines where necessary. */ #define compat_sys_rt_sigreturn _compat_sys_rt_sigreturn #define sys_clone _sys_clone diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index 1324b02..07761e5 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h @@ -175,7 +175,7 @@ __SYSCALL(__NR_fchownat, sys_fchownat) #define __NR_fchown 55 __SYSCALL(__NR_fchown, sys_fchown) #define __NR_openat 56 -__SC_COMP(__NR_openat, sys_openat, compat_sys_openat) +__SYSCALL(__NR_openat, sys_openat) #define __NR_close 57 __SYSCALL(__NR_close, sys_close) #define __NR_vhangup 58 @@ -673,8 +673,7 @@ __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) #define __NR_name_to_handle_at 264 __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) #define __NR_open_by_handle_at 265 -__SC_COMP(__NR_open_by_handle_at, sys_open_by_handle_at, \ - compat_sys_open_by_handle_at) +__SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) #define __NR_clock_adjtime 266 __SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime) #define __NR_syncfs 267 -- 2.5.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] compat ABI: use non-compat openat and open_by_handle_at variants 2015-12-26 16:06 ` [PATCH 1/2] compat ABI: use non-compat openat and open_by_handle_at variants Yury Norov @ 2015-12-28 11:18 ` Arnd Bergmann 2015-12-28 17:57 ` Chris Metcalf 0 siblings, 1 reply; 8+ messages in thread From: Arnd Bergmann @ 2015-12-28 11:18 UTC (permalink / raw) To: Yury Norov; +Cc: linux-arch, linux-kernel, klimov.linux, Chris Metcalf On Saturday 26 December 2015 19:06:39 Yury Norov wrote: > The only difference is that non-compat version forces O_LARGEFILE, > and it should be the default behaviour for all architectures, as > we don't support 32-bit off_t. The only exception is tile32, that > continues with compat version of syscalls. > > Signed-off-by: Yury Norov <ynorov@caviumnetworks.com> Looks good, Acked-by: Arnd Bergmann <arnd@arndb.de> (adding Chris to Cc a well, in case he has further comments) > arch/tile/kernel/compat.c | 3 +++ > include/uapi/asm-generic/unistd.h | 5 ++--- > 2 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c > index 4912084..489ae19 100644 > --- a/arch/tile/kernel/compat.c > +++ b/arch/tile/kernel/compat.c > @@ -94,6 +94,9 @@ COMPAT_SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned int, offset_high, > #define compat_sys_readahead sys32_readahead > #define sys_llseek compat_sys_llseek > > +#define sys_openat compat_sys_openat > +#define sys_open_by_handle_at compat_sys_open_by_handle_at > + > /* Call the assembly trampolines where necessary. */ > #define compat_sys_rt_sigreturn _compat_sys_rt_sigreturn > #define sys_clone _sys_clone > diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h > index 1324b02..07761e5 100644 > --- a/include/uapi/asm-generic/unistd.h > +++ b/include/uapi/asm-generic/unistd.h > @@ -175,7 +175,7 @@ __SYSCALL(__NR_fchownat, sys_fchownat) > #define __NR_fchown 55 > __SYSCALL(__NR_fchown, sys_fchown) > #define __NR_openat 56 > -__SC_COMP(__NR_openat, sys_openat, compat_sys_openat) > +__SYSCALL(__NR_openat, sys_openat) > #define __NR_close 57 > __SYSCALL(__NR_close, sys_close) > #define __NR_vhangup 58 > @@ -673,8 +673,7 @@ __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) > #define __NR_name_to_handle_at 264 > __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) > #define __NR_open_by_handle_at 265 > -__SC_COMP(__NR_open_by_handle_at, sys_open_by_handle_at, \ > - compat_sys_open_by_handle_at) > +__SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) > #define __NR_clock_adjtime 266 > __SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime) > #define __NR_syncfs 267 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] compat ABI: use non-compat openat and open_by_handle_at variants 2015-12-28 11:18 ` Arnd Bergmann @ 2015-12-28 17:57 ` Chris Metcalf 0 siblings, 0 replies; 8+ messages in thread From: Chris Metcalf @ 2015-12-28 17:57 UTC (permalink / raw) To: Arnd Bergmann, Yury Norov; +Cc: linux-arch, linux-kernel, klimov.linux On 12/28/2015 06:18 AM, Arnd Bergmann wrote: > On Saturday 26 December 2015 19:06:39 Yury Norov wrote: >> >The only difference is that non-compat version forces O_LARGEFILE, >> >and it should be the default behaviour for all architectures, as >> >we don't support 32-bit off_t. The only exception is tile32, that >> >continues with compat version of syscalls. >> > >> >Signed-off-by: Yury Norov<ynorov@caviumnetworks.com> > Looks good, > > Acked-by: Arnd Bergmann<arnd@arndb.de> > > (adding Chris to Cc a well, in case he has further comments) Seems plausible. Acked-by: Chris Metcalf <cmetcalf@ezchip.com> [for tile] -- Chris Metcalf, EZChip Semiconductor http://www.ezchip.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] 32-bit ABI: introduce ARCH_32BIT_OFF_T config option 2015-12-26 16:06 [PATCH 0/2] ABI: handle 32-bit off_t for 32-bit and compat ABIs Yury Norov 2015-12-26 16:06 ` [PATCH 1/2] compat ABI: use non-compat openat and open_by_handle_at variants Yury Norov @ 2015-12-26 16:06 ` Yury Norov 2015-12-28 11:38 ` Arnd Bergmann 1 sibling, 1 reply; 8+ messages in thread From: Yury Norov @ 2015-12-26 16:06 UTC (permalink / raw) To: linux-arch, arnd; +Cc: linux-kernel, klimov.linux, Yury Norov All new 32-bit architectures should have 64-bit off_t type, but existing architectures has 32-bit ones. To handle it, new config option is added to arch/Kconfig that defaults ARCH_32BIT_OFF_T to be disabled by default. All existing 32-bit architectures enable it explicitly here. New option affects force_o_largefile() behaviour. Namely, if off_t is 64-bits long, we have no reason to reject user to open big files. Signed-off-by: Yury Norov <ynorov@caviumnetworks.com> --- arch/Kconfig | 4 ++++ arch/arc/Kconfig | 1 + arch/arm/Kconfig | 1 + arch/blackfin/Kconfig | 1 + arch/cris/Kconfig | 1 + arch/frv/Kconfig | 1 + arch/h8300/Kconfig | 1 + arch/hexagon/Kconfig | 1 + arch/ia64/Kconfig | 1 + arch/m32r/Kconfig | 1 + arch/m68k/Kconfig | 1 + arch/metag/Kconfig | 1 + arch/microblaze/Kconfig | 1 + arch/mips/Kconfig | 1 + arch/mn10300/Kconfig | 1 + arch/nios2/Kconfig | 1 + arch/openrisc/Kconfig | 1 + arch/parisc/Kconfig | 1 + arch/powerpc/Kconfig | 1 + arch/s390/Kconfig | 1 + arch/score/Kconfig | 1 + arch/sh/Kconfig | 1 + arch/sparc/Kconfig | 1 + arch/tile/Kconfig | 1 + arch/unicore32/Kconfig | 1 + arch/x86/Kconfig | 1 + arch/x86/um/Kconfig | 1 + arch/xtensa/Kconfig | 1 + include/linux/fcntl.h | 3 ++- 29 files changed, 33 insertions(+), 1 deletion(-) diff --git a/arch/Kconfig b/arch/Kconfig index 4e949e5..1e5e6c8 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -233,6 +233,10 @@ config ARCH_THREAD_INFO_ALLOCATOR config ARCH_WANTS_DYNAMIC_TASK_STRUCT bool +config ARCH_32BIT_OFF_T + def_bool n + depends on !64BIT + config HAVE_REGS_AND_STACK_ACCESS_API bool help diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 6312f60..570dc39 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -9,6 +9,7 @@ config ARC def_bool y select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC + select ARCH_32BIT_OFF_T select BUILDTIME_EXTABLE_SORT select COMMON_CLK select CLONE_BACKWARDS diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 34e1569..dafdebe 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1,6 +1,7 @@ config ARM bool default y + select ARCH_32BIT_OFF_T select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index af76634..9b5fc06 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig @@ -12,6 +12,7 @@ config RWSEM_XCHGADD_ALGORITHM config BLACKFIN def_bool y + select ARCH_32BIT_OFF_T select HAVE_ARCH_KGDB select HAVE_ARCH_TRACEHOOK select HAVE_DYNAMIC_FTRACE diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig index e086f9e..5bc9203 100644 --- a/arch/cris/Kconfig +++ b/arch/cris/Kconfig @@ -50,6 +50,7 @@ config LOCKDEP_SUPPORT config CRIS bool default y + select ARCH_32BIT_OFF_T select HAVE_IDE select GENERIC_ATOMIC64 select HAVE_UID16 diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index 34aa193..09b82fc 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig @@ -1,6 +1,7 @@ config FRV bool default y + select ARCH_32BIT_OFF_T select HAVE_IDE select HAVE_ARCH_TRACEHOOK select HAVE_PERF_EVENTS diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index dd3ac75..7761f4a 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig @@ -1,5 +1,6 @@ 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 4dc89d1..29836fc 100644 --- a/arch/hexagon/Kconfig +++ b/arch/hexagon/Kconfig @@ -3,6 +3,7 @@ comment "Linux Kernel Configuration for Hexagon" config HEXAGON def_bool y + select ARCH_32BIT_OFF_T select HAVE_OPROFILE # Other pending projects/to-do items. # select HAVE_REGS_AND_STACK_ACCESS_API diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index eb0249e..370fcab 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -11,6 +11,7 @@ menu "Processor type and features" config IA64 bool + select ARCH_32BIT_OFF_T if !64BIT select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO select PCI if (!IA64_HP_SIM) diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig index 9e44bbd..c6865a9 100644 --- a/arch/m32r/Kconfig +++ b/arch/m32r/Kconfig @@ -1,6 +1,7 @@ config M32R bool default y + select ARCH_32BIT_OFF_T select HAVE_IDE select HAVE_OPROFILE select INIT_ALL_POSSIBLE diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 498b567..e9897e4 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -1,6 +1,7 @@ config M68K bool default y + select ARCH_32BIT_OFF_T select ARCH_MIGHT_HAVE_PC_PARPORT if ISA select HAVE_IDE select HAVE_AOUT if MMU diff --git a/arch/metag/Kconfig b/arch/metag/Kconfig index 0b389a8..6b44d37 100644 --- a/arch/metag/Kconfig +++ b/arch/metag/Kconfig @@ -1,5 +1,6 @@ config METAG def_bool y + select ARCH_32BIT_OFF_T select EMBEDDED select GENERIC_ATOMIC64 select GENERIC_CLOCKEVENTS diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index 0bce820..4b293e5 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_HAS_GCOV_PROFILE_ALL select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_WANT_IPC_PARSE_VERSION diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 71683a8..2e42c26 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -1,6 +1,7 @@ config MIPS bool default y + select ARCH_32BIT_OFF_T if !64BIT select ARCH_SUPPORTS_UPROBES select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig index 78ae555..edf7372 100644 --- a/arch/mn10300/Kconfig +++ b/arch/mn10300/Kconfig @@ -1,5 +1,6 @@ config MN10300 def_bool y + select ARCH_32BIT_OFF_T select HAVE_OPROFILE select HAVE_UID16 select GENERIC_IRQ_SHOW diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig index 4375554..a38fc38 100644 --- a/arch/nios2/Kconfig +++ b/arch/nios2/Kconfig @@ -1,5 +1,6 @@ config NIOS2 def_bool y + select ARCH_32BIT_OFF_T select ARCH_WANT_OPTIONAL_GPIOLIB select CLKSRC_OF select GENERIC_ATOMIC64 diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig index 443f44d..7bef847 100644 --- a/arch/openrisc/Kconfig +++ b/arch/openrisc/Kconfig @@ -5,6 +5,7 @@ config OPENRISC def_bool y + select ARCH_32BIT_OFF_T select OF select OF_EARLY_FLATTREE select IRQ_DOMAIN diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index 729f891..8bf0fe2 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -1,5 +1,6 @@ config PARISC def_bool y + select ARCH_32BIT_OFF_T if !64BIT select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS select ARCH_MIGHT_HAVE_PC_PARPORT select HAVE_IDE diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index db49e0d..2026a9e 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -7,6 +7,7 @@ config PPC32 config 32BIT bool default y if PPC32 + select ARCH_32BIT_OFF_T config 64BIT bool diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 3a55f49..d05a143 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -64,6 +64,7 @@ config ARCH_SUPPORTS_UPROBES config S390 def_bool y + select ARCH_32BIT_OFF_T if !64BIT select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS select ARCH_HAS_ELF_RANDOMIZE diff --git a/arch/score/Kconfig b/arch/score/Kconfig index 366e1b5..bc7bc7a 100644 --- a/arch/score/Kconfig +++ b/arch/score/Kconfig @@ -2,6 +2,7 @@ menu "Machine selection" config SCORE def_bool y + select ARCH_32BIT_OFF_T select GENERIC_IRQ_SHOW select GENERIC_IOMAP select GENERIC_ATOMIC64 diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index d514df7e..1e9d63a 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -52,6 +52,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 56442d2..1268a2a 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -46,6 +46,7 @@ config SPARC config SPARC32 def_bool !64BIT + select ARCH_32BIT_OFF_T select GENERIC_ATOMIC64 select CLZ_TAB select HAVE_UID16 diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig index 106c21b..ef2e7ec 100644 --- a/arch/tile/Kconfig +++ b/arch/tile/Kconfig @@ -3,6 +3,7 @@ config TILE def_bool y + select ARCH_32BIT_OFF_T if !64BIT select HAVE_PERF_EVENTS select USE_PMC if PERF_EVENTS select HAVE_DMA_ATTRS diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig index c9faddc..1a8c3c0 100644 --- a/arch/unicore32/Kconfig +++ b/arch/unicore32/Kconfig @@ -1,5 +1,6 @@ config UNICORE32 def_bool y + select ARCH_32BIT_OFF_T select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO select HAVE_MEMBLOCK diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index db3622f..cc16336 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -20,6 +20,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_DISCARD_MEMBLOCK select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE diff --git a/arch/x86/um/Kconfig b/arch/x86/um/Kconfig index ed56a1c..8436bcd 100644 --- a/arch/x86/um/Kconfig +++ b/arch/x86/um/Kconfig @@ -21,6 +21,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 82044f7..7ff155a 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig @@ -3,6 +3,7 @@ config ZONE_DMA config XTENSA def_bool y + select ARCH_32BIT_OFF_T select ARCH_WANT_FRAME_POINTERS select ARCH_WANT_IPC_PARSE_VERSION select ARCH_WANT_OPTIONAL_GPIOLIB diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h index 76ce329..2e27443 100644 --- a/include/linux/fcntl.h +++ b/include/linux/fcntl.h @@ -5,7 +5,8 @@ #ifndef force_o_largefile -#define force_o_largefile() (BITS_PER_LONG != 32) +#define force_o_largefile() ((BITS_PER_LONG != 32) \ + || !IS_ENABLED(CONFIG_ARCH_32BIT_OFF_T)) #endif #if BITS_PER_LONG == 32 -- 2.5.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] 32-bit ABI: introduce ARCH_32BIT_OFF_T config option 2015-12-26 16:06 ` [PATCH 2/2] 32-bit ABI: introduce ARCH_32BIT_OFF_T config option Yury Norov @ 2015-12-28 11:38 ` Arnd Bergmann 0 siblings, 0 replies; 8+ messages in thread From: Arnd Bergmann @ 2015-12-28 11:38 UTC (permalink / raw) To: Yury Norov; +Cc: linux-arch, linux-kernel, klimov.linux On Saturday 26 December 2015 19:06:40 Yury Norov wrote: > All new 32-bit architectures should have 64-bit off_t type, but existing > architectures has 32-bit ones. It's worth mentioning here that ever the architectures that only have 64-bit off_t in the kernel ( arc, c6x, h8300, hexagon, metag, nios2, opernrisc, tile32 and unicore32) may use a libc with 32-bit off_t in their libc, and therefore want to limit the file size to 4GB unless specified differently in the open flags. > To handle it, new config option is added to arch/Kconfig that defaults > ARCH_32BIT_OFF_T to be disabled by default. All existing 32-bit architectures > enable it explicitly here. > > New option affects force_o_largefile() behaviour. Namely, if off_t is > 64-bits long, we have no reason to reject user to open big files. > > Signed-off-by: Yury Norov <ynorov@caviumnetworks.com> The patch looks mostly right, just a few stylistic comments: > diff --git a/arch/Kconfig b/arch/Kconfig > index 4e949e5..1e5e6c8 100644 > --- a/arch/Kconfig > +++ b/arch/Kconfig > @@ -233,6 +233,10 @@ config ARCH_THREAD_INFO_ALLOCATOR > config ARCH_WANTS_DYNAMIC_TASK_STRUCT > bool > > +config ARCH_32BIT_OFF_T > + def_bool n > + depends on !64BIT 'bool' is the same as 'def_bool n', and the former is more common, so please use that. > --- a/arch/ia64/Kconfig > +++ b/arch/ia64/Kconfig > @@ -11,6 +11,7 @@ menu "Processor type and features" > > config IA64 > bool > + select ARCH_32BIT_OFF_T if !64BIT > select ARCH_MIGHT_HAVE_PC_PARPORT > select ARCH_MIGHT_HAVE_PC_SERIO > select PCI if (!IA64_HP_SIM) No need to patch IA64, we don't support 32-bit kernels on that architecture > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig > index db49e0d..2026a9e 100644 > --- a/arch/powerpc/Kconfig > +++ b/arch/powerpc/Kconfig > @@ -7,6 +7,7 @@ config PPC32 > config 32BIT > bool > default y if PPC32 > + select ARCH_32BIT_OFF_T > > config 64BIT > bool It seems the preferred way of writing this in powerpc is to put select ARCH_32BIT_OFF_T if PPC32 under config PPC > diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig > index 3a55f49..d05a143 100644 > --- a/arch/s390/Kconfig > +++ b/arch/s390/Kconfig > @@ -64,6 +64,7 @@ config ARCH_SUPPORTS_UPROBES > > config S390 > def_bool y > + select ARCH_32BIT_OFF_T if !64BIT > select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE > select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS > select ARCH_HAS_ELF_RANDOMIZE 32-bit s390 support was removed some time ago, so this is no longer needed. > diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h > index 76ce329..2e27443 100644 > --- a/include/linux/fcntl.h > +++ b/include/linux/fcntl.h > @@ -5,7 +5,8 @@ > > > #ifndef force_o_largefile > -#define force_o_largefile() (BITS_PER_LONG != 32) > +#define force_o_largefile() ((BITS_PER_LONG != 32) \ > + || !IS_ENABLED(CONFIG_ARCH_32BIT_OFF_T)) > #endif > > #if BITS_PER_LONG == 32 I just realized that while I suggested the expression you wrote here, the BITS_PER_LONG check isn't actually needed, we can just make it #define force_o_largefile() (!IS_ENABLED(CONFIG_ARCH_32BIT_OFF_T)) Arnd ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 0/2] ABI: handle 32-bit off_t for 32-bit and compat ABIs @ 2015-12-29 9:26 Yury Norov 2015-12-29 9:26 ` [PATCH 1/2] compat ABI: use non-compat openat and open_by_handle_at variants Yury Norov 0 siblings, 1 reply; 8+ messages in thread From: Yury Norov @ 2015-12-29 9:26 UTC (permalink / raw) To: arnd, cmetcalf, linux-arch; +Cc: linux-kernel, klimov.linux, Yury Norov 32-bit off_t is supported only for old 32-bit and compat ABIs. New ABIs are 64-bit length only. This patchset makes 64-bit length the default for off_t, and reverts it for old architectures where needed. It does not change the behaviour of existing code. First patch makes all compat users of generic unistd.h to use non-compat versions of openat and open_by_handle_at. Tile that requires old behaviour is turned around. Second patch introduces ARCH_32BIT_OFF_T config option, disabled by default, but enables it explicitly for existing 32-bit architectures. v2: - removed ARCH_32BIT_OFF_T for IA64, s390, as 32-bit kernels are not supported there. - patch 2: added Arnd's note, - patch 2: stylistic changes. Yury Norov (2): ABI: compat: use non-compat openat and open_by_handle_at variants 32-bit ABI: introduce ARCH_32BIT_OFF_T config option arch/Kconfig | 4 ++++ arch/arc/Kconfig | 1 + arch/arm/Kconfig | 1 + arch/blackfin/Kconfig | 1 + arch/cris/Kconfig | 1 + arch/frv/Kconfig | 1 + arch/h8300/Kconfig | 1 + arch/hexagon/Kconfig | 1 + arch/ia64/Kconfig | 1 + arch/m32r/Kconfig | 1 + arch/m68k/Kconfig | 1 + arch/metag/Kconfig | 1 + arch/microblaze/Kconfig | 1 + arch/mips/Kconfig | 1 + arch/mn10300/Kconfig | 1 + arch/nios2/Kconfig | 1 + arch/openrisc/Kconfig | 1 + arch/parisc/Kconfig | 1 + arch/powerpc/Kconfig | 1 + arch/s390/Kconfig | 1 + arch/score/Kconfig | 1 + arch/sh/Kconfig | 1 + arch/sparc/Kconfig | 1 + arch/tile/Kconfig | 1 + arch/tile/kernel/compat.c | 3 +++ arch/unicore32/Kconfig | 1 + arch/x86/Kconfig | 1 + arch/x86/um/Kconfig | 1 + arch/xtensa/Kconfig | 1 + include/linux/fcntl.h | 3 ++- include/uapi/asm-generic/unistd.h | 5 ++--- 31 files changed, 38 insertions(+), 4 deletions(-) -- 2.5.0 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] compat ABI: use non-compat openat and open_by_handle_at variants 2015-12-29 9:26 [PATCH v2 0/2] ABI: handle 32-bit off_t for 32-bit and compat ABIs Yury Norov @ 2015-12-29 9:26 ` Yury Norov 0 siblings, 0 replies; 8+ messages in thread From: Yury Norov @ 2015-12-29 9:26 UTC (permalink / raw) To: arnd, cmetcalf, linux-arch; +Cc: linux-kernel, klimov.linux, Yury Norov The only difference is that non-compat version forces O_LARGEFILE, and it should be the default behaviour for all architectures, as we don't support 32-bit off_t. The only exception is tile32, that continues with compat version of syscalls. Signed-off-by: Yury Norov <ynorov@caviumnetworks.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Chris Metcalf <cmetcalf@ezchip.com> [for tile] --- arch/tile/kernel/compat.c | 3 +++ include/uapi/asm-generic/unistd.h | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c index 4912084..489ae19 100644 --- a/arch/tile/kernel/compat.c +++ b/arch/tile/kernel/compat.c @@ -94,6 +94,9 @@ COMPAT_SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned int, offset_high, #define compat_sys_readahead sys32_readahead #define sys_llseek compat_sys_llseek +#define sys_openat compat_sys_openat +#define sys_open_by_handle_at compat_sys_open_by_handle_at + /* Call the assembly trampolines where necessary. */ #define compat_sys_rt_sigreturn _compat_sys_rt_sigreturn #define sys_clone _sys_clone diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index 1324b02..07761e5 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h @@ -175,7 +175,7 @@ __SYSCALL(__NR_fchownat, sys_fchownat) #define __NR_fchown 55 __SYSCALL(__NR_fchown, sys_fchown) #define __NR_openat 56 -__SC_COMP(__NR_openat, sys_openat, compat_sys_openat) +__SYSCALL(__NR_openat, sys_openat) #define __NR_close 57 __SYSCALL(__NR_close, sys_close) #define __NR_vhangup 58 @@ -673,8 +673,7 @@ __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) #define __NR_name_to_handle_at 264 __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) #define __NR_open_by_handle_at 265 -__SC_COMP(__NR_open_by_handle_at, sys_open_by_handle_at, \ - compat_sys_open_by_handle_at) +__SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) #define __NR_clock_adjtime 266 __SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime) #define __NR_syncfs 267 -- 2.5.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Resend PATCH v2 0/2] ABI: handle 32-bit off_t for 32-bit and compat ABIs @ 2016-11-08 10:32 Yury Norov 2016-11-08 10:32 ` [PATCH 1/2] compat ABI: use non-compat openat and open_by_handle_at variants Yury Norov 0 siblings, 1 reply; 8+ messages in thread From: Yury Norov @ 2016-11-08 10:32 UTC (permalink / raw) To: linux-kernel, linux-arch, arnd; +Cc: cmetcalf, tglx, Yury Norov 32-bit off_t is supported only for old 32-bit and compat ABIs. New ABIs are 64-bit length only. This patchset makes 64-bit length the default for off_t, and reverts it for old architectures where needed. It does not change the behaviour of existing code. First patch makes all compat users of generic unistd.h to use non-compat versions of openat and open_by_handle_at. Tile that requires old behaviour is turned around. Second patch introduces ARCH_32BIT_OFF_T config option, disabled by default, but enables it explicitly for existing 32-bit architectures. Original submission: http://lists-archives.com/linux-kernel/28471158-abi-handle-32-bit-off_t-for-32-bit-and-compat-abis.html This is the same series that I sent in Dec 29. In arm64 ilp32 this patches are melded, but Chris asked to split it. So I decided to resend old series. Here is no changes, it's only rebased on 4.9-rc4. Yury Norov (2): compat ABI: use non-compat openat and open_by_handle_at variants 32-bit ABI: introduce ARCH_32BIT_OFF_T config option arch/Kconfig | 4 ++++ arch/arc/Kconfig | 1 + arch/arm/Kconfig | 1 + arch/blackfin/Kconfig | 1 + arch/cris/Kconfig | 1 + arch/frv/Kconfig | 1 + arch/h8300/Kconfig | 1 + arch/hexagon/Kconfig | 1 + arch/m32r/Kconfig | 1 + arch/m68k/Kconfig | 1 + arch/metag/Kconfig | 1 + arch/microblaze/Kconfig | 1 + arch/mips/Kconfig | 1 + arch/mn10300/Kconfig | 1 + arch/nios2/Kconfig | 1 + arch/openrisc/Kconfig | 1 + arch/parisc/Kconfig | 1 + arch/powerpc/Kconfig | 1 + arch/score/Kconfig | 1 + arch/sh/Kconfig | 1 + arch/sparc/Kconfig | 1 + arch/tile/Kconfig | 1 + arch/tile/kernel/compat.c | 3 +++ arch/unicore32/Kconfig | 1 + arch/x86/Kconfig | 1 + arch/x86/um/Kconfig | 1 + arch/xtensa/Kconfig | 1 + include/linux/fcntl.h | 2 +- include/uapi/asm-generic/unistd.h | 5 ++--- 29 files changed, 35 insertions(+), 4 deletions(-) -- 2.7.4 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] compat ABI: use non-compat openat and open_by_handle_at variants 2016-11-08 10:32 [Resend PATCH v2 0/2] ABI: handle 32-bit off_t for 32-bit and compat ABIs Yury Norov @ 2016-11-08 10:32 ` Yury Norov 0 siblings, 0 replies; 8+ messages in thread From: Yury Norov @ 2016-11-08 10:32 UTC (permalink / raw) To: linux-kernel, linux-arch, arnd; +Cc: cmetcalf, tglx, Yury Norov The only difference is that non-compat version forces O_LARGEFILE, and it should be the default behaviour for all architectures, as we don't support 32-bit off_t. The only exception is tile32, that continues with compat version of syscalls. Signed-off-by: Yury Norov <ynorov@caviumnetworks.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Chris Metcalf <cmetcalf@ezchip.com> [for tile] --- arch/tile/kernel/compat.c | 3 +++ include/uapi/asm-generic/unistd.h | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c index bdaf71d..3b7853c 100644 --- a/arch/tile/kernel/compat.c +++ b/arch/tile/kernel/compat.c @@ -103,6 +103,9 @@ COMPAT_SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned int, offset_high, #define compat_sys_readahead sys32_readahead #define sys_llseek compat_sys_llseek +#define sys_openat compat_sys_openat +#define sys_open_by_handle_at compat_sys_open_by_handle_at + /* Call the assembly trampolines where necessary. */ #define compat_sys_rt_sigreturn _compat_sys_rt_sigreturn #define sys_clone _sys_clone diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index 9b1462e..a6062be 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h @@ -178,7 +178,7 @@ __SYSCALL(__NR_fchownat, sys_fchownat) #define __NR_fchown 55 __SYSCALL(__NR_fchown, sys_fchown) #define __NR_openat 56 -__SC_COMP(__NR_openat, sys_openat, compat_sys_openat) +__SYSCALL(__NR_openat, sys_openat) #define __NR_close 57 __SYSCALL(__NR_close, sys_close) #define __NR_vhangup 58 @@ -676,8 +676,7 @@ __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) #define __NR_name_to_handle_at 264 __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) #define __NR_open_by_handle_at 265 -__SC_COMP(__NR_open_by_handle_at, sys_open_by_handle_at, \ - compat_sys_open_by_handle_at) +__SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) #define __NR_clock_adjtime 266 __SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime) #define __NR_syncfs 267 -- 2.7.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-11-08 11:11 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-12-26 16:06 [PATCH 0/2] ABI: handle 32-bit off_t for 32-bit and compat ABIs Yury Norov 2015-12-26 16:06 ` [PATCH 1/2] compat ABI: use non-compat openat and open_by_handle_at variants Yury Norov 2015-12-28 11:18 ` Arnd Bergmann 2015-12-28 17:57 ` Chris Metcalf 2015-12-26 16:06 ` [PATCH 2/2] 32-bit ABI: introduce ARCH_32BIT_OFF_T config option Yury Norov 2015-12-28 11:38 ` Arnd Bergmann -- strict thread matches above, loose matches on Subject: below -- 2015-12-29 9:26 [PATCH v2 0/2] ABI: handle 32-bit off_t for 32-bit and compat ABIs Yury Norov 2015-12-29 9:26 ` [PATCH 1/2] compat ABI: use non-compat openat and open_by_handle_at variants Yury Norov 2016-11-08 10:32 [Resend PATCH v2 0/2] ABI: handle 32-bit off_t for 32-bit and compat ABIs Yury Norov 2016-11-08 10:32 ` [PATCH 1/2] compat ABI: use non-compat openat and open_by_handle_at variants Yury Norov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox