aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2018-03-22 09:09:17 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2018-04-02 14:16:18 -0400
commit3e2052e5dd4062ccc7a10e8860aa7d2e58627001 (patch)
tree0597bf56694c0c24c19198ea0f85c1495ad5c329
parentc679a08983db7c1eb09930570b92ff7c9fd59c1c (diff)
syscalls/x86: auto-create compat_sys_*() prototypes
compat_sys_*() functions are no longer called from within the kernel on x86 except from the system call table. Linking the system call does not require compat_sys_*() function prototypes at least on x86. Therefore, generate compat_sys_*() prototypes on-the-fly within the COMPAT_SYSCALL_DEFINEx() macro, and remove x86-specific prototypes from various header files. Suggested-by: Andy Lutomirski <luto@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: David S. Miller <davem@davemloft.net> Cc: netdev@vger.kernel.org Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Andi Kleen <ak@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: x86@kernel.org Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r--arch/x86/ia32/ia32_signal.c1
-rw-r--r--arch/x86/ia32/sys_ia32.c2
-rw-r--r--arch/x86/include/asm/sys_ia32.h64
-rw-r--r--include/linux/compat.h17
4 files changed, 4 insertions, 80 deletions
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 41c671854642..86b1341cba9a 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -33,7 +33,6 @@
33#include <asm/vdso.h> 33#include <asm/vdso.h>
34#include <asm/sigframe.h> 34#include <asm/sigframe.h>
35#include <asm/sighandling.h> 35#include <asm/sighandling.h>
36#include <asm/sys_ia32.h>
37#include <asm/smap.h> 36#include <asm/smap.h>
38 37
39/* 38/*
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index bd8a7020b9a7..11ef7b7c9cc8 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -47,7 +47,7 @@
47#include <linux/uaccess.h> 47#include <linux/uaccess.h>
48#include <linux/atomic.h> 48#include <linux/atomic.h>
49#include <asm/vgtod.h> 49#include <asm/vgtod.h>
50#include <asm/sys_ia32.h> 50#include <asm/ia32.h>
51 51
52#define AA(__x) ((unsigned long)(__x)) 52#define AA(__x) ((unsigned long)(__x))
53 53
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h
deleted file mode 100644
index 2ee6e3b96656..000000000000
--- a/arch/x86/include/asm/sys_ia32.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * sys_ia32.h - Linux ia32 syscall interfaces
3 *
4 * Copyright (c) 2008 Jaswinder Singh Rajput
5 *
6 * This file is released under the GPLv2.
7 * See the file COPYING for more details.
8 */
9
10#ifndef _ASM_X86_SYS_IA32_H
11#define _ASM_X86_SYS_IA32_H
12
13#ifdef CONFIG_COMPAT
14
15#include <linux/compiler.h>
16#include <linux/linkage.h>
17#include <linux/types.h>
18#include <linux/signal.h>
19#include <asm/compat.h>
20#include <asm/ia32.h>
21
22/* ia32/sys_ia32.c */
23asmlinkage long compat_sys_x86_truncate64(const char __user *, unsigned long,
24 unsigned long);
25asmlinkage long compat_sys_x86_ftruncate64(unsigned int, unsigned long,
26 unsigned long);
27
28asmlinkage long compat_sys_x86_stat64(const char __user *,
29 struct stat64 __user *);
30asmlinkage long compat_sys_x86_lstat64(const char __user *,
31 struct stat64 __user *);
32asmlinkage long compat_sys_x86_fstat64(unsigned int, struct stat64 __user *);
33asmlinkage long compat_sys_x86_fstatat(unsigned int, const char __user *,
34 struct stat64 __user *, int);
35struct mmap_arg_struct32;
36asmlinkage long compat_sys_x86_mmap(struct mmap_arg_struct32 __user *);
37
38asmlinkage long compat_sys_x86_pread(unsigned int, char __user *, u32, u32,
39 u32);
40asmlinkage long compat_sys_x86_pwrite(unsigned int, const char __user *, u32,
41 u32, u32);
42
43asmlinkage long compat_sys_x86_fadvise64_64(int, __u32, __u32, __u32, __u32,
44 int);
45
46asmlinkage ssize_t compat_sys_x86_readahead(int, unsigned int, unsigned int,
47 size_t);
48asmlinkage long compat_sys_x86_sync_file_range(int, unsigned int, unsigned int,
49 unsigned int, unsigned int,
50 int);
51asmlinkage long compat_sys_x86_fadvise64(int, unsigned int, unsigned int,
52 size_t, int);
53asmlinkage long compat_sys_x86_fallocate(int, int, unsigned int, unsigned int,
54 unsigned int, unsigned int);
55asmlinkage long compat_sys_x86_clone(unsigned long, unsigned long, int __user *,
56 unsigned long, int __user *);
57
58/* ia32/ia32_signal.c */
59asmlinkage long sys32_sigreturn(void);
60asmlinkage long sys32_rt_sigreturn(void);
61
62#endif /* CONFIG_COMPAT */
63
64#endif /* _ASM_X86_SYS_IA32_H */
diff --git a/include/linux/compat.h b/include/linux/compat.h
index f881cce627f6..8cb8710db0ab 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -49,6 +49,7 @@
49 COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) 49 COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
50 50
51#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ 51#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
52 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
52 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\ 53 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\
53 __attribute__((alias(__stringify(compat_SyS##name)))); \ 54 __attribute__((alias(__stringify(compat_SyS##name)))); \
54 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ 55 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
@@ -507,8 +508,8 @@ int __compat_save_altstack(compat_stack_t __user *, unsigned long);
507 508
508/* 509/*
509 * These syscall function prototypes are kept in the same order as 510 * These syscall function prototypes are kept in the same order as
510 * include/uapi/asm-generic/unistd.h. Architecture specific entries go below, 511 * include/uapi/asm-generic/unistd.h. Deprecated or obsolete system calls
511 * followed by deprecated or obsolete system calls. 512 * go below.
512 * 513 *
513 * Please note that these prototypes here are only provided for information 514 * Please note that these prototypes here are only provided for information
514 * purposes, for static analysis, and for linking from the syscall table. 515 * purposes, for static analysis, and for linking from the syscall table.
@@ -883,18 +884,6 @@ asmlinkage long compat_sys_pwritev64v2(unsigned long fd,
883 884
884 885
885/* 886/*
886 * Architecture-specific system calls
887 */
888
889/* fs/quota/compat.c -- x86 only */
890asmlinkage long compat_sys_quotactl32(unsigned int cmd,
891 const char __user *special, qid_t id, void __user *addr);
892
893/* arch_prctl -- x86 */
894asmlinkage long compat_sys_arch_prctl(int option, unsigned long arg2);
895
896
897/*
898 * Deprecated system calls which are still defined in 887 * Deprecated system calls which are still defined in
899 * include/uapi/asm-generic/unistd.h and wanted by >= 1 arch 888 * include/uapi/asm-generic/unistd.h and wanted by >= 1 arch
900 */ 889 */