diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-15 19:12:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-15 19:12:35 -0400 |
commit | 9fb71c2f230df44bdd237e9a4457849a3909017d (patch) | |
tree | acf07cd9a8ba343d131afa3330bf148bacc72e7a /include/linux/compat.h | |
parent | 6b0a02e86c293c32a50d49b33a1f04420585d40b (diff) | |
parent | ef389b734691cdc8beb009dd402135dcdcb86a56 (diff) |
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Thomas Gleixner:
"A set of fixes and updates for x86:
- Address a swiotlb regression which was caused by the recent DMA
rework and made driver fail because dma_direct_supported() returned
false
- Fix a signedness bug in the APIC ID validation which caused invalid
APIC IDs to be detected as valid thereby bloating the CPU possible
space.
- Fix inconsisten config dependcy/select magic for the MFD_CS5535
driver.
- Fix a corruption of the physical address space bits when encryption
has reduced the address space and late cpuinfo updates overwrite
the reduced bit information with the original value.
- Dominiks syscall rework which consolidates the architecture
specific syscall functions so all syscalls can be wrapped with the
same macros. This allows to switch x86/64 to struct pt_regs based
syscalls. Extend the clearing of user space controlled registers in
the entry patch to the lower registers"
* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/apic: Fix signedness bug in APIC ID validity checks
x86/cpu: Prevent cpuinfo_x86::x86_phys_bits adjustment corruption
x86/olpc: Fix inconsistent MFD_CS5535 configuration
swiotlb: Use dma_direct_supported() for swiotlb_ops
syscalls/x86: Adapt syscall_wrapper.h to the new syscall stub naming convention
syscalls/core, syscalls/x86: Rename struct pt_regs-based sys_*() to __x64_sys_*()
syscalls/core, syscalls/x86: Clean up compat syscall stub naming convention
syscalls/core, syscalls/x86: Clean up syscall stub naming convention
syscalls/x86: Extend register clearing on syscall entry to lower registers
syscalls/x86: Unconditionally enable 'struct pt_regs' based syscalls on x86_64
syscalls/x86: Use 'struct pt_regs' based syscall calling for IA32_EMULATION and x32
syscalls/core: Prepare CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y for compat syscalls
syscalls/x86: Use 'struct pt_regs' based syscall calling convention for 64-bit syscalls
syscalls/core: Introduce CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y
x86/syscalls: Don't pointlessly reload the system call number
x86/mm: Fix documentation of module mapping range with 4-level paging
x86/cpuid: Switch to 'static const' specifier
Diffstat (limited to 'include/linux/compat.h')
-rw-r--r-- | include/linux/compat.h | 51 |
1 files changed, 39 insertions, 12 deletions
diff --git a/include/linux/compat.h b/include/linux/compat.h index f188eab10570..081281ad5772 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -24,6 +24,17 @@ | |||
24 | #include <asm/siginfo.h> | 24 | #include <asm/siginfo.h> |
25 | #include <asm/signal.h> | 25 | #include <asm/signal.h> |
26 | 26 | ||
27 | #ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER | ||
28 | /* | ||
29 | * It may be useful for an architecture to override the definitions of the | ||
30 | * COMPAT_SYSCALL_DEFINE0 and COMPAT_SYSCALL_DEFINEx() macros, in particular | ||
31 | * to use a different calling convention for syscalls. To allow for that, | ||
32 | + the prototypes for the compat_sys_*() functions below will *not* be included | ||
33 | * if CONFIG_ARCH_HAS_SYSCALL_WRAPPER is enabled. | ||
34 | */ | ||
35 | #include <asm/syscall_wrapper.h> | ||
36 | #endif /* CONFIG_ARCH_HAS_SYSCALL_WRAPPER */ | ||
37 | |||
27 | #ifndef COMPAT_USE_64BIT_TIME | 38 | #ifndef COMPAT_USE_64BIT_TIME |
28 | #define COMPAT_USE_64BIT_TIME 0 | 39 | #define COMPAT_USE_64BIT_TIME 0 |
29 | #endif | 40 | #endif |
@@ -32,10 +43,12 @@ | |||
32 | #define __SC_DELOUSE(t,v) ((__force t)(unsigned long)(v)) | 43 | #define __SC_DELOUSE(t,v) ((__force t)(unsigned long)(v)) |
33 | #endif | 44 | #endif |
34 | 45 | ||
46 | #ifndef COMPAT_SYSCALL_DEFINE0 | ||
35 | #define COMPAT_SYSCALL_DEFINE0(name) \ | 47 | #define COMPAT_SYSCALL_DEFINE0(name) \ |
36 | asmlinkage long compat_sys_##name(void); \ | 48 | asmlinkage long compat_sys_##name(void); \ |
37 | ALLOW_ERROR_INJECTION(compat_sys_##name, ERRNO); \ | 49 | ALLOW_ERROR_INJECTION(compat_sys_##name, ERRNO); \ |
38 | asmlinkage long compat_sys_##name(void) | 50 | asmlinkage long compat_sys_##name(void) |
51 | #endif /* COMPAT_SYSCALL_DEFINE0 */ | ||
39 | 52 | ||
40 | #define COMPAT_SYSCALL_DEFINE1(name, ...) \ | 53 | #define COMPAT_SYSCALL_DEFINE1(name, ...) \ |
41 | COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) | 54 | COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) |
@@ -50,18 +63,25 @@ | |||
50 | #define COMPAT_SYSCALL_DEFINE6(name, ...) \ | 63 | #define COMPAT_SYSCALL_DEFINE6(name, ...) \ |
51 | COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) | 64 | COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) |
52 | 65 | ||
53 | #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ | 66 | /* |
54 | asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ | 67 | * The asmlinkage stub is aliased to a function named __se_compat_sys_*() which |
55 | asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))\ | 68 | * sign-extends 32-bit ints to longs whenever needed. The actual work is |
56 | __attribute__((alias(__stringify(compat_SyS##name)))); \ | 69 | * done within __do_compat_sys_*(). |
57 | ALLOW_ERROR_INJECTION(compat_sys##name, ERRNO); \ | 70 | */ |
58 | static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ | 71 | #ifndef COMPAT_SYSCALL_DEFINEx |
59 | asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__));\ | 72 | #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ |
60 | asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\ | 73 | asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ |
61 | { \ | 74 | asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \ |
62 | return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \ | 75 | __attribute__((alias(__stringify(__se_compat_sys##name)))); \ |
63 | } \ | 76 | ALLOW_ERROR_INJECTION(compat_sys##name, ERRNO); \ |
64 | static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) | 77 | static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ |
78 | asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \ | ||
79 | asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ | ||
80 | { \ | ||
81 | return __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\ | ||
82 | } \ | ||
83 | static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) | ||
84 | #endif /* COMPAT_SYSCALL_DEFINEx */ | ||
65 | 85 | ||
66 | #ifndef compat_user_stack_pointer | 86 | #ifndef compat_user_stack_pointer |
67 | #define compat_user_stack_pointer() current_user_stack_pointer() | 87 | #define compat_user_stack_pointer() current_user_stack_pointer() |
@@ -519,7 +539,12 @@ int __compat_save_altstack(compat_stack_t __user *, unsigned long); | |||
519 | * Please note that these prototypes here are only provided for information | 539 | * Please note that these prototypes here are only provided for information |
520 | * purposes, for static analysis, and for linking from the syscall table. | 540 | * purposes, for static analysis, and for linking from the syscall table. |
521 | * These functions should not be called elsewhere from kernel code. | 541 | * These functions should not be called elsewhere from kernel code. |
542 | * | ||
543 | * As the syscall calling convention may be different from the default | ||
544 | * for architectures overriding the syscall calling convention, do not | ||
545 | * include the prototypes if CONFIG_ARCH_HAS_SYSCALL_WRAPPER is enabled. | ||
522 | */ | 546 | */ |
547 | #ifndef CONFIG_ARCH_HAS_SYSCALL_WRAPPER | ||
523 | asmlinkage long compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p); | 548 | asmlinkage long compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p); |
524 | asmlinkage long compat_sys_io_submit(compat_aio_context_t ctx_id, int nr, | 549 | asmlinkage long compat_sys_io_submit(compat_aio_context_t ctx_id, int nr, |
525 | u32 __user *iocb); | 550 | u32 __user *iocb); |
@@ -957,6 +982,8 @@ asmlinkage long compat_sys_stime(compat_time_t __user *tptr); | |||
957 | /* obsolete: net/socket.c */ | 982 | /* obsolete: net/socket.c */ |
958 | asmlinkage long compat_sys_socketcall(int call, u32 __user *args); | 983 | asmlinkage long compat_sys_socketcall(int call, u32 __user *args); |
959 | 984 | ||
985 | #endif /* CONFIG_ARCH_HAS_SYSCALL_WRAPPER */ | ||
986 | |||
960 | 987 | ||
961 | /* | 988 | /* |
962 | * For most but not all architectures, "am I in a compat syscall?" and | 989 | * For most but not all architectures, "am I in a compat syscall?" and |