All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] arm64 compat syscall table clean-up
@ 2015-01-09 15:57 ` Catalin Marinas
  0 siblings, 0 replies; 20+ messages in thread
From: Catalin Marinas @ 2015-01-09 15:57 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-kernel, Arnd Bergmann, Andrew Morton

This series moves the arm64 compat_sys_call_table from .S to a .c file
for consistency with the native syscalls and also for detecting when the
real number of compat system calls and the __NR_compat_syscalls
definition are out of sync.

The first two patches, however, touch some generic header file, hence
Andrew and Arnd on cc.

Catalin Marinas (4):
  compat: Declare compat_sys_sigpending and compat_sys_sigprocmask
    prototypes
  syscalls: Declare sys_*stat64 prototypes if
    __ARCH_WANT_(COMPAT_)STAT64
  arm64: Implement the compat_sys_call_table in C
  arm64: Remove asm/syscalls.h

Mark Rutland (1):
  arm64: make sys_call_table const

 arch/arm64/include/asm/syscalls.h        | 30 -------------------
 arch/arm64/include/asm/unistd.h          |  3 ++
 arch/arm64/kernel/Makefile               |  2 +-
 arch/arm64/kernel/entry.S                |  2 +-
 arch/arm64/kernel/{sys32.S => entry32.S} | 34 ++++++++-------------
 arch/arm64/kernel/sys.c                  |  5 ++--
 arch/arm64/kernel/sys32.c                | 51 ++++++++++++++++++++++++++++++++
 include/linux/compat.h                   |  9 ++++++
 include/linux/syscalls.h                 |  8 +++--
 9 files changed, 84 insertions(+), 60 deletions(-)
 delete mode 100644 arch/arm64/include/asm/syscalls.h
 rename arch/arm64/kernel/{sys32.S => entry32.S} (80%)
 create mode 100644 arch/arm64/kernel/sys32.c


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 0/5] arm64 compat syscall table clean-up
@ 2015-01-09 15:57 ` Catalin Marinas
  0 siblings, 0 replies; 20+ messages in thread
From: Catalin Marinas @ 2015-01-09 15:57 UTC (permalink / raw)
  To: linux-arm-kernel

This series moves the arm64 compat_sys_call_table from .S to a .c file
for consistency with the native syscalls and also for detecting when the
real number of compat system calls and the __NR_compat_syscalls
definition are out of sync.

The first two patches, however, touch some generic header file, hence
Andrew and Arnd on cc.

Catalin Marinas (4):
  compat: Declare compat_sys_sigpending and compat_sys_sigprocmask
    prototypes
  syscalls: Declare sys_*stat64 prototypes if
    __ARCH_WANT_(COMPAT_)STAT64
  arm64: Implement the compat_sys_call_table in C
  arm64: Remove asm/syscalls.h

Mark Rutland (1):
  arm64: make sys_call_table const

 arch/arm64/include/asm/syscalls.h        | 30 -------------------
 arch/arm64/include/asm/unistd.h          |  3 ++
 arch/arm64/kernel/Makefile               |  2 +-
 arch/arm64/kernel/entry.S                |  2 +-
 arch/arm64/kernel/{sys32.S => entry32.S} | 34 ++++++++-------------
 arch/arm64/kernel/sys.c                  |  5 ++--
 arch/arm64/kernel/sys32.c                | 51 ++++++++++++++++++++++++++++++++
 include/linux/compat.h                   |  9 ++++++
 include/linux/syscalls.h                 |  8 +++--
 9 files changed, 84 insertions(+), 60 deletions(-)
 delete mode 100644 arch/arm64/include/asm/syscalls.h
 rename arch/arm64/kernel/{sys32.S => entry32.S} (80%)
 create mode 100644 arch/arm64/kernel/sys32.c

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/5] compat: Declare compat_sys_sigpending and compat_sys_sigprocmask prototypes
  2015-01-09 15:57 ` Catalin Marinas
@ 2015-01-09 15:57   ` Catalin Marinas
  -1 siblings, 0 replies; 20+ messages in thread
From: Catalin Marinas @ 2015-01-09 15:57 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-kernel, Arnd Bergmann, Andrew Morton

__ARCH_WANT_SYS_SIGPENDING or __ARCH_WANT_SYS_SIGPROGMASK may be defined
for compat support but the corresponding prototypes are missing from
linux/compat.h.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/compat.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/linux/compat.h b/include/linux/compat.h
index 7450ca2ac1fc..ab25814690bc 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -689,6 +689,15 @@ asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
 asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
 				       compat_stack_t __user *uoss_ptr);
 
+#ifdef __ARCH_WANT_SYS_SIGPENDING
+asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set);
+#endif
+
+#ifdef __ARCH_WANT_SYS_SIGPROCMASK
+asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *nset,
+				       compat_old_sigset_t __user *oset);
+#endif
+
 int compat_restore_altstack(const compat_stack_t __user *uss);
 int __compat_save_altstack(compat_stack_t __user *, unsigned long);
 #define compat_save_altstack_ex(uss, sp) do { \

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 1/5] compat: Declare compat_sys_sigpending and compat_sys_sigprocmask prototypes
@ 2015-01-09 15:57   ` Catalin Marinas
  0 siblings, 0 replies; 20+ messages in thread
From: Catalin Marinas @ 2015-01-09 15:57 UTC (permalink / raw)
  To: linux-arm-kernel

__ARCH_WANT_SYS_SIGPENDING or __ARCH_WANT_SYS_SIGPROGMASK may be defined
for compat support but the corresponding prototypes are missing from
linux/compat.h.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/compat.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/linux/compat.h b/include/linux/compat.h
index 7450ca2ac1fc..ab25814690bc 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -689,6 +689,15 @@ asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
 asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
 				       compat_stack_t __user *uoss_ptr);
 
+#ifdef __ARCH_WANT_SYS_SIGPENDING
+asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set);
+#endif
+
+#ifdef __ARCH_WANT_SYS_SIGPROCMASK
+asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *nset,
+				       compat_old_sigset_t __user *oset);
+#endif
+
 int compat_restore_altstack(const compat_stack_t __user *uss);
 int __compat_save_altstack(compat_stack_t __user *, unsigned long);
 #define compat_save_altstack_ex(uss, sp) do { \

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/5] syscalls: Declare sys_*stat64 prototypes if __ARCH_WANT_(COMPAT_)STAT64
  2015-01-09 15:57 ` Catalin Marinas
@ 2015-01-09 15:57   ` Catalin Marinas
  -1 siblings, 0 replies; 20+ messages in thread
From: Catalin Marinas @ 2015-01-09 15:57 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-kernel, Arnd Bergmann, Andrew Morton

Currently, the sys_stat64, sys_fstat64 and sys_lstat64 prototpyes are
only declared if BITS_PER_LONG == 32. Following commit 0753f70f07fb
(fs: Build sys_stat64() and friends if __ARCH_WANT_COMPAT_STAT64), the
implementation of these functions is allowed on 64-bit systems for
compat support. The patch changes the condition on the prototype
declaration from BITS_PER_LONG == 32 to defined(__ARCH_WANT_STAT64) ||
defined(__ARCH_WANT_COMPAT_STAT64).

In addition, it moves the sys_fstatat64 prototype under the same #if
block

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/syscalls.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 85893d744901..76d1e38aabe1 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -410,12 +410,16 @@ asmlinkage long sys_newlstat(const char __user *filename,
 				struct stat __user *statbuf);
 asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf);
 asmlinkage long sys_ustat(unsigned dev, struct ustat __user *ubuf);
-#if BITS_PER_LONG == 32
+#if defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_COMPAT_STAT64)
 asmlinkage long sys_stat64(const char __user *filename,
 				struct stat64 __user *statbuf);
 asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user *statbuf);
 asmlinkage long sys_lstat64(const char __user *filename,
 				struct stat64 __user *statbuf);
+asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
+			       struct stat64 __user *statbuf, int flag);
+#endif
+#if BITS_PER_LONG == 32
 asmlinkage long sys_truncate64(const char __user *path, loff_t length);
 asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length);
 #endif
@@ -771,8 +775,6 @@ asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
 			   umode_t mode);
 asmlinkage long sys_newfstatat(int dfd, const char __user *filename,
 			       struct stat __user *statbuf, int flag);
-asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
-			       struct stat64 __user *statbuf, int flag);
 asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *buf,
 			       int bufsiz);
 asmlinkage long sys_utimensat(int dfd, const char __user *filename,

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/5] syscalls: Declare sys_*stat64 prototypes if __ARCH_WANT_(COMPAT_)STAT64
@ 2015-01-09 15:57   ` Catalin Marinas
  0 siblings, 0 replies; 20+ messages in thread
From: Catalin Marinas @ 2015-01-09 15:57 UTC (permalink / raw)
  To: linux-arm-kernel

Currently, the sys_stat64, sys_fstat64 and sys_lstat64 prototpyes are
only declared if BITS_PER_LONG == 32. Following commit 0753f70f07fb
(fs: Build sys_stat64() and friends if __ARCH_WANT_COMPAT_STAT64), the
implementation of these functions is allowed on 64-bit systems for
compat support. The patch changes the condition on the prototype
declaration from BITS_PER_LONG == 32 to defined(__ARCH_WANT_STAT64) ||
defined(__ARCH_WANT_COMPAT_STAT64).

In addition, it moves the sys_fstatat64 prototype under the same #if
block

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/syscalls.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 85893d744901..76d1e38aabe1 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -410,12 +410,16 @@ asmlinkage long sys_newlstat(const char __user *filename,
 				struct stat __user *statbuf);
 asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf);
 asmlinkage long sys_ustat(unsigned dev, struct ustat __user *ubuf);
-#if BITS_PER_LONG == 32
+#if defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_COMPAT_STAT64)
 asmlinkage long sys_stat64(const char __user *filename,
 				struct stat64 __user *statbuf);
 asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user *statbuf);
 asmlinkage long sys_lstat64(const char __user *filename,
 				struct stat64 __user *statbuf);
+asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
+			       struct stat64 __user *statbuf, int flag);
+#endif
+#if BITS_PER_LONG == 32
 asmlinkage long sys_truncate64(const char __user *path, loff_t length);
 asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length);
 #endif
@@ -771,8 +775,6 @@ asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
 			   umode_t mode);
 asmlinkage long sys_newfstatat(int dfd, const char __user *filename,
 			       struct stat __user *statbuf, int flag);
-asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
-			       struct stat64 __user *statbuf, int flag);
 asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *buf,
 			       int bufsiz);
 asmlinkage long sys_utimensat(int dfd, const char __user *filename,

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/5] arm64: Implement the compat_sys_call_table in C
  2015-01-09 15:57 ` Catalin Marinas
@ 2015-01-09 15:57   ` Catalin Marinas
  -1 siblings, 0 replies; 20+ messages in thread
From: Catalin Marinas @ 2015-01-09 15:57 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-kernel, Arnd Bergmann, Andrew Morton

Unlike the sys_call_table[], the compat one was implemented in sys32.S
making it impossible to notice discrepancies between the number of
compat syscalls and the __NR_compat_syscalls macro, the latter having to
be defined in asm/unistd.h as including asm/unistd32.h would cause
conflicts on __NR_* definitions. With this patch, incorrect
__NR_compat_syscalls values will result in a build-time error.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Suggested-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
---
 arch/arm64/include/asm/unistd.h          |  3 ++
 arch/arm64/kernel/Makefile               |  2 +-
 arch/arm64/kernel/entry.S                |  2 +-
 arch/arm64/kernel/{sys32.S => entry32.S} | 34 ++++++++-------------
 arch/arm64/kernel/sys32.c                | 51 ++++++++++++++++++++++++++++++++
 5 files changed, 68 insertions(+), 24 deletions(-)
 rename arch/arm64/kernel/{sys32.S => entry32.S} (80%)
 create mode 100644 arch/arm64/kernel/sys32.c

diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index b780c6c76eec..159b44fff258 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -48,6 +48,9 @@
 #endif
 
 #define __ARCH_WANT_SYS_CLONE
+
+#ifndef __COMPAT_SYSCALL_NR
 #include <uapi/asm/unistd.h>
+#endif
 
 #define NR_syscalls (__NR_syscalls)
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index eaa77ed7766a..54be7dc906f0 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -19,7 +19,7 @@ arm64-obj-y		:= cputable.o debug-monitors.o entry.o irq.o fpsimd.o	\
 			   cpuinfo.o cpu_errata.o alternative.o
 
 arm64-obj-$(CONFIG_COMPAT)		+= sys32.o kuser32.o signal32.o 	\
-					   sys_compat.o 			\
+					   sys_compat.o entry32.o		\
 					   ../../arm/kernel/opcodes.o
 arm64-obj-$(CONFIG_FUNCTION_TRACER)	+= ftrace.o entry-ftrace.o
 arm64-obj-$(CONFIG_MODULES)		+= arm64ksyms.o module.o
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index fd4fa374e5d2..39811ad31537 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -433,7 +433,7 @@ el0_svc_compat:
 	/*
 	 * AArch32 syscall handling
 	 */
-	adr	stbl, compat_sys_call_table	// load compat syscall table pointer
+	adrp	stbl, compat_sys_call_table	// load compat syscall table pointer
 	uxtw	scno, w7			// syscall number in w7 (r7)
 	mov     sc_nr, #__NR_compat_syscalls
 	b	el0_svc_naked
diff --git a/arch/arm64/kernel/sys32.S b/arch/arm64/kernel/entry32.S
similarity index 80%
rename from arch/arm64/kernel/sys32.S
rename to arch/arm64/kernel/entry32.S
index 423a5b3fc2be..9a8f6ae2530e 100644
--- a/arch/arm64/kernel/sys32.S
+++ b/arch/arm64/kernel/entry32.S
@@ -27,26 +27,26 @@
  * System call wrappers for the AArch32 compatibility layer.
  */
 
-compat_sys_sigreturn_wrapper:
+ENTRY(compat_sys_sigreturn_wrapper)
 	mov	x0, sp
 	mov	x27, #0		// prevent syscall restart handling (why)
 	b	compat_sys_sigreturn
 ENDPROC(compat_sys_sigreturn_wrapper)
 
-compat_sys_rt_sigreturn_wrapper:
+ENTRY(compat_sys_rt_sigreturn_wrapper)
 	mov	x0, sp
 	mov	x27, #0		// prevent syscall restart handling (why)
 	b	compat_sys_rt_sigreturn
 ENDPROC(compat_sys_rt_sigreturn_wrapper)
 
-compat_sys_statfs64_wrapper:
+ENTRY(compat_sys_statfs64_wrapper)
 	mov	w3, #84
 	cmp	w1, #88
 	csel	w1, w3, w1, eq
 	b	compat_sys_statfs64
 ENDPROC(compat_sys_statfs64_wrapper)
 
-compat_sys_fstatfs64_wrapper:
+ENTRY(compat_sys_fstatfs64_wrapper)
 	mov	w3, #84
 	cmp	w1, #88
 	csel	w1, w3, w1, eq
@@ -58,33 +58,33 @@ ENDPROC(compat_sys_fstatfs64_wrapper)
  * in registers or that take 32-bit parameters which require sign
  * extension.
  */
-compat_sys_pread64_wrapper:
+ENTRY(compat_sys_pread64_wrapper)
 	regs_to_64	x3, x4, x5
 	b	sys_pread64
 ENDPROC(compat_sys_pread64_wrapper)
 
-compat_sys_pwrite64_wrapper:
+ENTRY(compat_sys_pwrite64_wrapper)
 	regs_to_64	x3, x4, x5
 	b	sys_pwrite64
 ENDPROC(compat_sys_pwrite64_wrapper)
 
-compat_sys_truncate64_wrapper:
+ENTRY(compat_sys_truncate64_wrapper)
 	regs_to_64	x1, x2, x3
 	b	sys_truncate
 ENDPROC(compat_sys_truncate64_wrapper)
 
-compat_sys_ftruncate64_wrapper:
+ENTRY(compat_sys_ftruncate64_wrapper)
 	regs_to_64	x1, x2, x3
 	b	sys_ftruncate
 ENDPROC(compat_sys_ftruncate64_wrapper)
 
-compat_sys_readahead_wrapper:
+ENTRY(compat_sys_readahead_wrapper)
 	regs_to_64	x1, x2, x3
 	mov	w2, w4
 	b	sys_readahead
 ENDPROC(compat_sys_readahead_wrapper)
 
-compat_sys_fadvise64_64_wrapper:
+ENTRY(compat_sys_fadvise64_64_wrapper)
 	mov	w6, w1
 	regs_to_64	x1, x2, x3
 	regs_to_64	x2, x4, x5
@@ -92,24 +92,14 @@ compat_sys_fadvise64_64_wrapper:
 	b	sys_fadvise64_64
 ENDPROC(compat_sys_fadvise64_64_wrapper)
 
-compat_sys_sync_file_range2_wrapper:
+ENTRY(compat_sys_sync_file_range2_wrapper)
 	regs_to_64	x2, x2, x3
 	regs_to_64	x3, x4, x5
 	b	sys_sync_file_range2
 ENDPROC(compat_sys_sync_file_range2_wrapper)
 
-compat_sys_fallocate_wrapper:
+ENTRY(compat_sys_fallocate_wrapper)
 	regs_to_64	x2, x2, x3
 	regs_to_64	x3, x4, x5
 	b	sys_fallocate
 ENDPROC(compat_sys_fallocate_wrapper)
-
-#undef __SYSCALL
-#define __SYSCALL(x, y)		.quad	y	// x
-
-/*
- * The system calls table must be 4KB aligned.
- */
-	.align	12
-ENTRY(compat_sys_call_table)
-#include <asm/unistd32.h>
diff --git a/arch/arm64/kernel/sys32.c b/arch/arm64/kernel/sys32.c
new file mode 100644
index 000000000000..2d5ab3c90b82
--- /dev/null
+++ b/arch/arm64/kernel/sys32.c
@@ -0,0 +1,51 @@
+/*
+ * arch/arm64/kernel/sys32.c
+ *
+ * Copyright (C) 2015 ARM Ltd.
+ *
+ * This program is free software(void); you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http(void);//www.gnu.org/licenses/>.
+ */
+
+/*
+ * Needed to avoid conflicting __NR_* macros between uapi/asm/unistd.h and
+ * asm/unistd32.h.
+ */
+#define __COMPAT_SYSCALL_NR
+
+#include <linux/compiler.h>
+#include <linux/syscalls.h>
+
+asmlinkage long compat_sys_sigreturn_wrapper(void);
+asmlinkage long compat_sys_rt_sigreturn_wrapper(void);
+asmlinkage long compat_sys_statfs64_wrapper(void);
+asmlinkage long compat_sys_fstatfs64_wrapper(void);
+asmlinkage long compat_sys_pread64_wrapper(void);
+asmlinkage long compat_sys_pwrite64_wrapper(void);
+asmlinkage long compat_sys_truncate64_wrapper(void);
+asmlinkage long compat_sys_ftruncate64_wrapper(void);
+asmlinkage long compat_sys_readahead_wrapper(void);
+asmlinkage long compat_sys_fadvise64_64_wrapper(void);
+asmlinkage long compat_sys_sync_file_range2_wrapper(void);
+asmlinkage long compat_sys_fallocate_wrapper(void);
+
+#undef __SYSCALL
+#define __SYSCALL(nr, sym)	[nr] = sym,
+
+/*
+ * The sys_call_table array must be 4K aligned to be accessible from
+ * kernel/entry.S.
+ */
+void * const compat_sys_call_table[__NR_compat_syscalls] __aligned(4096) = {
+	[0 ... __NR_compat_syscalls - 1] = sys_ni_syscall,
+#include <asm/unistd32.h>
+};

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/5] arm64: Implement the compat_sys_call_table in C
@ 2015-01-09 15:57   ` Catalin Marinas
  0 siblings, 0 replies; 20+ messages in thread
From: Catalin Marinas @ 2015-01-09 15:57 UTC (permalink / raw)
  To: linux-arm-kernel

Unlike the sys_call_table[], the compat one was implemented in sys32.S
making it impossible to notice discrepancies between the number of
compat syscalls and the __NR_compat_syscalls macro, the latter having to
be defined in asm/unistd.h as including asm/unistd32.h would cause
conflicts on __NR_* definitions. With this patch, incorrect
__NR_compat_syscalls values will result in a build-time error.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Suggested-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
---
 arch/arm64/include/asm/unistd.h          |  3 ++
 arch/arm64/kernel/Makefile               |  2 +-
 arch/arm64/kernel/entry.S                |  2 +-
 arch/arm64/kernel/{sys32.S => entry32.S} | 34 ++++++++-------------
 arch/arm64/kernel/sys32.c                | 51 ++++++++++++++++++++++++++++++++
 5 files changed, 68 insertions(+), 24 deletions(-)
 rename arch/arm64/kernel/{sys32.S => entry32.S} (80%)
 create mode 100644 arch/arm64/kernel/sys32.c

diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index b780c6c76eec..159b44fff258 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -48,6 +48,9 @@
 #endif
 
 #define __ARCH_WANT_SYS_CLONE
+
+#ifndef __COMPAT_SYSCALL_NR
 #include <uapi/asm/unistd.h>
+#endif
 
 #define NR_syscalls (__NR_syscalls)
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index eaa77ed7766a..54be7dc906f0 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -19,7 +19,7 @@ arm64-obj-y		:= cputable.o debug-monitors.o entry.o irq.o fpsimd.o	\
 			   cpuinfo.o cpu_errata.o alternative.o
 
 arm64-obj-$(CONFIG_COMPAT)		+= sys32.o kuser32.o signal32.o 	\
-					   sys_compat.o 			\
+					   sys_compat.o entry32.o		\
 					   ../../arm/kernel/opcodes.o
 arm64-obj-$(CONFIG_FUNCTION_TRACER)	+= ftrace.o entry-ftrace.o
 arm64-obj-$(CONFIG_MODULES)		+= arm64ksyms.o module.o
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index fd4fa374e5d2..39811ad31537 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -433,7 +433,7 @@ el0_svc_compat:
 	/*
 	 * AArch32 syscall handling
 	 */
-	adr	stbl, compat_sys_call_table	// load compat syscall table pointer
+	adrp	stbl, compat_sys_call_table	// load compat syscall table pointer
 	uxtw	scno, w7			// syscall number in w7 (r7)
 	mov     sc_nr, #__NR_compat_syscalls
 	b	el0_svc_naked
diff --git a/arch/arm64/kernel/sys32.S b/arch/arm64/kernel/entry32.S
similarity index 80%
rename from arch/arm64/kernel/sys32.S
rename to arch/arm64/kernel/entry32.S
index 423a5b3fc2be..9a8f6ae2530e 100644
--- a/arch/arm64/kernel/sys32.S
+++ b/arch/arm64/kernel/entry32.S
@@ -27,26 +27,26 @@
  * System call wrappers for the AArch32 compatibility layer.
  */
 
-compat_sys_sigreturn_wrapper:
+ENTRY(compat_sys_sigreturn_wrapper)
 	mov	x0, sp
 	mov	x27, #0		// prevent syscall restart handling (why)
 	b	compat_sys_sigreturn
 ENDPROC(compat_sys_sigreturn_wrapper)
 
-compat_sys_rt_sigreturn_wrapper:
+ENTRY(compat_sys_rt_sigreturn_wrapper)
 	mov	x0, sp
 	mov	x27, #0		// prevent syscall restart handling (why)
 	b	compat_sys_rt_sigreturn
 ENDPROC(compat_sys_rt_sigreturn_wrapper)
 
-compat_sys_statfs64_wrapper:
+ENTRY(compat_sys_statfs64_wrapper)
 	mov	w3, #84
 	cmp	w1, #88
 	csel	w1, w3, w1, eq
 	b	compat_sys_statfs64
 ENDPROC(compat_sys_statfs64_wrapper)
 
-compat_sys_fstatfs64_wrapper:
+ENTRY(compat_sys_fstatfs64_wrapper)
 	mov	w3, #84
 	cmp	w1, #88
 	csel	w1, w3, w1, eq
@@ -58,33 +58,33 @@ ENDPROC(compat_sys_fstatfs64_wrapper)
  * in registers or that take 32-bit parameters which require sign
  * extension.
  */
-compat_sys_pread64_wrapper:
+ENTRY(compat_sys_pread64_wrapper)
 	regs_to_64	x3, x4, x5
 	b	sys_pread64
 ENDPROC(compat_sys_pread64_wrapper)
 
-compat_sys_pwrite64_wrapper:
+ENTRY(compat_sys_pwrite64_wrapper)
 	regs_to_64	x3, x4, x5
 	b	sys_pwrite64
 ENDPROC(compat_sys_pwrite64_wrapper)
 
-compat_sys_truncate64_wrapper:
+ENTRY(compat_sys_truncate64_wrapper)
 	regs_to_64	x1, x2, x3
 	b	sys_truncate
 ENDPROC(compat_sys_truncate64_wrapper)
 
-compat_sys_ftruncate64_wrapper:
+ENTRY(compat_sys_ftruncate64_wrapper)
 	regs_to_64	x1, x2, x3
 	b	sys_ftruncate
 ENDPROC(compat_sys_ftruncate64_wrapper)
 
-compat_sys_readahead_wrapper:
+ENTRY(compat_sys_readahead_wrapper)
 	regs_to_64	x1, x2, x3
 	mov	w2, w4
 	b	sys_readahead
 ENDPROC(compat_sys_readahead_wrapper)
 
-compat_sys_fadvise64_64_wrapper:
+ENTRY(compat_sys_fadvise64_64_wrapper)
 	mov	w6, w1
 	regs_to_64	x1, x2, x3
 	regs_to_64	x2, x4, x5
@@ -92,24 +92,14 @@ compat_sys_fadvise64_64_wrapper:
 	b	sys_fadvise64_64
 ENDPROC(compat_sys_fadvise64_64_wrapper)
 
-compat_sys_sync_file_range2_wrapper:
+ENTRY(compat_sys_sync_file_range2_wrapper)
 	regs_to_64	x2, x2, x3
 	regs_to_64	x3, x4, x5
 	b	sys_sync_file_range2
 ENDPROC(compat_sys_sync_file_range2_wrapper)
 
-compat_sys_fallocate_wrapper:
+ENTRY(compat_sys_fallocate_wrapper)
 	regs_to_64	x2, x2, x3
 	regs_to_64	x3, x4, x5
 	b	sys_fallocate
 ENDPROC(compat_sys_fallocate_wrapper)
-
-#undef __SYSCALL
-#define __SYSCALL(x, y)		.quad	y	// x
-
-/*
- * The system calls table must be 4KB aligned.
- */
-	.align	12
-ENTRY(compat_sys_call_table)
-#include <asm/unistd32.h>
diff --git a/arch/arm64/kernel/sys32.c b/arch/arm64/kernel/sys32.c
new file mode 100644
index 000000000000..2d5ab3c90b82
--- /dev/null
+++ b/arch/arm64/kernel/sys32.c
@@ -0,0 +1,51 @@
+/*
+ * arch/arm64/kernel/sys32.c
+ *
+ * Copyright (C) 2015 ARM Ltd.
+ *
+ * This program is free software(void); you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http(void);//www.gnu.org/licenses/>.
+ */
+
+/*
+ * Needed to avoid conflicting __NR_* macros between uapi/asm/unistd.h and
+ * asm/unistd32.h.
+ */
+#define __COMPAT_SYSCALL_NR
+
+#include <linux/compiler.h>
+#include <linux/syscalls.h>
+
+asmlinkage long compat_sys_sigreturn_wrapper(void);
+asmlinkage long compat_sys_rt_sigreturn_wrapper(void);
+asmlinkage long compat_sys_statfs64_wrapper(void);
+asmlinkage long compat_sys_fstatfs64_wrapper(void);
+asmlinkage long compat_sys_pread64_wrapper(void);
+asmlinkage long compat_sys_pwrite64_wrapper(void);
+asmlinkage long compat_sys_truncate64_wrapper(void);
+asmlinkage long compat_sys_ftruncate64_wrapper(void);
+asmlinkage long compat_sys_readahead_wrapper(void);
+asmlinkage long compat_sys_fadvise64_64_wrapper(void);
+asmlinkage long compat_sys_sync_file_range2_wrapper(void);
+asmlinkage long compat_sys_fallocate_wrapper(void);
+
+#undef __SYSCALL
+#define __SYSCALL(nr, sym)	[nr] = sym,
+
+/*
+ * The sys_call_table array must be 4K aligned to be accessible from
+ * kernel/entry.S.
+ */
+void * const compat_sys_call_table[__NR_compat_syscalls] __aligned(4096) = {
+	[0 ... __NR_compat_syscalls - 1] = sys_ni_syscall,
+#include <asm/unistd32.h>
+};

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 4/5] arm64: Remove asm/syscalls.h
  2015-01-09 15:57 ` Catalin Marinas
@ 2015-01-09 15:57   ` Catalin Marinas
  -1 siblings, 0 replies; 20+ messages in thread
From: Catalin Marinas @ 2015-01-09 15:57 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-kernel, Arnd Bergmann, Andrew Morton

This patch moves the sys_rt_sigreturn_wrapper prototype to
arch/arm64/kernel/sys.c and removes the asm/syscalls.h header.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm64/include/asm/syscalls.h | 30 ------------------------------
 arch/arm64/kernel/sys.c           |  3 +--
 2 files changed, 1 insertion(+), 32 deletions(-)
 delete mode 100644 arch/arm64/include/asm/syscalls.h

diff --git a/arch/arm64/include/asm/syscalls.h b/arch/arm64/include/asm/syscalls.h
deleted file mode 100644
index 48fe7c600e98..000000000000
--- a/arch/arm64/include/asm/syscalls.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2012 ARM Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef __ASM_SYSCALLS_H
-#define __ASM_SYSCALLS_H
-
-#include <linux/linkage.h>
-#include <linux/compiler.h>
-#include <linux/signal.h>
-
-/*
- * System call wrappers implemented in kernel/entry.S.
- */
-asmlinkage long sys_rt_sigreturn_wrapper(void);
-
-#include <asm-generic/syscalls.h>
-
-#endif	/* __ASM_SYSCALLS_H */
diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c
index 3fa98ff14f0e..dec351a9f3d6 100644
--- a/arch/arm64/kernel/sys.c
+++ b/arch/arm64/kernel/sys.c
@@ -39,10 +39,9 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
 /*
  * Wrappers to pass the pt_regs argument.
  */
+asmlinkage long sys_rt_sigreturn_wrapper(void);
 #define sys_rt_sigreturn	sys_rt_sigreturn_wrapper
 
-#include <asm/syscalls.h>
-
 #undef __SYSCALL
 #define __SYSCALL(nr, sym)	[nr] = sym,
 

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 4/5] arm64: Remove asm/syscalls.h
@ 2015-01-09 15:57   ` Catalin Marinas
  0 siblings, 0 replies; 20+ messages in thread
From: Catalin Marinas @ 2015-01-09 15:57 UTC (permalink / raw)
  To: linux-arm-kernel

This patch moves the sys_rt_sigreturn_wrapper prototype to
arch/arm64/kernel/sys.c and removes the asm/syscalls.h header.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm64/include/asm/syscalls.h | 30 ------------------------------
 arch/arm64/kernel/sys.c           |  3 +--
 2 files changed, 1 insertion(+), 32 deletions(-)
 delete mode 100644 arch/arm64/include/asm/syscalls.h

diff --git a/arch/arm64/include/asm/syscalls.h b/arch/arm64/include/asm/syscalls.h
deleted file mode 100644
index 48fe7c600e98..000000000000
--- a/arch/arm64/include/asm/syscalls.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2012 ARM Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef __ASM_SYSCALLS_H
-#define __ASM_SYSCALLS_H
-
-#include <linux/linkage.h>
-#include <linux/compiler.h>
-#include <linux/signal.h>
-
-/*
- * System call wrappers implemented in kernel/entry.S.
- */
-asmlinkage long sys_rt_sigreturn_wrapper(void);
-
-#include <asm-generic/syscalls.h>
-
-#endif	/* __ASM_SYSCALLS_H */
diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c
index 3fa98ff14f0e..dec351a9f3d6 100644
--- a/arch/arm64/kernel/sys.c
+++ b/arch/arm64/kernel/sys.c
@@ -39,10 +39,9 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
 /*
  * Wrappers to pass the pt_regs argument.
  */
+asmlinkage long sys_rt_sigreturn_wrapper(void);
 #define sys_rt_sigreturn	sys_rt_sigreturn_wrapper
 
-#include <asm/syscalls.h>
-
 #undef __SYSCALL
 #define __SYSCALL(nr, sym)	[nr] = sym,
 

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 5/5] arm64: make sys_call_table const
  2015-01-09 15:57 ` Catalin Marinas
@ 2015-01-09 15:57   ` Catalin Marinas
  -1 siblings, 0 replies; 20+ messages in thread
From: Catalin Marinas @ 2015-01-09 15:57 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-kernel, Arnd Bergmann, Andrew Morton, Mark Rutland

From: Mark Rutland <mark.rutland@arm.com>

As with x86, mark the sys_call_table const such that it will be placed
in the .rodata section. This will cause attempts to modify the table
(accidental or deliberate) to fail when strict page permissions are in
place. In the absence of strict page permissions, there should be no
functional change.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm64/kernel/sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c
index dec351a9f3d6..75151aaf1a52 100644
--- a/arch/arm64/kernel/sys.c
+++ b/arch/arm64/kernel/sys.c
@@ -49,7 +49,7 @@ asmlinkage long sys_rt_sigreturn_wrapper(void);
  * The sys_call_table array must be 4K aligned to be accessible from
  * kernel/entry.S.
  */
-void *sys_call_table[__NR_syscalls] __aligned(4096) = {
+void * const sys_call_table[__NR_syscalls] __aligned(4096) = {
 	[0 ... __NR_syscalls - 1] = sys_ni_syscall,
 #include <asm/unistd.h>
 };

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 5/5] arm64: make sys_call_table const
@ 2015-01-09 15:57   ` Catalin Marinas
  0 siblings, 0 replies; 20+ messages in thread
From: Catalin Marinas @ 2015-01-09 15:57 UTC (permalink / raw)
  To: linux-arm-kernel

From: Mark Rutland <mark.rutland@arm.com>

As with x86, mark the sys_call_table const such that it will be placed
in the .rodata section. This will cause attempts to modify the table
(accidental or deliberate) to fail when strict page permissions are in
place. In the absence of strict page permissions, there should be no
functional change.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm64/kernel/sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c
index dec351a9f3d6..75151aaf1a52 100644
--- a/arch/arm64/kernel/sys.c
+++ b/arch/arm64/kernel/sys.c
@@ -49,7 +49,7 @@ asmlinkage long sys_rt_sigreturn_wrapper(void);
  * The sys_call_table array must be 4K aligned to be accessible from
  * kernel/entry.S.
  */
-void *sys_call_table[__NR_syscalls] __aligned(4096) = {
+void * const sys_call_table[__NR_syscalls] __aligned(4096) = {
 	[0 ... __NR_syscalls - 1] = sys_ni_syscall,
 #include <asm/unistd.h>
 };

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/5] syscalls: Declare sys_*stat64 prototypes if __ARCH_WANT_(COMPAT_)STAT64
  2015-01-09 15:57   ` Catalin Marinas
@ 2015-01-26 17:31     ` Catalin Marinas
  -1 siblings, 0 replies; 20+ messages in thread
From: Catalin Marinas @ 2015-01-26 17:31 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-arm-kernel, linux-kernel, Arnd Bergmann

On Fri, Jan 09, 2015 at 03:57:25PM +0000, Catalin Marinas wrote:
> Currently, the sys_stat64, sys_fstat64 and sys_lstat64 prototpyes are
> only declared if BITS_PER_LONG == 32. Following commit 0753f70f07fb
> (fs: Build sys_stat64() and friends if __ARCH_WANT_COMPAT_STAT64), the
> implementation of these functions is allowed on 64-bit systems for
> compat support. The patch changes the condition on the prototype
> declaration from BITS_PER_LONG == 32 to defined(__ARCH_WANT_STAT64) ||
> defined(__ARCH_WANT_COMPAT_STAT64).
> 
> In addition, it moves the sys_fstatat64 prototype under the same #if
> block
> 
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Arnd Bergmann <arnd@arndb.de>

Andrew,

Are you ok with this patch (and the previous one)? They trivial changes
to add or enable some prototypes. If you are ok with them, I'd like to
push them with the rest of the series via the arm64 tree.

Thanks (patch below for reference).

Catalin

>  include/linux/syscalls.h | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
> index 85893d744901..76d1e38aabe1 100644
> --- a/include/linux/syscalls.h
> +++ b/include/linux/syscalls.h
> @@ -410,12 +410,16 @@ asmlinkage long sys_newlstat(const char __user *filename,
>  				struct stat __user *statbuf);
>  asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf);
>  asmlinkage long sys_ustat(unsigned dev, struct ustat __user *ubuf);
> -#if BITS_PER_LONG == 32
> +#if defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_COMPAT_STAT64)
>  asmlinkage long sys_stat64(const char __user *filename,
>  				struct stat64 __user *statbuf);
>  asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user *statbuf);
>  asmlinkage long sys_lstat64(const char __user *filename,
>  				struct stat64 __user *statbuf);
> +asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
> +			       struct stat64 __user *statbuf, int flag);
> +#endif
> +#if BITS_PER_LONG == 32
>  asmlinkage long sys_truncate64(const char __user *path, loff_t length);
>  asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length);
>  #endif
> @@ -771,8 +775,6 @@ asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
>  			   umode_t mode);
>  asmlinkage long sys_newfstatat(int dfd, const char __user *filename,
>  			       struct stat __user *statbuf, int flag);
> -asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
> -			       struct stat64 __user *statbuf, int flag);
>  asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *buf,
>  			       int bufsiz);
>  asmlinkage long sys_utimensat(int dfd, const char __user *filename,

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/5] syscalls: Declare sys_*stat64 prototypes if __ARCH_WANT_(COMPAT_)STAT64
@ 2015-01-26 17:31     ` Catalin Marinas
  0 siblings, 0 replies; 20+ messages in thread
From: Catalin Marinas @ 2015-01-26 17:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 09, 2015 at 03:57:25PM +0000, Catalin Marinas wrote:
> Currently, the sys_stat64, sys_fstat64 and sys_lstat64 prototpyes are
> only declared if BITS_PER_LONG == 32. Following commit 0753f70f07fb
> (fs: Build sys_stat64() and friends if __ARCH_WANT_COMPAT_STAT64), the
> implementation of these functions is allowed on 64-bit systems for
> compat support. The patch changes the condition on the prototype
> declaration from BITS_PER_LONG == 32 to defined(__ARCH_WANT_STAT64) ||
> defined(__ARCH_WANT_COMPAT_STAT64).
> 
> In addition, it moves the sys_fstatat64 prototype under the same #if
> block
> 
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Arnd Bergmann <arnd@arndb.de>

Andrew,

Are you ok with this patch (and the previous one)? They trivial changes
to add or enable some prototypes. If you are ok with them, I'd like to
push them with the rest of the series via the arm64 tree.

Thanks (patch below for reference).

Catalin

>  include/linux/syscalls.h | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
> index 85893d744901..76d1e38aabe1 100644
> --- a/include/linux/syscalls.h
> +++ b/include/linux/syscalls.h
> @@ -410,12 +410,16 @@ asmlinkage long sys_newlstat(const char __user *filename,
>  				struct stat __user *statbuf);
>  asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf);
>  asmlinkage long sys_ustat(unsigned dev, struct ustat __user *ubuf);
> -#if BITS_PER_LONG == 32
> +#if defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_COMPAT_STAT64)
>  asmlinkage long sys_stat64(const char __user *filename,
>  				struct stat64 __user *statbuf);
>  asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user *statbuf);
>  asmlinkage long sys_lstat64(const char __user *filename,
>  				struct stat64 __user *statbuf);
> +asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
> +			       struct stat64 __user *statbuf, int flag);
> +#endif
> +#if BITS_PER_LONG == 32
>  asmlinkage long sys_truncate64(const char __user *path, loff_t length);
>  asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length);
>  #endif
> @@ -771,8 +775,6 @@ asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
>  			   umode_t mode);
>  asmlinkage long sys_newfstatat(int dfd, const char __user *filename,
>  			       struct stat __user *statbuf, int flag);
> -asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
> -			       struct stat64 __user *statbuf, int flag);
>  asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *buf,
>  			       int bufsiz);
>  asmlinkage long sys_utimensat(int dfd, const char __user *filename,

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/5] compat: Declare compat_sys_sigpending and compat_sys_sigprocmask prototypes
  2015-01-09 15:57   ` Catalin Marinas
@ 2015-01-26 17:32     ` Catalin Marinas
  -1 siblings, 0 replies; 20+ messages in thread
From: Catalin Marinas @ 2015-01-26 17:32 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-arm-kernel, linux-kernel, Arnd Bergmann

On Fri, Jan 09, 2015 at 03:57:24PM +0000, Catalin Marinas wrote:
> __ARCH_WANT_SYS_SIGPENDING or __ARCH_WANT_SYS_SIGPROGMASK may be defined
> for compat support but the corresponding prototypes are missing from
> linux/compat.h.
> 
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Arnd Bergmann <arnd@arndb.de>

Same with this patch, trivial addition of two prototypes.

Thanks.

>  include/linux/compat.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/include/linux/compat.h b/include/linux/compat.h
> index 7450ca2ac1fc..ab25814690bc 100644
> --- a/include/linux/compat.h
> +++ b/include/linux/compat.h
> @@ -689,6 +689,15 @@ asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
>  asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
>  				       compat_stack_t __user *uoss_ptr);
>  
> +#ifdef __ARCH_WANT_SYS_SIGPENDING
> +asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set);
> +#endif
> +
> +#ifdef __ARCH_WANT_SYS_SIGPROCMASK
> +asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *nset,
> +				       compat_old_sigset_t __user *oset);
> +#endif
> +
>  int compat_restore_altstack(const compat_stack_t __user *uss);
>  int __compat_save_altstack(compat_stack_t __user *, unsigned long);
>  #define compat_save_altstack_ex(uss, sp) do { \

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/5] compat: Declare compat_sys_sigpending and compat_sys_sigprocmask prototypes
@ 2015-01-26 17:32     ` Catalin Marinas
  0 siblings, 0 replies; 20+ messages in thread
From: Catalin Marinas @ 2015-01-26 17:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 09, 2015 at 03:57:24PM +0000, Catalin Marinas wrote:
> __ARCH_WANT_SYS_SIGPENDING or __ARCH_WANT_SYS_SIGPROGMASK may be defined
> for compat support but the corresponding prototypes are missing from
> linux/compat.h.
> 
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Arnd Bergmann <arnd@arndb.de>

Same with this patch, trivial addition of two prototypes.

Thanks.

>  include/linux/compat.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/include/linux/compat.h b/include/linux/compat.h
> index 7450ca2ac1fc..ab25814690bc 100644
> --- a/include/linux/compat.h
> +++ b/include/linux/compat.h
> @@ -689,6 +689,15 @@ asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
>  asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
>  				       compat_stack_t __user *uoss_ptr);
>  
> +#ifdef __ARCH_WANT_SYS_SIGPENDING
> +asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set);
> +#endif
> +
> +#ifdef __ARCH_WANT_SYS_SIGPROCMASK
> +asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *nset,
> +				       compat_old_sigset_t __user *oset);
> +#endif
> +
>  int compat_restore_altstack(const compat_stack_t __user *uss);
>  int __compat_save_altstack(compat_stack_t __user *, unsigned long);
>  #define compat_save_altstack_ex(uss, sp) do { \

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/5] compat: Declare compat_sys_sigpending and compat_sys_sigprocmask prototypes
  2015-01-09 15:57   ` Catalin Marinas
@ 2015-01-26 21:48     ` Andrew Morton
  -1 siblings, 0 replies; 20+ messages in thread
From: Andrew Morton @ 2015-01-26 21:48 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: linux-arm-kernel, linux-kernel, Arnd Bergmann

On Fri,  9 Jan 2015 15:57:24 +0000 Catalin Marinas <catalin.marinas@arm.com> wrote:

> __ARCH_WANT_SYS_SIGPENDING or __ARCH_WANT_SYS_SIGPROGMASK may be defined
> for compat support but the corresponding prototypes are missing from
> linux/compat.h.
> 
> ...
>
> --- a/include/linux/compat.h
> +++ b/include/linux/compat.h
> @@ -689,6 +689,15 @@ asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
>  asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
>  				       compat_stack_t __user *uoss_ptr);
>  
> +#ifdef __ARCH_WANT_SYS_SIGPENDING
> +asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set);
> +#endif
> +
> +#ifdef __ARCH_WANT_SYS_SIGPROCMASK
> +asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *nset,
> +				       compat_old_sigset_t __user *oset);
> +#endif
> +

ack, please merge and submit.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/5] compat: Declare compat_sys_sigpending and compat_sys_sigprocmask prototypes
@ 2015-01-26 21:48     ` Andrew Morton
  0 siblings, 0 replies; 20+ messages in thread
From: Andrew Morton @ 2015-01-26 21:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri,  9 Jan 2015 15:57:24 +0000 Catalin Marinas <catalin.marinas@arm.com> wrote:

> __ARCH_WANT_SYS_SIGPENDING or __ARCH_WANT_SYS_SIGPROGMASK may be defined
> for compat support but the corresponding prototypes are missing from
> linux/compat.h.
> 
> ...
>
> --- a/include/linux/compat.h
> +++ b/include/linux/compat.h
> @@ -689,6 +689,15 @@ asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
>  asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
>  				       compat_stack_t __user *uoss_ptr);
>  
> +#ifdef __ARCH_WANT_SYS_SIGPENDING
> +asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set);
> +#endif
> +
> +#ifdef __ARCH_WANT_SYS_SIGPROCMASK
> +asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *nset,
> +				       compat_old_sigset_t __user *oset);
> +#endif
> +

ack, please merge and submit.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/5] syscalls: Declare sys_*stat64 prototypes if __ARCH_WANT_(COMPAT_)STAT64
  2015-01-09 15:57   ` Catalin Marinas
@ 2015-01-26 21:49     ` Andrew Morton
  -1 siblings, 0 replies; 20+ messages in thread
From: Andrew Morton @ 2015-01-26 21:49 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: linux-arm-kernel, linux-kernel, Arnd Bergmann

On Fri,  9 Jan 2015 15:57:25 +0000 Catalin Marinas <catalin.marinas@arm.com> wrote:

> Currently, the sys_stat64, sys_fstat64 and sys_lstat64 prototpyes are
> only declared if BITS_PER_LONG == 32. Following commit 0753f70f07fb
> (fs: Build sys_stat64() and friends if __ARCH_WANT_COMPAT_STAT64), the
> implementation of these functions is allowed on 64-bit systems for
> compat support. The patch changes the condition on the prototype
> declaration from BITS_PER_LONG == 32 to defined(__ARCH_WANT_STAT64) ||
> defined(__ARCH_WANT_COMPAT_STAT64).
> 
> In addition, it moves the sys_fstatat64 prototype under the same #if
> block
> 
> ...
>
> --- a/include/linux/syscalls.h
> +++ b/include/linux/syscalls.h
> @@ -410,12 +410,16 @@ asmlinkage long sys_newlstat(const char __user *filename,
>  				struct stat __user *statbuf);
>  asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf);
>  asmlinkage long sys_ustat(unsigned dev, struct ustat __user *ubuf);
> -#if BITS_PER_LONG == 32
> +#if defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_COMPAT_STAT64)
>  asmlinkage long sys_stat64(const char __user *filename,
>  				struct stat64 __user *statbuf);
>  asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user *statbuf);
>  asmlinkage long sys_lstat64(const char __user *filename,
>  				struct stat64 __user *statbuf);
> +asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
> +			       struct stat64 __user *statbuf, int flag);
> +#endif
> +#if BITS_PER_LONG == 32
>  asmlinkage long sys_truncate64(const char __user *path, loff_t length);
>  asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length);

ack.  sys_stat64() and friends are already conditional on
__ARCH_WANT_STAT64) && __ARCH_WANT_COMPAT_STAT64.  I'm a bit
surprised that the current code didn't break.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/5] syscalls: Declare sys_*stat64 prototypes if __ARCH_WANT_(COMPAT_)STAT64
@ 2015-01-26 21:49     ` Andrew Morton
  0 siblings, 0 replies; 20+ messages in thread
From: Andrew Morton @ 2015-01-26 21:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri,  9 Jan 2015 15:57:25 +0000 Catalin Marinas <catalin.marinas@arm.com> wrote:

> Currently, the sys_stat64, sys_fstat64 and sys_lstat64 prototpyes are
> only declared if BITS_PER_LONG == 32. Following commit 0753f70f07fb
> (fs: Build sys_stat64() and friends if __ARCH_WANT_COMPAT_STAT64), the
> implementation of these functions is allowed on 64-bit systems for
> compat support. The patch changes the condition on the prototype
> declaration from BITS_PER_LONG == 32 to defined(__ARCH_WANT_STAT64) ||
> defined(__ARCH_WANT_COMPAT_STAT64).
> 
> In addition, it moves the sys_fstatat64 prototype under the same #if
> block
> 
> ...
>
> --- a/include/linux/syscalls.h
> +++ b/include/linux/syscalls.h
> @@ -410,12 +410,16 @@ asmlinkage long sys_newlstat(const char __user *filename,
>  				struct stat __user *statbuf);
>  asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf);
>  asmlinkage long sys_ustat(unsigned dev, struct ustat __user *ubuf);
> -#if BITS_PER_LONG == 32
> +#if defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_COMPAT_STAT64)
>  asmlinkage long sys_stat64(const char __user *filename,
>  				struct stat64 __user *statbuf);
>  asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user *statbuf);
>  asmlinkage long sys_lstat64(const char __user *filename,
>  				struct stat64 __user *statbuf);
> +asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
> +			       struct stat64 __user *statbuf, int flag);
> +#endif
> +#if BITS_PER_LONG == 32
>  asmlinkage long sys_truncate64(const char __user *path, loff_t length);
>  asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length);

ack.  sys_stat64() and friends are already conditional on
__ARCH_WANT_STAT64) && __ARCH_WANT_COMPAT_STAT64.  I'm a bit
surprised that the current code didn't break.

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2015-01-26 21:49 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-09 15:57 [PATCH 0/5] arm64 compat syscall table clean-up Catalin Marinas
2015-01-09 15:57 ` Catalin Marinas
2015-01-09 15:57 ` [PATCH 1/5] compat: Declare compat_sys_sigpending and compat_sys_sigprocmask prototypes Catalin Marinas
2015-01-09 15:57   ` Catalin Marinas
2015-01-26 17:32   ` Catalin Marinas
2015-01-26 17:32     ` Catalin Marinas
2015-01-26 21:48   ` Andrew Morton
2015-01-26 21:48     ` Andrew Morton
2015-01-09 15:57 ` [PATCH 2/5] syscalls: Declare sys_*stat64 prototypes if __ARCH_WANT_(COMPAT_)STAT64 Catalin Marinas
2015-01-09 15:57   ` Catalin Marinas
2015-01-26 17:31   ` Catalin Marinas
2015-01-26 17:31     ` Catalin Marinas
2015-01-26 21:49   ` Andrew Morton
2015-01-26 21:49     ` Andrew Morton
2015-01-09 15:57 ` [PATCH 3/5] arm64: Implement the compat_sys_call_table in C Catalin Marinas
2015-01-09 15:57   ` Catalin Marinas
2015-01-09 15:57 ` [PATCH 4/5] arm64: Remove asm/syscalls.h Catalin Marinas
2015-01-09 15:57   ` Catalin Marinas
2015-01-09 15:57 ` [PATCH 5/5] arm64: make sys_call_table const Catalin Marinas
2015-01-09 15:57   ` Catalin Marinas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.