Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390: Remove compat support

There shouldn't be any 31 bit code around anymore that matters.
Remove the compat layer support required to run 31 bit code.

Reason for removal is code simplification and reduced test effort.

Note that this comes without any deprecation warnings added to config
options, or kernel messages, since most likely those would be ignored
anyway.

If it turns out there is still a reason to keep the compat layer this
can be reverted at any time in the future.

Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

+30 -2484
-16
arch/s390/Kconfig
··· 505 505 This allows you to specify the maximum length of the kernel command 506 506 line. 507 507 508 - config COMPAT 509 - def_bool n 510 - prompt "Kernel support for 31 bit emulation" 511 - select ARCH_WANT_OLD_COMPAT_IPC 512 - select COMPAT_OLD_SIGACTION 513 - select HAVE_UID16 514 - depends on MULTIUSER 515 - depends on !CC_IS_CLANG && !LD_IS_LLD 516 - help 517 - Select this option if you want to enable your system kernel to 518 - handle system-calls from ELF binaries for 31 bit ESA. This option 519 - (and some other stuff like libraries and such) is needed for 520 - executing 31 bit applications. 521 - 522 - If unsure say N. 523 - 524 508 config SMP 525 509 def_bool y 526 510
-3
arch/s390/Makefile
··· 149 149 prepare: vdso_prepare 150 150 vdso_prepare: prepare0 151 151 $(Q)$(MAKE) $(build)=arch/s390/kernel/vdso64 include/generated/vdso64-offsets.h 152 - $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \ 153 - $(build)=arch/s390/kernel/vdso32 include/generated/vdso32-offsets.h) 154 152 155 153 vdso-install-y += arch/s390/kernel/vdso64/vdso64.so.dbg 156 - vdso-install-$(CONFIG_COMPAT) += arch/s390/kernel/vdso32/vdso32.so.dbg 157 154 158 155 endif 159 156
-1
arch/s390/boot/ipl_data.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 3 - #include <linux/compat.h> 4 3 #include <linux/ptrace.h> 5 4 #include <asm/cio.h> 6 5 #include <asm/asm-offsets.h>
-3
arch/s390/configs/compat.config
··· 1 - # Help: Enable compat support 2 - CONFIG_COMPAT=y 3 - CONFIG_COMPAT_32BIT_TIME=y
+1 -5
arch/s390/hypfs/hypfs_sprp.c
··· 7 7 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com> 8 8 */ 9 9 10 - #include <linux/compat.h> 11 10 #include <linux/errno.h> 12 11 #include <linux/gfp.h> 13 12 #include <linux/string.h> ··· 115 116 116 117 if (!capable(CAP_SYS_ADMIN)) 117 118 return -EACCES; 118 - if (is_compat_task()) 119 - argp = compat_ptr(arg); 120 - else 121 - argp = (void __user *) arg; 119 + argp = (void __user *)arg; 122 120 switch (cmd) { 123 121 case HYPFS_DIAG304: 124 122 return __hypfs_sprp_ioctl(argp);
-140
arch/s390/include/asm/compat.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _ASM_S390X_COMPAT_H 3 - #define _ASM_S390X_COMPAT_H 4 - /* 5 - * Architecture specific compatibility types 6 - */ 7 - #include <linux/types.h> 8 - #include <linux/sched.h> 9 - #include <linux/sched/task_stack.h> 10 - #include <linux/thread_info.h> 11 - #include <asm/ptrace.h> 12 - 13 - #define compat_mode_t compat_mode_t 14 - typedef u16 compat_mode_t; 15 - 16 - #define __compat_uid_t __compat_uid_t 17 - typedef u16 __compat_uid_t; 18 - typedef u16 __compat_gid_t; 19 - 20 - #define compat_dev_t compat_dev_t 21 - typedef u16 compat_dev_t; 22 - 23 - #define compat_ipc_pid_t compat_ipc_pid_t 24 - typedef u16 compat_ipc_pid_t; 25 - 26 - #define compat_statfs compat_statfs 27 - 28 - #include <asm-generic/compat.h> 29 - 30 - #define __TYPE_IS_PTR(t) (!__builtin_types_compatible_p( \ 31 - typeof(0?(__force t)0:0ULL), u64)) 32 - 33 - #define __SC_DELOUSE(t,v) ({ \ 34 - BUILD_BUG_ON(sizeof(t) > 4 && !__TYPE_IS_PTR(t)); \ 35 - (__force t)(__TYPE_IS_PTR(t) ? ((v) & 0x7fffffff) : (v)); \ 36 - }) 37 - 38 - #define PSW32_MASK_USER 0x0000FF00UL 39 - 40 - #define PSW32_USER_BITS (PSW32_MASK_DAT | PSW32_MASK_IO | PSW32_MASK_EXT | \ 41 - PSW32_DEFAULT_KEY | PSW32_MASK_BASE | \ 42 - PSW32_MASK_MCHECK | PSW32_MASK_PSTATE | \ 43 - PSW32_ASC_PRIMARY) 44 - 45 - #define COMPAT_UTS_MACHINE "s390\0\0\0\0" 46 - 47 - typedef u16 compat_nlink_t; 48 - 49 - typedef struct { 50 - u32 mask; 51 - u32 addr; 52 - } __aligned(8) psw_compat_t; 53 - 54 - typedef struct { 55 - psw_compat_t psw; 56 - u32 gprs[NUM_GPRS]; 57 - u32 acrs[NUM_ACRS]; 58 - u32 orig_gpr2; 59 - } s390_compat_regs; 60 - 61 - typedef struct { 62 - u32 gprs_high[NUM_GPRS]; 63 - } s390_compat_regs_high; 64 - 65 - struct compat_stat { 66 - compat_dev_t st_dev; 67 - u16 __pad1; 68 - compat_ino_t st_ino; 69 - compat_mode_t st_mode; 70 - compat_nlink_t st_nlink; 71 - __compat_uid_t st_uid; 72 - __compat_gid_t st_gid; 73 - compat_dev_t st_rdev; 74 - u16 __pad2; 75 - u32 st_size; 76 - u32 st_blksize; 77 - u32 st_blocks; 78 - u32 st_atime; 79 - u32 st_atime_nsec; 80 - u32 st_mtime; 81 - u32 st_mtime_nsec; 82 - u32 st_ctime; 83 - u32 st_ctime_nsec; 84 - u32 __unused4; 85 - u32 __unused5; 86 - }; 87 - 88 - struct compat_statfs { 89 - u32 f_type; 90 - u32 f_bsize; 91 - u32 f_blocks; 92 - u32 f_bfree; 93 - u32 f_bavail; 94 - u32 f_files; 95 - u32 f_ffree; 96 - compat_fsid_t f_fsid; 97 - u32 f_namelen; 98 - u32 f_frsize; 99 - u32 f_flags; 100 - u32 f_spare[4]; 101 - }; 102 - 103 - struct compat_statfs64 { 104 - u32 f_type; 105 - u32 f_bsize; 106 - u64 f_blocks; 107 - u64 f_bfree; 108 - u64 f_bavail; 109 - u64 f_files; 110 - u64 f_ffree; 111 - compat_fsid_t f_fsid; 112 - u32 f_namelen; 113 - u32 f_frsize; 114 - u32 f_flags; 115 - u32 f_spare[5]; 116 - }; 117 - 118 - /* 119 - * A pointer passed in from user mode. This should not 120 - * be used for syscall parameters, just declare them 121 - * as pointers because the syscall entry code will have 122 - * appropriately converted them already. 123 - */ 124 - 125 - static inline void __user *compat_ptr(compat_uptr_t uptr) 126 - { 127 - return (void __user *)(unsigned long)(uptr & 0x7fffffffUL); 128 - } 129 - #define compat_ptr(uptr) compat_ptr(uptr) 130 - 131 - #ifdef CONFIG_COMPAT 132 - 133 - static inline int is_compat_task(void) 134 - { 135 - return test_thread_flag(TIF_31BIT); 136 - } 137 - 138 - #endif 139 - 140 - #endif /* _ASM_S390X_COMPAT_H */
+7 -39
arch/s390/include/asm/elf.h
··· 162 162 * ELF register definitions.. 163 163 */ 164 164 165 - #include <linux/compat.h> 166 - 167 165 #include <asm/ptrace.h> 168 166 #include <asm/syscall.h> 169 167 #include <asm/user.h> 170 168 171 169 typedef s390_fp_regs elf_fpregset_t; 172 170 typedef s390_regs elf_gregset_t; 173 - 174 - typedef s390_fp_regs compat_elf_fpregset_t; 175 - typedef s390_compat_regs compat_elf_gregset_t; 176 171 177 172 #include <linux/sched/mm.h> /* for task_struct */ 178 173 #include <asm/mmu_context.h> ··· 178 183 #define elf_check_arch(x) \ 179 184 (((x)->e_machine == EM_S390 || (x)->e_machine == EM_S390_OLD) \ 180 185 && (x)->e_ident[EI_CLASS] == ELF_CLASS) 181 - #define compat_elf_check_arch(x) \ 182 - (((x)->e_machine == EM_S390 || (x)->e_machine == EM_S390_OLD) \ 183 - && (x)->e_ident[EI_CLASS] == ELF_CLASS) 184 - #define compat_start_thread start_thread31 185 186 186 187 /* For SVR4/S390 the function pointer to be registered with `atexit` is 187 188 passed in R14. */ ··· 194 203 the loader. We need to make sure that it is out of the way of the program 195 204 that it will "exec", and that there is sufficient room for the brk. 64-bit 196 205 tasks are aligned to 4GB. */ 197 - #define ELF_ET_DYN_BASE (is_compat_task() ? \ 198 - (STACK_TOP / 3 * 2) : \ 199 - (STACK_TOP / 3 * 2) & ~((1UL << 32) - 1)) 206 + #define ELF_ET_DYN_BASE ((STACK_TOP / 3 * 2) & ~((1UL << 32) - 1)) 200 207 201 208 /* This yields a mask that user programs can use to figure out what 202 209 instruction set this CPU supports. */ ··· 213 224 extern char elf_platform[]; 214 225 #define ELF_PLATFORM (elf_platform) 215 226 216 - #ifndef CONFIG_COMPAT 217 227 #define SET_PERSONALITY(ex) \ 218 228 do { \ 219 229 set_personality(PER_LINUX | \ 220 230 (current->personality & (~PER_MASK))); \ 221 231 current->thread.sys_call_table = sys_call_table; \ 222 232 } while (0) 223 - #else /* CONFIG_COMPAT */ 224 - #define SET_PERSONALITY(ex) \ 225 - do { \ 226 - if (personality(current->personality) != PER_LINUX32) \ 227 - set_personality(PER_LINUX | \ 228 - (current->personality & ~PER_MASK)); \ 229 - if ((ex).e_ident[EI_CLASS] == ELFCLASS32) { \ 230 - set_thread_flag(TIF_31BIT); \ 231 - current->thread.sys_call_table = \ 232 - sys_call_table_emu; \ 233 - } else { \ 234 - clear_thread_flag(TIF_31BIT); \ 235 - current->thread.sys_call_table = \ 236 - sys_call_table; \ 237 - } \ 238 - } while (0) 239 - #endif /* CONFIG_COMPAT */ 240 233 241 234 /* 242 235 * Cache aliasing on the latest machines calls for a mapping granularity 243 - * of 512KB for the anonymous mapping base. For 64-bit processes use a 244 - * 512KB alignment and a randomization of up to 1GB. For 31-bit processes 245 - * the virtual address space is limited, use no alignment and limit the 246 - * randomization to 8MB. 247 - * For the additional randomization of the program break use 32MB for 248 - * 64-bit and 8MB for 31-bit. 236 + * of 512KB for the anonymous mapping base. Use a 512KB alignment and a 237 + * randomization of up to 1GB. 238 + * For the additional randomization of the program break use 32MB. 249 239 */ 250 - #define BRK_RND_MASK (is_compat_task() ? 0x7ffUL : 0x1fffUL) 251 - #define MMAP_RND_MASK (is_compat_task() ? 0x7ffUL : 0x3ff80UL) 252 - #define MMAP_ALIGN_MASK (is_compat_task() ? 0 : 0x7fUL) 240 + #define BRK_RND_MASK (0x1fffUL) 241 + #define MMAP_RND_MASK (0x3ff80UL) 242 + #define MMAP_ALIGN_MASK (0x7fUL) 253 243 #define STACK_RND_MASK MMAP_RND_MASK 254 244 255 245 /* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
+1 -18
arch/s390/include/asm/ftrace.h
··· 105 105 } 106 106 #endif /* CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS */ 107 107 108 - /* 109 - * Even though the system call numbers are identical for s390/s390x a 110 - * different system call table is used for compat tasks. This may lead 111 - * to e.g. incorrect or missing trace event sysfs files. 112 - * Therefore simply do not trace compat system calls at all. 113 - * See kernel/trace/trace_syscalls.c. 114 - */ 115 - #define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS 116 - static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs) 117 - { 118 - return is_compat_task(); 119 - } 120 - 121 108 #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME 122 109 static inline bool arch_syscall_match_sym_name(const char *sym, 123 110 const char *name) 124 111 { 125 - /* 126 - * Skip __s390_ and __s390x_ prefix - due to compat wrappers 127 - * and aliasing some symbols of 64 bit system call functions 128 - * may get the __s390_ prefix instead of the __s390x_ prefix. 129 - */ 112 + /* Skip the __s390x_ prefix. */ 130 113 return !strcmp(sym + 7, name) || !strcmp(sym + 8, name); 131 114 } 132 115
+3 -9
arch/s390/include/asm/processor.h
··· 119 119 unsigned long vdso_text_size(void); 120 120 unsigned long vdso_size(void); 121 121 122 - /* 123 - * User space process size: 2GB for 31 bit, 4TB or 8PT for 64 bit. 124 - */ 125 - 126 - #define TASK_SIZE (test_thread_flag(TIF_31BIT) ? \ 127 - _REGION3_SIZE : TASK_SIZE_MAX) 128 - #define TASK_UNMAPPED_BASE (test_thread_flag(TIF_31BIT) ? \ 129 - (_REGION3_SIZE >> 1) : (_REGION2_SIZE >> 1)) 122 + #define TASK_SIZE (TASK_SIZE_MAX) 123 + #define TASK_UNMAPPED_BASE (_REGION2_SIZE >> 1) 130 124 #define TASK_SIZE_MAX (-PAGE_SIZE) 131 125 132 126 #define VDSO_BASE (STACK_TOP + PAGE_SIZE) 133 - #define VDSO_LIMIT (test_thread_flag(TIF_31BIT) ? _REGION3_SIZE : _REGION2_SIZE) 127 + #define VDSO_LIMIT (_REGION2_SIZE) 134 128 #define STACK_TOP (VDSO_LIMIT - vdso_size() - PAGE_SIZE) 135 129 #define STACK_TOP_MAX (_REGION2_SIZE - vdso_size() - PAGE_SIZE) 136 130
-5
arch/s390/include/asm/seccomp.h
··· 19 19 #define SECCOMP_ARCH_NATIVE AUDIT_ARCH_S390X 20 20 #define SECCOMP_ARCH_NATIVE_NR NR_syscalls 21 21 #define SECCOMP_ARCH_NATIVE_NAME "s390x" 22 - #ifdef CONFIG_COMPAT 23 - # define SECCOMP_ARCH_COMPAT AUDIT_ARCH_S390 24 - # define SECCOMP_ARCH_COMPAT_NR NR_syscalls 25 - # define SECCOMP_ARCH_COMPAT_NAME "s390" 26 - #endif 27 22 28 23 #endif /* _ASM_S390_SECCOMP_H */
+1 -18
arch/s390/include/asm/syscall.h
··· 15 15 #include <asm/ptrace.h> 16 16 17 17 extern const sys_call_ptr_t sys_call_table[]; 18 - extern const sys_call_ptr_t sys_call_table_emu[]; 19 18 20 19 static inline long syscall_get_nr(struct task_struct *task, 21 20 struct pt_regs *regs) ··· 45 46 struct pt_regs *regs) 46 47 { 47 48 unsigned long error = regs->gprs[2]; 48 - #ifdef CONFIG_COMPAT 49 - if (test_tsk_thread_flag(task, TIF_31BIT)) { 50 - /* 51 - * Sign-extend the value so (int)-EFOO becomes (long)-EFOO 52 - * and will match correctly in comparisons. 53 - */ 54 - error = (long)(int)error; 55 - } 56 - #endif 49 + 57 50 return IS_ERR_VALUE(error) ? error : 0; 58 51 } 59 52 ··· 69 78 { 70 79 unsigned long mask = -1UL; 71 80 72 - #ifdef CONFIG_COMPAT 73 - if (test_tsk_thread_flag(task, TIF_31BIT)) 74 - mask = 0xffffffff; 75 - #endif 76 81 for (int i = 1; i < 6; i++) 77 82 args[i] = regs->gprs[2 + i] & mask; 78 83 ··· 86 99 87 100 static inline int syscall_get_arch(struct task_struct *task) 88 101 { 89 - #ifdef CONFIG_COMPAT 90 - if (test_tsk_thread_flag(task, TIF_31BIT)) 91 - return AUDIT_ARCH_S390; 92 - #endif 93 102 return AUDIT_ARCH_S390X; 94 103 } 95 104
-91
arch/s390/include/asm/syscall_wrapper.h
··· 13 13 ,, regs->orig_gpr2,, regs->gprs[3],, regs->gprs[4] \ 14 14 ,, regs->gprs[5],, regs->gprs[6],, regs->gprs[7]) 15 15 16 - #ifdef CONFIG_COMPAT 17 - 18 - #define __SC_COMPAT_CAST(t, a) \ 19 - ({ \ 20 - long __ReS = a; \ 21 - \ 22 - BUILD_BUG_ON((sizeof(t) > 4) && !__TYPE_IS_L(t) && \ 23 - !__TYPE_IS_UL(t) && !__TYPE_IS_PTR(t) && \ 24 - !__TYPE_IS_LL(t)); \ 25 - if (__TYPE_IS_L(t)) \ 26 - __ReS = (s32)a; \ 27 - if (__TYPE_IS_UL(t)) \ 28 - __ReS = (u32)a; \ 29 - if (__TYPE_IS_PTR(t)) \ 30 - __ReS = a & 0x7fffffff; \ 31 - if (__TYPE_IS_LL(t)) \ 32 - return -ENOSYS; \ 33 - (t)__ReS; \ 34 - }) 35 - 36 - /* 37 - * To keep the naming coherent, re-define SYSCALL_DEFINE0 to create an alias 38 - * named __s390x_sys_*() 39 - */ 40 - #define COMPAT_SYSCALL_DEFINE0(sname) \ 41 - long __s390_compat_sys_##sname(struct pt_regs *__unused); \ 42 - ALLOW_ERROR_INJECTION(__s390_compat_sys_##sname, ERRNO); \ 43 - long __s390_compat_sys_##sname(struct pt_regs *__unused) 44 - 45 - #define SYSCALL_DEFINE0(sname) \ 46 - SYSCALL_METADATA(_##sname, 0); \ 47 - long __s390_sys_##sname(struct pt_regs *__unused); \ 48 - ALLOW_ERROR_INJECTION(__s390_sys_##sname, ERRNO); \ 49 - long __s390x_sys_##sname(struct pt_regs *__unused); \ 50 - ALLOW_ERROR_INJECTION(__s390x_sys_##sname, ERRNO); \ 51 - static inline long __do_sys_##sname(void); \ 52 - long __s390_sys_##sname(struct pt_regs *__unused) \ 53 - { \ 54 - return __do_sys_##sname(); \ 55 - } \ 56 - long __s390x_sys_##sname(struct pt_regs *__unused) \ 57 - { \ 58 - return __do_sys_##sname(); \ 59 - } \ 60 - static inline long __do_sys_##sname(void) 61 - 62 - #define COND_SYSCALL(name) \ 63 - cond_syscall(__s390x_sys_##name); \ 64 - cond_syscall(__s390_sys_##name) 65 - 66 - #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ 67 - long __s390_compat_sys##name(struct pt_regs *regs); \ 68 - ALLOW_ERROR_INJECTION(__s390_compat_sys##name, ERRNO); \ 69 - static inline long __se_compat_sys##name(__MAP(x, __SC_LONG, __VA_ARGS__)); \ 70 - static inline long __do_compat_sys##name(__MAP(x, __SC_DECL, __VA_ARGS__)); \ 71 - long __s390_compat_sys##name(struct pt_regs *regs) \ 72 - { \ 73 - return __se_compat_sys##name(SC_S390_REGS_TO_ARGS(x, __VA_ARGS__)); \ 74 - } \ 75 - static inline long __se_compat_sys##name(__MAP(x, __SC_LONG, __VA_ARGS__)) \ 76 - { \ 77 - __MAP(x, __SC_TEST, __VA_ARGS__); \ 78 - return __do_compat_sys##name(__MAP(x, __SC_DELOUSE, __VA_ARGS__)); \ 79 - } \ 80 - static inline long __do_compat_sys##name(__MAP(x, __SC_DECL, __VA_ARGS__)) 81 - 82 - /* 83 - * As some compat syscalls may not be implemented, we need to expand 84 - * COND_SYSCALL_COMPAT in kernel/sys_ni.c to cover this case as well. 85 - */ 86 - #define COND_SYSCALL_COMPAT(name) \ 87 - cond_syscall(__s390_compat_sys_##name) 88 - 89 - #define __S390_SYS_STUBx(x, name, ...) \ 90 - long __s390_sys##name(struct pt_regs *regs); \ 91 - ALLOW_ERROR_INJECTION(__s390_sys##name, ERRNO); \ 92 - static inline long ___se_sys##name(__MAP(x, __SC_LONG, __VA_ARGS__)); \ 93 - long __s390_sys##name(struct pt_regs *regs) \ 94 - { \ 95 - return ___se_sys##name(SC_S390_REGS_TO_ARGS(x, __VA_ARGS__)); \ 96 - } \ 97 - static inline long ___se_sys##name(__MAP(x, __SC_LONG, __VA_ARGS__)) \ 98 - { \ 99 - __MAP(x, __SC_TEST, __VA_ARGS__); \ 100 - return __do_sys##name(__MAP(x, __SC_COMPAT_CAST, __VA_ARGS__)); \ 101 - } 102 - 103 - #else /* CONFIG_COMPAT */ 104 - 105 16 #define SYSCALL_DEFINE0(sname) \ 106 17 SYSCALL_METADATA(_##sname, 0); \ 107 18 long __s390x_sys_##sname(struct pt_regs *__unused); \ ··· 28 117 cond_syscall(__s390x_sys_##name) 29 118 30 119 #define __S390_SYS_STUBx(x, fullname, name, ...) 31 - 32 - #endif /* CONFIG_COMPAT */ 33 120 34 121 #define __SYSCALL_DEFINEx(x, name, ...) \ 35 122 long __s390x_sys##name(struct pt_regs *regs); \
-2
arch/s390/include/asm/thread_info.h
··· 69 69 #define TIF_GUARDED_STORAGE 17 /* load guarded storage control block */ 70 70 #define TIF_ISOLATE_BP_GUEST 18 /* Run KVM guests with isolated BP */ 71 71 #define TIF_PER_TRAP 19 /* Need to handle PER trap on exit to usermode */ 72 - #define TIF_31BIT 20 /* 32bit process */ 73 72 #define TIF_SINGLE_STEP 21 /* This task is single stepped */ 74 73 #define TIF_BLOCK_STEP 22 /* This task is block stepped */ 75 74 #define TIF_UPROBE_SINGLESTEP 23 /* This task is uprobe single stepped */ ··· 77 78 #define _TIF_GUARDED_STORAGE BIT(TIF_GUARDED_STORAGE) 78 79 #define _TIF_ISOLATE_BP_GUEST BIT(TIF_ISOLATE_BP_GUEST) 79 80 #define _TIF_PER_TRAP BIT(TIF_PER_TRAP) 80 - #define _TIF_31BIT BIT(TIF_31BIT) 81 81 #define _TIF_SINGLE_STEP BIT(TIF_SINGLE_STEP) 82 82 #define _TIF_BLOCK_STEP BIT(TIF_BLOCK_STEP) 83 83 #define _TIF_UPROBE_SINGLESTEP BIT(TIF_UPROBE_SINGLESTEP)
-5
arch/s390/include/asm/unistd.h
··· 27 27 #define __ARCH_WANT_SYS_OLDUMOUNT 28 28 #define __ARCH_WANT_SYS_SIGPENDING 29 29 #define __ARCH_WANT_SYS_SIGPROCMASK 30 - # ifdef CONFIG_COMPAT 31 - # define __ARCH_WANT_COMPAT_STAT 32 - # define __ARCH_WANT_SYS_TIME32 33 - # define __ARCH_WANT_SYS_UTIME32 34 - # endif 35 30 #define __ARCH_WANT_SYS_FORK 36 31 #define __ARCH_WANT_SYS_VFORK 37 32 #define __ARCH_WANT_SYS_CLONE
-8
arch/s390/include/asm/vdso-symbols.h
··· 3 3 #define __S390_VDSO_SYMBOLS_H__ 4 4 5 5 #include <generated/vdso64-offsets.h> 6 - #ifdef CONFIG_COMPAT 7 - #include <generated/vdso32-offsets.h> 8 - #endif 9 6 10 7 #define VDSO64_SYMBOL(tsk, name) ((tsk)->mm->context.vdso_base + (vdso64_offset_##name)) 11 - #ifdef CONFIG_COMPAT 12 - #define VDSO32_SYMBOL(tsk, name) ((tsk)->mm->context.vdso_base + (vdso32_offset_##name)) 13 - #else 14 - #define VDSO32_SYMBOL(tsk, name) (-1UL) 15 - #endif 16 8 17 9 #endif /* __S390_VDSO_SYMBOLS_H__ */
-4
arch/s390/kernel/Makefile
··· 56 56 obj-$(CONFIG_SCHED_TOPOLOGY) += topology.o hiperdispatch.o 57 57 obj-$(CONFIG_NUMA) += numa.o 58 58 obj-$(CONFIG_AUDIT) += audit.o 59 - compat-obj-$(CONFIG_AUDIT) += compat_audit.o 60 - obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o 61 - obj-$(CONFIG_COMPAT) += $(compat-obj-y) 62 59 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 63 60 obj-$(CONFIG_KPROBES) += kprobes.o 64 61 obj-$(CONFIG_KPROBES) += mcount.o ··· 82 85 83 86 # vdso 84 87 obj-y += vdso64/ 85 - obj-$(CONFIG_COMPAT) += vdso32/
-16
arch/s390/kernel/audit.c
··· 3 3 #include <linux/types.h> 4 4 #include <linux/audit.h> 5 5 #include <asm/unistd.h> 6 - #include "audit.h" 7 6 8 7 static unsigned dir_class[] = { 9 8 #include <asm-generic/audit_dir_write.h> ··· 31 32 32 33 int audit_classify_arch(int arch) 33 34 { 34 - #ifdef CONFIG_COMPAT 35 - if (arch == AUDIT_ARCH_S390) 36 - return 1; 37 - #endif 38 35 return 0; 39 36 } 40 37 41 38 int audit_classify_syscall(int abi, unsigned syscall) 42 39 { 43 - #ifdef CONFIG_COMPAT 44 - if (abi == AUDIT_ARCH_S390) 45 - return s390_classify_syscall(syscall); 46 - #endif 47 40 switch(syscall) { 48 41 case __NR_open: 49 42 return AUDITSC_OPEN; ··· 54 63 55 64 static int __init audit_classes_init(void) 56 65 { 57 - #ifdef CONFIG_COMPAT 58 - audit_register_class(AUDIT_CLASS_WRITE_32, s390_write_class); 59 - audit_register_class(AUDIT_CLASS_READ_32, s390_read_class); 60 - audit_register_class(AUDIT_CLASS_DIR_WRITE_32, s390_dir_class); 61 - audit_register_class(AUDIT_CLASS_CHATTR_32, s390_chattr_class); 62 - audit_register_class(AUDIT_CLASS_SIGNAL_32, s390_signal_class); 63 - #endif 64 66 audit_register_class(AUDIT_CLASS_WRITE, write_class); 65 67 audit_register_class(AUDIT_CLASS_READ, read_class); 66 68 audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class);
-16
arch/s390/kernel/audit.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __ARCH_S390_KERNEL_AUDIT_H 3 - #define __ARCH_S390_KERNEL_AUDIT_H 4 - 5 - #include <linux/types.h> 6 - 7 - #ifdef CONFIG_COMPAT 8 - extern int s390_classify_syscall(unsigned); 9 - extern __u32 s390_dir_class[]; 10 - extern __u32 s390_write_class[]; 11 - extern __u32 s390_read_class[]; 12 - extern __u32 s390_chattr_class[]; 13 - extern __u32 s390_signal_class[]; 14 - #endif /* CONFIG_COMPAT */ 15 - 16 - #endif /* __ARCH_S390_KERNEL_AUDIT_H */
-48
arch/s390/kernel/compat_audit.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #undef __s390x__ 3 - #include <linux/audit_arch.h> 4 - #include <asm/unistd.h> 5 - #include "audit.h" 6 - 7 - unsigned s390_dir_class[] = { 8 - #include <asm-generic/audit_dir_write.h> 9 - ~0U 10 - }; 11 - 12 - unsigned s390_chattr_class[] = { 13 - #include <asm-generic/audit_change_attr.h> 14 - ~0U 15 - }; 16 - 17 - unsigned s390_write_class[] = { 18 - #include <asm-generic/audit_write.h> 19 - ~0U 20 - }; 21 - 22 - unsigned s390_read_class[] = { 23 - #include <asm-generic/audit_read.h> 24 - ~0U 25 - }; 26 - 27 - unsigned s390_signal_class[] = { 28 - #include <asm-generic/audit_signal.h> 29 - ~0U 30 - }; 31 - 32 - int s390_classify_syscall(unsigned syscall) 33 - { 34 - switch(syscall) { 35 - case __NR_open: 36 - return AUDITSC_OPEN; 37 - case __NR_openat: 38 - return AUDITSC_OPENAT; 39 - case __NR_socketcall: 40 - return AUDITSC_SOCKETCALL; 41 - case __NR_execve: 42 - return AUDITSC_EXECVE; 43 - case __NR_openat2: 44 - return AUDITSC_OPENAT2; 45 - default: 46 - return AUDITSC_COMPAT; 47 - } 48 - }
-289
arch/s390/kernel/compat_linux.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * S390 version 4 - * Copyright IBM Corp. 2000 5 - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 6 - * Gerhard Tonn (ton@de.ibm.com) 7 - * Thomas Spatzier (tspat@de.ibm.com) 8 - * 9 - * Conversion between 31bit and 64bit native syscalls. 10 - * 11 - * Heavily inspired by the 32-bit Sparc compat code which is 12 - * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 13 - * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) 14 - * 15 - */ 16 - 17 - 18 - #include <linux/kernel.h> 19 - #include <linux/sched.h> 20 - #include <linux/fs.h> 21 - #include <linux/mm.h> 22 - #include <linux/file.h> 23 - #include <linux/signal.h> 24 - #include <linux/resource.h> 25 - #include <linux/times.h> 26 - #include <linux/smp.h> 27 - #include <linux/sem.h> 28 - #include <linux/msg.h> 29 - #include <linux/shm.h> 30 - #include <linux/uio.h> 31 - #include <linux/quota.h> 32 - #include <linux/poll.h> 33 - #include <linux/personality.h> 34 - #include <linux/stat.h> 35 - #include <linux/filter.h> 36 - #include <linux/highmem.h> 37 - #include <linux/mman.h> 38 - #include <linux/ipv6.h> 39 - #include <linux/in.h> 40 - #include <linux/icmpv6.h> 41 - #include <linux/syscalls.h> 42 - #include <linux/sysctl.h> 43 - #include <linux/binfmts.h> 44 - #include <linux/capability.h> 45 - #include <linux/compat.h> 46 - #include <linux/vfs.h> 47 - #include <linux/ptrace.h> 48 - #include <linux/fadvise.h> 49 - #include <linux/ipc.h> 50 - #include <linux/slab.h> 51 - 52 - #include <asm/types.h> 53 - #include <linux/uaccess.h> 54 - 55 - #include <net/scm.h> 56 - #include <net/sock.h> 57 - 58 - #include "compat_linux.h" 59 - 60 - #ifdef CONFIG_SYSVIPC 61 - COMPAT_SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, compat_ulong_t, second, 62 - compat_ulong_t, third, compat_uptr_t, ptr) 63 - { 64 - if (call >> 16) /* hack for backward compatibility */ 65 - return -EINVAL; 66 - return compat_ksys_ipc(call, first, second, third, ptr, third); 67 - } 68 - #endif 69 - 70 - COMPAT_SYSCALL_DEFINE3(s390_truncate64, const char __user *, path, u32, high, u32, low) 71 - { 72 - return ksys_truncate(path, (unsigned long)high << 32 | low); 73 - } 74 - 75 - COMPAT_SYSCALL_DEFINE3(s390_ftruncate64, unsigned int, fd, u32, high, u32, low) 76 - { 77 - return ksys_ftruncate(fd, (unsigned long)high << 32 | low); 78 - } 79 - 80 - COMPAT_SYSCALL_DEFINE5(s390_pread64, unsigned int, fd, char __user *, ubuf, 81 - compat_size_t, count, u32, high, u32, low) 82 - { 83 - if ((compat_ssize_t) count < 0) 84 - return -EINVAL; 85 - return ksys_pread64(fd, ubuf, count, (unsigned long)high << 32 | low); 86 - } 87 - 88 - COMPAT_SYSCALL_DEFINE5(s390_pwrite64, unsigned int, fd, const char __user *, ubuf, 89 - compat_size_t, count, u32, high, u32, low) 90 - { 91 - if ((compat_ssize_t) count < 0) 92 - return -EINVAL; 93 - return ksys_pwrite64(fd, ubuf, count, (unsigned long)high << 32 | low); 94 - } 95 - 96 - COMPAT_SYSCALL_DEFINE4(s390_readahead, int, fd, u32, high, u32, low, s32, count) 97 - { 98 - return ksys_readahead(fd, (unsigned long)high << 32 | low, count); 99 - } 100 - 101 - struct stat64_emu31 { 102 - unsigned long long st_dev; 103 - unsigned int __pad1; 104 - #define STAT64_HAS_BROKEN_ST_INO 1 105 - u32 __st_ino; 106 - unsigned int st_mode; 107 - unsigned int st_nlink; 108 - u32 st_uid; 109 - u32 st_gid; 110 - unsigned long long st_rdev; 111 - unsigned int __pad3; 112 - long st_size; 113 - u32 st_blksize; 114 - unsigned char __pad4[4]; 115 - u32 __pad5; /* future possible st_blocks high bits */ 116 - u32 st_blocks; /* Number 512-byte blocks allocated. */ 117 - u32 st_atime; 118 - u32 __pad6; 119 - u32 st_mtime; 120 - u32 __pad7; 121 - u32 st_ctime; 122 - u32 __pad8; /* will be high 32 bits of ctime someday */ 123 - unsigned long st_ino; 124 - }; 125 - 126 - static int cp_stat64(struct stat64_emu31 __user *ubuf, struct kstat *stat) 127 - { 128 - struct stat64_emu31 tmp; 129 - 130 - memset(&tmp, 0, sizeof(tmp)); 131 - 132 - tmp.st_dev = huge_encode_dev(stat->dev); 133 - tmp.st_ino = stat->ino; 134 - tmp.__st_ino = (u32)stat->ino; 135 - tmp.st_mode = stat->mode; 136 - tmp.st_nlink = (unsigned int)stat->nlink; 137 - tmp.st_uid = from_kuid_munged(current_user_ns(), stat->uid); 138 - tmp.st_gid = from_kgid_munged(current_user_ns(), stat->gid); 139 - tmp.st_rdev = huge_encode_dev(stat->rdev); 140 - tmp.st_size = stat->size; 141 - tmp.st_blksize = (u32)stat->blksize; 142 - tmp.st_blocks = (u32)stat->blocks; 143 - tmp.st_atime = (u32)stat->atime.tv_sec; 144 - tmp.st_mtime = (u32)stat->mtime.tv_sec; 145 - tmp.st_ctime = (u32)stat->ctime.tv_sec; 146 - 147 - return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 148 - } 149 - 150 - COMPAT_SYSCALL_DEFINE2(s390_stat64, const char __user *, filename, struct stat64_emu31 __user *, statbuf) 151 - { 152 - struct kstat stat; 153 - int ret = vfs_stat(filename, &stat); 154 - if (!ret) 155 - ret = cp_stat64(statbuf, &stat); 156 - return ret; 157 - } 158 - 159 - COMPAT_SYSCALL_DEFINE2(s390_lstat64, const char __user *, filename, struct stat64_emu31 __user *, statbuf) 160 - { 161 - struct kstat stat; 162 - int ret = vfs_lstat(filename, &stat); 163 - if (!ret) 164 - ret = cp_stat64(statbuf, &stat); 165 - return ret; 166 - } 167 - 168 - COMPAT_SYSCALL_DEFINE2(s390_fstat64, unsigned int, fd, struct stat64_emu31 __user *, statbuf) 169 - { 170 - struct kstat stat; 171 - int ret = vfs_fstat(fd, &stat); 172 - if (!ret) 173 - ret = cp_stat64(statbuf, &stat); 174 - return ret; 175 - } 176 - 177 - COMPAT_SYSCALL_DEFINE4(s390_fstatat64, unsigned int, dfd, const char __user *, filename, 178 - struct stat64_emu31 __user *, statbuf, int, flag) 179 - { 180 - struct kstat stat; 181 - int error; 182 - 183 - error = vfs_fstatat(dfd, filename, &stat, flag); 184 - if (error) 185 - return error; 186 - return cp_stat64(statbuf, &stat); 187 - } 188 - 189 - /* 190 - * Linux/i386 didn't use to be able to handle more than 191 - * 4 system call parameters, so these system calls used a memory 192 - * block for parameter passing.. 193 - */ 194 - 195 - struct mmap_arg_struct_emu31 { 196 - compat_ulong_t addr; 197 - compat_ulong_t len; 198 - compat_ulong_t prot; 199 - compat_ulong_t flags; 200 - compat_ulong_t fd; 201 - compat_ulong_t offset; 202 - }; 203 - 204 - COMPAT_SYSCALL_DEFINE1(s390_old_mmap, struct mmap_arg_struct_emu31 __user *, arg) 205 - { 206 - struct mmap_arg_struct_emu31 a; 207 - 208 - if (copy_from_user(&a, arg, sizeof(a))) 209 - return -EFAULT; 210 - if (a.offset & ~PAGE_MASK) 211 - return -EINVAL; 212 - return ksys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, 213 - a.offset >> PAGE_SHIFT); 214 - } 215 - 216 - COMPAT_SYSCALL_DEFINE1(s390_mmap2, struct mmap_arg_struct_emu31 __user *, arg) 217 - { 218 - struct mmap_arg_struct_emu31 a; 219 - 220 - if (copy_from_user(&a, arg, sizeof(a))) 221 - return -EFAULT; 222 - return ksys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); 223 - } 224 - 225 - COMPAT_SYSCALL_DEFINE3(s390_read, unsigned int, fd, char __user *, buf, compat_size_t, count) 226 - { 227 - if ((compat_ssize_t) count < 0) 228 - return -EINVAL; 229 - 230 - return ksys_read(fd, buf, count); 231 - } 232 - 233 - COMPAT_SYSCALL_DEFINE3(s390_write, unsigned int, fd, const char __user *, buf, compat_size_t, count) 234 - { 235 - if ((compat_ssize_t) count < 0) 236 - return -EINVAL; 237 - 238 - return ksys_write(fd, buf, count); 239 - } 240 - 241 - /* 242 - * 31 bit emulation wrapper functions for sys_fadvise64/fadvise64_64. 243 - * These need to rewrite the advise values for POSIX_FADV_{DONTNEED,NOREUSE} 244 - * because the 31 bit values differ from the 64 bit values. 245 - */ 246 - 247 - COMPAT_SYSCALL_DEFINE5(s390_fadvise64, int, fd, u32, high, u32, low, compat_size_t, len, int, advise) 248 - { 249 - if (advise == 4) 250 - advise = POSIX_FADV_DONTNEED; 251 - else if (advise == 5) 252 - advise = POSIX_FADV_NOREUSE; 253 - return ksys_fadvise64_64(fd, (unsigned long)high << 32 | low, len, 254 - advise); 255 - } 256 - 257 - struct fadvise64_64_args { 258 - int fd; 259 - long long offset; 260 - long long len; 261 - int advice; 262 - }; 263 - 264 - COMPAT_SYSCALL_DEFINE1(s390_fadvise64_64, struct fadvise64_64_args __user *, args) 265 - { 266 - struct fadvise64_64_args a; 267 - 268 - if ( copy_from_user(&a, args, sizeof(a)) ) 269 - return -EFAULT; 270 - if (a.advice == 4) 271 - a.advice = POSIX_FADV_DONTNEED; 272 - else if (a.advice == 5) 273 - a.advice = POSIX_FADV_NOREUSE; 274 - return ksys_fadvise64_64(a.fd, a.offset, a.len, a.advice); 275 - } 276 - 277 - COMPAT_SYSCALL_DEFINE6(s390_sync_file_range, int, fd, u32, offhigh, u32, offlow, 278 - u32, nhigh, u32, nlow, unsigned int, flags) 279 - { 280 - return ksys_sync_file_range(fd, ((loff_t)offhigh << 32) + offlow, 281 - ((u64)nhigh << 32) + nlow, flags); 282 - } 283 - 284 - COMPAT_SYSCALL_DEFINE6(s390_fallocate, int, fd, int, mode, u32, offhigh, u32, offlow, 285 - u32, lenhigh, u32, lenlow) 286 - { 287 - return ksys_fallocate(fd, mode, ((loff_t)offhigh << 32) + offlow, 288 - ((u64)lenhigh << 32) + lenlow); 289 - }
-101
arch/s390/kernel/compat_linux.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _ASM_S390X_S390_H 3 - #define _ASM_S390X_S390_H 4 - 5 - #include <linux/compat.h> 6 - #include <linux/socket.h> 7 - #include <linux/syscalls.h> 8 - #include <asm/ptrace.h> 9 - 10 - /* 11 - * Macro that masks the high order bit of a 32 bit pointer and 12 - * converts it to a 64 bit pointer. 13 - */ 14 - #define A(__x) ((unsigned long)((__x) & 0x7FFFFFFFUL)) 15 - #define AA(__x) ((unsigned long)(__x)) 16 - 17 - /* Now 32bit compatibility types */ 18 - struct ipc_kludge_32 { 19 - __u32 msgp; /* pointer */ 20 - __s32 msgtyp; 21 - }; 22 - 23 - /* asm/sigcontext.h */ 24 - typedef union { 25 - __u64 d; 26 - __u32 f; 27 - } freg_t32; 28 - 29 - typedef struct { 30 - unsigned int fpc; 31 - unsigned int pad; 32 - freg_t32 fprs[__NUM_FPRS]; 33 - } _s390_fp_regs32; 34 - 35 - typedef struct { 36 - psw32_t psw; 37 - __u32 gprs[__NUM_GPRS]; 38 - __u32 acrs[__NUM_ACRS]; 39 - } _s390_regs_common32; 40 - 41 - typedef struct { 42 - _s390_regs_common32 regs; 43 - _s390_fp_regs32 fpregs; 44 - } _sigregs32; 45 - 46 - typedef struct { 47 - __u32 gprs_high[__NUM_GPRS]; 48 - __u64 vxrs_low[__NUM_VXRS_LOW]; 49 - __vector128 vxrs_high[__NUM_VXRS_HIGH]; 50 - __u8 __reserved[128]; 51 - } _sigregs_ext32; 52 - 53 - #define _SIGCONTEXT_NSIG32 64 54 - #define _SIGCONTEXT_NSIG_BPW32 32 55 - #define __SIGNAL_FRAMESIZE32 96 56 - #define _SIGMASK_COPY_SIZE32 (sizeof(u32) * 2) 57 - 58 - struct sigcontext32 { 59 - __u32 oldmask[_COMPAT_NSIG_WORDS]; 60 - __u32 sregs; /* pointer */ 61 - }; 62 - 63 - /* asm/signal.h */ 64 - 65 - /* asm/ucontext.h */ 66 - struct ucontext32 { 67 - __u32 uc_flags; 68 - __u32 uc_link; /* pointer */ 69 - compat_stack_t uc_stack; 70 - _sigregs32 uc_mcontext; 71 - compat_sigset_t uc_sigmask; 72 - /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */ 73 - unsigned char __unused[128 - sizeof(compat_sigset_t)]; 74 - _sigregs_ext32 uc_mcontext_ext; 75 - }; 76 - 77 - struct stat64_emu31; 78 - struct mmap_arg_struct_emu31; 79 - struct fadvise64_64_args; 80 - 81 - long compat_sys_s390_truncate64(const char __user *path, u32 high, u32 low); 82 - long compat_sys_s390_ftruncate64(unsigned int fd, u32 high, u32 low); 83 - long compat_sys_s390_pread64(unsigned int fd, char __user *ubuf, compat_size_t count, u32 high, u32 low); 84 - long compat_sys_s390_pwrite64(unsigned int fd, const char __user *ubuf, compat_size_t count, u32 high, u32 low); 85 - long compat_sys_s390_readahead(int fd, u32 high, u32 low, s32 count); 86 - long compat_sys_s390_stat64(const char __user *filename, struct stat64_emu31 __user *statbuf); 87 - long compat_sys_s390_lstat64(const char __user *filename, struct stat64_emu31 __user *statbuf); 88 - long compat_sys_s390_fstat64(unsigned int fd, struct stat64_emu31 __user *statbuf); 89 - long compat_sys_s390_fstatat64(unsigned int dfd, const char __user *filename, struct stat64_emu31 __user *statbuf, int flag); 90 - long compat_sys_s390_old_mmap(struct mmap_arg_struct_emu31 __user *arg); 91 - long compat_sys_s390_mmap2(struct mmap_arg_struct_emu31 __user *arg); 92 - long compat_sys_s390_read(unsigned int fd, char __user *buf, compat_size_t count); 93 - long compat_sys_s390_write(unsigned int fd, const char __user *buf, compat_size_t count); 94 - long compat_sys_s390_fadvise64(int fd, u32 high, u32 low, compat_size_t len, int advise); 95 - long compat_sys_s390_fadvise64_64(struct fadvise64_64_args __user *args); 96 - long compat_sys_s390_sync_file_range(int fd, u32 offhigh, u32 offlow, u32 nhigh, u32 nlow, unsigned int flags); 97 - long compat_sys_s390_fallocate(int fd, int mode, u32 offhigh, u32 offlow, u32 lenhigh, u32 lenlow); 98 - long compat_sys_sigreturn(void); 99 - long compat_sys_rt_sigreturn(void); 100 - 101 - #endif /* _ASM_S390X_S390_H */
-64
arch/s390/kernel/compat_ptrace.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _PTRACE32_H 3 - #define _PTRACE32_H 4 - 5 - #include <asm/ptrace.h> /* needed for NUM_CR_WORDS */ 6 - #include "compat_linux.h" /* needed for psw_compat_t */ 7 - 8 - struct compat_per_struct_kernel { 9 - __u32 cr9; /* PER control bits */ 10 - __u32 cr10; /* PER starting address */ 11 - __u32 cr11; /* PER ending address */ 12 - __u32 bits; /* Obsolete software bits */ 13 - __u32 starting_addr; /* User specified start address */ 14 - __u32 ending_addr; /* User specified end address */ 15 - __u16 perc_atmid; /* PER trap ATMID */ 16 - __u32 address; /* PER trap instruction address */ 17 - __u8 access_id; /* PER trap access identification */ 18 - }; 19 - 20 - struct compat_user_regs_struct 21 - { 22 - psw_compat_t psw; 23 - u32 gprs[NUM_GPRS]; 24 - u32 acrs[NUM_ACRS]; 25 - u32 orig_gpr2; 26 - /* nb: there's a 4-byte hole here */ 27 - s390_fp_regs fp_regs; 28 - /* 29 - * These per registers are in here so that gdb can modify them 30 - * itself as there is no "official" ptrace interface for hardware 31 - * watchpoints. This is the way intel does it. 32 - */ 33 - struct compat_per_struct_kernel per_info; 34 - u32 ieee_instruction_pointer; /* obsolete, always 0 */ 35 - }; 36 - 37 - struct compat_user { 38 - /* We start with the registers, to mimic the way that "memory" 39 - is returned from the ptrace(3,...) function. */ 40 - struct compat_user_regs_struct regs; 41 - /* The rest of this junk is to help gdb figure out what goes where */ 42 - u32 u_tsize; /* Text segment size (pages). */ 43 - u32 u_dsize; /* Data segment size (pages). */ 44 - u32 u_ssize; /* Stack segment size (pages). */ 45 - u32 start_code; /* Starting virtual address of text. */ 46 - u32 start_stack; /* Starting virtual address of stack area. 47 - This is actually the bottom of the stack, 48 - the top of the stack is always found in the 49 - esp register. */ 50 - s32 signal; /* Signal that caused the core dump. */ 51 - u32 u_ar0; /* Used by gdb to help find the values for */ 52 - /* the registers. */ 53 - u32 magic; /* To uniquely identify a core file */ 54 - char u_comm[32]; /* User command that was responsible */ 55 - }; 56 - 57 - typedef struct 58 - { 59 - __u32 len; 60 - __u32 kernel_addr; 61 - __u32 process_addr; 62 - } compat_ptrace_area; 63 - 64 - #endif /* _PTRACE32_H */
-420
arch/s390/kernel/compat_signal.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Copyright IBM Corp. 2000, 2006 4 - * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) 5 - * Gerhard Tonn (ton@de.ibm.com) 6 - * 7 - * Copyright (C) 1991, 1992 Linus Torvalds 8 - * 9 - * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson 10 - */ 11 - 12 - #include <linux/compat.h> 13 - #include <linux/sched.h> 14 - #include <linux/sched/task_stack.h> 15 - #include <linux/mm.h> 16 - #include <linux/smp.h> 17 - #include <linux/kernel.h> 18 - #include <linux/signal.h> 19 - #include <linux/errno.h> 20 - #include <linux/wait.h> 21 - #include <linux/ptrace.h> 22 - #include <linux/unistd.h> 23 - #include <linux/stddef.h> 24 - #include <linux/tty.h> 25 - #include <linux/personality.h> 26 - #include <linux/binfmts.h> 27 - #include <asm/vdso-symbols.h> 28 - #include <asm/access-regs.h> 29 - #include <asm/ucontext.h> 30 - #include <linux/uaccess.h> 31 - #include <asm/lowcore.h> 32 - #include <asm/fpu.h> 33 - #include "compat_linux.h" 34 - #include "compat_ptrace.h" 35 - #include "entry.h" 36 - 37 - typedef struct 38 - { 39 - __u8 callee_used_stack[__SIGNAL_FRAMESIZE32]; 40 - struct sigcontext32 sc; 41 - _sigregs32 sregs; 42 - int signo; 43 - _sigregs_ext32 sregs_ext; 44 - __u16 svc_insn; /* Offset of svc_insn is NOT fixed! */ 45 - } sigframe32; 46 - 47 - typedef struct 48 - { 49 - __u8 callee_used_stack[__SIGNAL_FRAMESIZE32]; 50 - __u16 svc_insn; 51 - compat_siginfo_t info; 52 - struct ucontext32 uc; 53 - } rt_sigframe32; 54 - 55 - /* Store registers needed to create the signal frame */ 56 - static void store_sigregs(void) 57 - { 58 - save_access_regs(current->thread.acrs); 59 - save_user_fpu_regs(); 60 - } 61 - 62 - /* Load registers after signal return */ 63 - static void load_sigregs(void) 64 - { 65 - restore_access_regs(current->thread.acrs); 66 - } 67 - 68 - static int save_sigregs32(struct pt_regs *regs, _sigregs32 __user *sregs) 69 - { 70 - _sigregs32 user_sregs; 71 - int i; 72 - 73 - user_sregs.regs.psw.mask = (__u32)(regs->psw.mask >> 32); 74 - user_sregs.regs.psw.mask &= PSW32_MASK_USER | PSW32_MASK_RI; 75 - user_sregs.regs.psw.mask |= PSW32_USER_BITS; 76 - user_sregs.regs.psw.addr = (__u32) regs->psw.addr | 77 - (__u32)(regs->psw.mask & PSW_MASK_BA); 78 - for (i = 0; i < NUM_GPRS; i++) 79 - user_sregs.regs.gprs[i] = (__u32) regs->gprs[i]; 80 - memcpy(&user_sregs.regs.acrs, current->thread.acrs, 81 - sizeof(user_sregs.regs.acrs)); 82 - fpregs_store((_s390_fp_regs *) &user_sregs.fpregs, &current->thread.ufpu); 83 - if (__copy_to_user(sregs, &user_sregs, sizeof(_sigregs32))) 84 - return -EFAULT; 85 - return 0; 86 - } 87 - 88 - static int restore_sigregs32(struct pt_regs *regs,_sigregs32 __user *sregs) 89 - { 90 - _sigregs32 user_sregs; 91 - int i; 92 - 93 - /* Always make any pending restarted system call return -EINTR */ 94 - current->restart_block.fn = do_no_restart_syscall; 95 - 96 - if (__copy_from_user(&user_sregs, &sregs->regs, sizeof(user_sregs))) 97 - return -EFAULT; 98 - 99 - if (!is_ri_task(current) && (user_sregs.regs.psw.mask & PSW32_MASK_RI)) 100 - return -EINVAL; 101 - 102 - /* Use regs->psw.mask instead of PSW_USER_BITS to preserve PER bit. */ 103 - regs->psw.mask = (regs->psw.mask & ~(PSW_MASK_USER | PSW_MASK_RI)) | 104 - (__u64)(user_sregs.regs.psw.mask & PSW32_MASK_USER) << 32 | 105 - (__u64)(user_sregs.regs.psw.mask & PSW32_MASK_RI) << 32 | 106 - (__u64)(user_sregs.regs.psw.addr & PSW32_ADDR_AMODE); 107 - /* Check for invalid user address space control. */ 108 - if ((regs->psw.mask & PSW_MASK_ASC) == PSW_ASC_HOME) 109 - regs->psw.mask = PSW_ASC_PRIMARY | 110 - (regs->psw.mask & ~PSW_MASK_ASC); 111 - regs->psw.addr = (__u64)(user_sregs.regs.psw.addr & PSW32_ADDR_INSN); 112 - for (i = 0; i < NUM_GPRS; i++) 113 - regs->gprs[i] = (__u64) user_sregs.regs.gprs[i]; 114 - memcpy(&current->thread.acrs, &user_sregs.regs.acrs, 115 - sizeof(current->thread.acrs)); 116 - fpregs_load((_s390_fp_regs *)&user_sregs.fpregs, &current->thread.ufpu); 117 - 118 - clear_pt_regs_flag(regs, PIF_SYSCALL); /* No longer in a system call */ 119 - return 0; 120 - } 121 - 122 - static int save_sigregs_ext32(struct pt_regs *regs, 123 - _sigregs_ext32 __user *sregs_ext) 124 - { 125 - __u32 gprs_high[NUM_GPRS]; 126 - __u64 vxrs[__NUM_VXRS_LOW]; 127 - int i; 128 - 129 - /* Save high gprs to signal stack */ 130 - for (i = 0; i < NUM_GPRS; i++) 131 - gprs_high[i] = regs->gprs[i] >> 32; 132 - if (__copy_to_user(&sregs_ext->gprs_high, &gprs_high, 133 - sizeof(sregs_ext->gprs_high))) 134 - return -EFAULT; 135 - 136 - /* Save vector registers to signal stack */ 137 - if (cpu_has_vx()) { 138 - for (i = 0; i < __NUM_VXRS_LOW; i++) 139 - vxrs[i] = current->thread.ufpu.vxrs[i].low; 140 - if (__copy_to_user(&sregs_ext->vxrs_low, vxrs, 141 - sizeof(sregs_ext->vxrs_low)) || 142 - __copy_to_user(&sregs_ext->vxrs_high, 143 - current->thread.ufpu.vxrs + __NUM_VXRS_LOW, 144 - sizeof(sregs_ext->vxrs_high))) 145 - return -EFAULT; 146 - } 147 - return 0; 148 - } 149 - 150 - static int restore_sigregs_ext32(struct pt_regs *regs, 151 - _sigregs_ext32 __user *sregs_ext) 152 - { 153 - __u32 gprs_high[NUM_GPRS]; 154 - __u64 vxrs[__NUM_VXRS_LOW]; 155 - int i; 156 - 157 - /* Restore high gprs from signal stack */ 158 - if (__copy_from_user(&gprs_high, &sregs_ext->gprs_high, 159 - sizeof(sregs_ext->gprs_high))) 160 - return -EFAULT; 161 - for (i = 0; i < NUM_GPRS; i++) 162 - *(__u32 *)&regs->gprs[i] = gprs_high[i]; 163 - 164 - /* Restore vector registers from signal stack */ 165 - if (cpu_has_vx()) { 166 - if (__copy_from_user(vxrs, &sregs_ext->vxrs_low, 167 - sizeof(sregs_ext->vxrs_low)) || 168 - __copy_from_user(current->thread.ufpu.vxrs + __NUM_VXRS_LOW, 169 - &sregs_ext->vxrs_high, 170 - sizeof(sregs_ext->vxrs_high))) 171 - return -EFAULT; 172 - for (i = 0; i < __NUM_VXRS_LOW; i++) 173 - current->thread.ufpu.vxrs[i].low = vxrs[i]; 174 - } 175 - return 0; 176 - } 177 - 178 - COMPAT_SYSCALL_DEFINE0(sigreturn) 179 - { 180 - struct pt_regs *regs = task_pt_regs(current); 181 - sigframe32 __user *frame = (sigframe32 __user *)regs->gprs[15]; 182 - sigset_t set; 183 - 184 - if (get_compat_sigset(&set, (compat_sigset_t __user *)frame->sc.oldmask)) 185 - goto badframe; 186 - set_current_blocked(&set); 187 - save_user_fpu_regs(); 188 - if (restore_sigregs32(regs, &frame->sregs)) 189 - goto badframe; 190 - if (restore_sigregs_ext32(regs, &frame->sregs_ext)) 191 - goto badframe; 192 - load_sigregs(); 193 - return regs->gprs[2]; 194 - badframe: 195 - force_sig(SIGSEGV); 196 - return 0; 197 - } 198 - 199 - COMPAT_SYSCALL_DEFINE0(rt_sigreturn) 200 - { 201 - struct pt_regs *regs = task_pt_regs(current); 202 - rt_sigframe32 __user *frame = (rt_sigframe32 __user *)regs->gprs[15]; 203 - sigset_t set; 204 - 205 - if (get_compat_sigset(&set, &frame->uc.uc_sigmask)) 206 - goto badframe; 207 - set_current_blocked(&set); 208 - if (compat_restore_altstack(&frame->uc.uc_stack)) 209 - goto badframe; 210 - save_user_fpu_regs(); 211 - if (restore_sigregs32(regs, &frame->uc.uc_mcontext)) 212 - goto badframe; 213 - if (restore_sigregs_ext32(regs, &frame->uc.uc_mcontext_ext)) 214 - goto badframe; 215 - load_sigregs(); 216 - return regs->gprs[2]; 217 - badframe: 218 - force_sig(SIGSEGV); 219 - return 0; 220 - } 221 - 222 - /* 223 - * Set up a signal frame. 224 - */ 225 - 226 - 227 - /* 228 - * Determine which stack to use.. 229 - */ 230 - static inline void __user * 231 - get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) 232 - { 233 - unsigned long sp; 234 - 235 - /* Default to using normal stack */ 236 - sp = (unsigned long) A(regs->gprs[15]); 237 - 238 - /* Overflow on alternate signal stack gives SIGSEGV. */ 239 - if (on_sig_stack(sp) && !on_sig_stack((sp - frame_size) & -8UL)) 240 - return (void __user *) -1UL; 241 - 242 - /* This is the X/Open sanctioned signal stack switching. */ 243 - if (ka->sa.sa_flags & SA_ONSTACK) { 244 - if (! sas_ss_flags(sp)) 245 - sp = current->sas_ss_sp + current->sas_ss_size; 246 - } 247 - 248 - return (void __user *)((sp - frame_size) & -8ul); 249 - } 250 - 251 - static int setup_frame32(struct ksignal *ksig, sigset_t *set, 252 - struct pt_regs *regs) 253 - { 254 - int sig = ksig->sig; 255 - sigframe32 __user *frame; 256 - unsigned long restorer; 257 - size_t frame_size; 258 - 259 - /* 260 - * gprs_high are always present for 31-bit compat tasks. 261 - * The space for vector registers is only allocated if 262 - * the machine supports it 263 - */ 264 - frame_size = sizeof(*frame) - sizeof(frame->sregs_ext.__reserved); 265 - if (!cpu_has_vx()) 266 - frame_size -= sizeof(frame->sregs_ext.vxrs_low) + 267 - sizeof(frame->sregs_ext.vxrs_high); 268 - frame = get_sigframe(&ksig->ka, regs, frame_size); 269 - if (frame == (void __user *) -1UL) 270 - return -EFAULT; 271 - 272 - /* Set up backchain. */ 273 - if (__put_user(regs->gprs[15], (unsigned int __user *) frame)) 274 - return -EFAULT; 275 - 276 - /* Create struct sigcontext32 on the signal stack */ 277 - if (put_compat_sigset((compat_sigset_t __user *)frame->sc.oldmask, 278 - set, sizeof(compat_sigset_t))) 279 - return -EFAULT; 280 - if (__put_user(ptr_to_compat(&frame->sregs), &frame->sc.sregs)) 281 - return -EFAULT; 282 - 283 - /* Store registers needed to create the signal frame */ 284 - store_sigregs(); 285 - 286 - /* Create _sigregs32 on the signal stack */ 287 - if (save_sigregs32(regs, &frame->sregs)) 288 - return -EFAULT; 289 - 290 - /* Place signal number on stack to allow backtrace from handler. */ 291 - if (__put_user(regs->gprs[2], (int __force __user *) &frame->signo)) 292 - return -EFAULT; 293 - 294 - /* Create _sigregs_ext32 on the signal stack */ 295 - if (save_sigregs_ext32(regs, &frame->sregs_ext)) 296 - return -EFAULT; 297 - 298 - /* Set up to return from userspace. If provided, use a stub 299 - already in userspace. */ 300 - if (ksig->ka.sa.sa_flags & SA_RESTORER) { 301 - restorer = (unsigned long __force) 302 - ksig->ka.sa.sa_restorer | PSW32_ADDR_AMODE; 303 - } else { 304 - restorer = VDSO32_SYMBOL(current, sigreturn); 305 - } 306 - 307 - /* Set up registers for signal handler */ 308 - regs->gprs[14] = restorer; 309 - regs->gprs[15] = (__force __u64) frame; 310 - /* Force 31 bit amode and default user address space control. */ 311 - regs->psw.mask = PSW_MASK_BA | 312 - (PSW_USER_BITS & PSW_MASK_ASC) | 313 - (regs->psw.mask & ~PSW_MASK_ASC); 314 - regs->psw.addr = (__force __u64) ksig->ka.sa.sa_handler; 315 - 316 - regs->gprs[2] = sig; 317 - regs->gprs[3] = (__force __u64) &frame->sc; 318 - 319 - /* We forgot to include these in the sigcontext. 320 - To avoid breaking binary compatibility, they are passed as args. */ 321 - if (sig == SIGSEGV || sig == SIGBUS || sig == SIGILL || 322 - sig == SIGTRAP || sig == SIGFPE) { 323 - /* set extra registers only for synchronous signals */ 324 - regs->gprs[4] = regs->int_code & 127; 325 - regs->gprs[5] = regs->int_parm_long; 326 - regs->gprs[6] = current->thread.last_break; 327 - } 328 - 329 - return 0; 330 - } 331 - 332 - static int setup_rt_frame32(struct ksignal *ksig, sigset_t *set, 333 - struct pt_regs *regs) 334 - { 335 - rt_sigframe32 __user *frame; 336 - unsigned long restorer; 337 - size_t frame_size; 338 - u32 uc_flags; 339 - 340 - frame_size = sizeof(*frame) - 341 - sizeof(frame->uc.uc_mcontext_ext.__reserved); 342 - /* 343 - * gprs_high are always present for 31-bit compat tasks. 344 - * The space for vector registers is only allocated if 345 - * the machine supports it 346 - */ 347 - uc_flags = UC_GPRS_HIGH; 348 - if (cpu_has_vx()) { 349 - uc_flags |= UC_VXRS; 350 - } else { 351 - frame_size -= sizeof(frame->uc.uc_mcontext_ext.vxrs_low) + 352 - sizeof(frame->uc.uc_mcontext_ext.vxrs_high); 353 - } 354 - frame = get_sigframe(&ksig->ka, regs, frame_size); 355 - if (frame == (void __user *) -1UL) 356 - return -EFAULT; 357 - 358 - /* Set up backchain. */ 359 - if (__put_user(regs->gprs[15], (unsigned int __force __user *) frame)) 360 - return -EFAULT; 361 - 362 - /* Set up to return from userspace. If provided, use a stub 363 - already in userspace. */ 364 - if (ksig->ka.sa.sa_flags & SA_RESTORER) { 365 - restorer = (unsigned long __force) 366 - ksig->ka.sa.sa_restorer | PSW32_ADDR_AMODE; 367 - } else { 368 - restorer = VDSO32_SYMBOL(current, rt_sigreturn); 369 - } 370 - 371 - /* Create siginfo on the signal stack */ 372 - if (copy_siginfo_to_user32(&frame->info, &ksig->info)) 373 - return -EFAULT; 374 - 375 - /* Store registers needed to create the signal frame */ 376 - store_sigregs(); 377 - 378 - /* Create ucontext on the signal stack. */ 379 - if (__put_user(uc_flags, &frame->uc.uc_flags) || 380 - __put_user(0, &frame->uc.uc_link) || 381 - __compat_save_altstack(&frame->uc.uc_stack, regs->gprs[15]) || 382 - save_sigregs32(regs, &frame->uc.uc_mcontext) || 383 - put_compat_sigset(&frame->uc.uc_sigmask, set, sizeof(compat_sigset_t)) || 384 - save_sigregs_ext32(regs, &frame->uc.uc_mcontext_ext)) 385 - return -EFAULT; 386 - 387 - /* Set up registers for signal handler */ 388 - regs->gprs[14] = restorer; 389 - regs->gprs[15] = (__force __u64) frame; 390 - /* Force 31 bit amode and default user address space control. */ 391 - regs->psw.mask = PSW_MASK_BA | 392 - (PSW_USER_BITS & PSW_MASK_ASC) | 393 - (regs->psw.mask & ~PSW_MASK_ASC); 394 - regs->psw.addr = (__u64 __force) ksig->ka.sa.sa_handler; 395 - 396 - regs->gprs[2] = ksig->sig; 397 - regs->gprs[3] = (__force __u64) &frame->info; 398 - regs->gprs[4] = (__force __u64) &frame->uc; 399 - regs->gprs[5] = current->thread.last_break; 400 - return 0; 401 - } 402 - 403 - /* 404 - * OK, we're invoking a handler 405 - */ 406 - 407 - void handle_signal32(struct ksignal *ksig, sigset_t *oldset, 408 - struct pt_regs *regs) 409 - { 410 - int ret; 411 - 412 - /* Set up the stack frame */ 413 - if (ksig->ka.sa.sa_flags & SA_SIGINFO) 414 - ret = setup_rt_frame32(ksig, oldset, regs); 415 - else 416 - ret = setup_frame32(ksig, oldset, regs); 417 - 418 - signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLE_STEP)); 419 - } 420 -
-9
arch/s390/kernel/entry.S
··· 614 614 #include <asm/syscall_table.h> 615 615 SYM_DATA_END(sys_call_table) 616 616 #undef SYSCALL 617 - 618 - #ifdef CONFIG_COMPAT 619 - 620 - #define SYSCALL(esame,emu) .quad __s390_ ## emu 621 - SYM_DATA_START(sys_call_table_emu) 622 - #include <asm/syscall_table.h> 623 - SYM_DATA_END(sys_call_table_emu) 624 - #undef SYSCALL 625 - #endif
-1
arch/s390/kernel/perf_cpum_cf.c
··· 1689 1689 .open = cfset_open, 1690 1690 .release = cfset_release, 1691 1691 .unlocked_ioctl = cfset_ioctl, 1692 - .compat_ioctl = cfset_ioctl, 1693 1692 }; 1694 1693 1695 1694 static struct miscdevice cfset_dev = {
-1
arch/s390/kernel/perf_event.c
··· 15 15 #include <linux/seq_file.h> 16 16 #include <linux/spinlock.h> 17 17 #include <linux/uaccess.h> 18 - #include <linux/compat.h> 19 18 #include <linux/sysfs.h> 20 19 #include <asm/stacktrace.h> 21 20 #include <asm/irq.h>
-3
arch/s390/kernel/perf_regs.c
··· 44 44 45 45 u64 perf_reg_abi(struct task_struct *task) 46 46 { 47 - if (test_tsk_thread_flag(task, TIF_31BIT)) 48 - return PERF_SAMPLE_REGS_ABI_32; 49 - 50 47 return PERF_SAMPLE_REGS_ABI_64; 51 48 } 52 49
+2 -7
arch/s390/kernel/process.c
··· 24 24 #include <linux/tick.h> 25 25 #include <linux/personality.h> 26 26 #include <linux/syscalls.h> 27 - #include <linux/compat.h> 28 27 #include <linux/kprobes.h> 29 28 #include <linux/random.h> 30 29 #include <linux/init_task.h> ··· 165 166 166 167 /* Set a new TLS ? */ 167 168 if (clone_flags & CLONE_SETTLS) { 168 - if (is_compat_task()) { 169 - p->thread.acrs[0] = (unsigned int)tls; 170 - } else { 171 - p->thread.acrs[0] = (unsigned int)(tls >> 32); 172 - p->thread.acrs[1] = (unsigned int)tls; 173 - } 169 + p->thread.acrs[0] = (unsigned int)(tls >> 32); 170 + p->thread.acrs[1] = (unsigned int)tls; 174 171 } 175 172 /* 176 173 * s390 stores the svc return address in arch_data when calling
-524
arch/s390/kernel/ptrace.c
··· 22 22 #include <linux/elf.h> 23 23 #include <linux/regset.h> 24 24 #include <linux/seccomp.h> 25 - #include <linux/compat.h> 26 25 #include <trace/syscall.h> 27 26 #include <asm/guarded_storage.h> 28 27 #include <asm/access-regs.h> ··· 36 37 #include <asm/fpu.h> 37 38 38 39 #include "entry.h" 39 - 40 - #ifdef CONFIG_COMPAT 41 - #include "compat_ptrace.h" 42 - #endif 43 40 44 41 void update_cr_regs(struct task_struct *task) 45 42 { ··· 501 506 return ptrace_request(child, request, addr, data); 502 507 } 503 508 } 504 - 505 - #ifdef CONFIG_COMPAT 506 - /* 507 - * Now the fun part starts... a 31 bit program running in the 508 - * 31 bit emulation tracing another program. PTRACE_PEEKTEXT, 509 - * PTRACE_PEEKDATA, PTRACE_POKETEXT and PTRACE_POKEDATA are easy 510 - * to handle, the difference to the 64 bit versions of the requests 511 - * is that the access is done in multiples of 4 byte instead of 512 - * 8 bytes (sizeof(unsigned long) on 31/64 bit). 513 - * The ugly part are PTRACE_PEEKUSR, PTRACE_PEEKUSR_AREA, 514 - * PTRACE_POKEUSR and PTRACE_POKEUSR_AREA. If the traced program 515 - * is a 31 bit program too, the content of struct user can be 516 - * emulated. A 31 bit program peeking into the struct user of 517 - * a 64 bit program is a no-no. 518 - */ 519 - 520 - /* 521 - * Same as peek_user_per but for a 31 bit program. 522 - */ 523 - static inline __u32 __peek_user_per_compat(struct task_struct *child, 524 - addr_t addr) 525 - { 526 - if (addr == offsetof(struct compat_per_struct_kernel, cr9)) 527 - /* Control bits of the active per set. */ 528 - return (__u32) test_thread_flag(TIF_SINGLE_STEP) ? 529 - PER_EVENT_IFETCH : child->thread.per_user.control; 530 - else if (addr == offsetof(struct compat_per_struct_kernel, cr10)) 531 - /* Start address of the active per set. */ 532 - return (__u32) test_thread_flag(TIF_SINGLE_STEP) ? 533 - 0 : child->thread.per_user.start; 534 - else if (addr == offsetof(struct compat_per_struct_kernel, cr11)) 535 - /* End address of the active per set. */ 536 - return test_thread_flag(TIF_SINGLE_STEP) ? 537 - PSW32_ADDR_INSN : child->thread.per_user.end; 538 - else if (addr == offsetof(struct compat_per_struct_kernel, bits)) 539 - /* Single-step bit. */ 540 - return (__u32) test_thread_flag(TIF_SINGLE_STEP) ? 541 - 0x80000000 : 0; 542 - else if (addr == offsetof(struct compat_per_struct_kernel, starting_addr)) 543 - /* Start address of the user specified per set. */ 544 - return (__u32) child->thread.per_user.start; 545 - else if (addr == offsetof(struct compat_per_struct_kernel, ending_addr)) 546 - /* End address of the user specified per set. */ 547 - return (__u32) child->thread.per_user.end; 548 - else if (addr == offsetof(struct compat_per_struct_kernel, perc_atmid)) 549 - /* PER code, ATMID and AI of the last PER trap */ 550 - return (__u32) child->thread.per_event.cause << 16; 551 - else if (addr == offsetof(struct compat_per_struct_kernel, address)) 552 - /* Address of the last PER trap */ 553 - return (__u32) child->thread.per_event.address; 554 - else if (addr == offsetof(struct compat_per_struct_kernel, access_id)) 555 - /* Access id of the last PER trap */ 556 - return (__u32) child->thread.per_event.paid << 24; 557 - return 0; 558 - } 559 - 560 - /* 561 - * Same as peek_user but for a 31 bit program. 562 - */ 563 - static u32 __peek_user_compat(struct task_struct *child, addr_t addr) 564 - { 565 - addr_t offset; 566 - __u32 tmp; 567 - 568 - if (addr < offsetof(struct compat_user, regs.acrs)) { 569 - struct pt_regs *regs = task_pt_regs(child); 570 - /* 571 - * psw and gprs are stored on the stack 572 - */ 573 - if (addr == offsetof(struct compat_user, regs.psw.mask)) { 574 - /* Fake a 31 bit psw mask. */ 575 - tmp = (__u32)(regs->psw.mask >> 32); 576 - tmp &= PSW32_MASK_USER | PSW32_MASK_RI; 577 - tmp |= PSW32_USER_BITS; 578 - } else if (addr == offsetof(struct compat_user, regs.psw.addr)) { 579 - /* Fake a 31 bit psw address. */ 580 - tmp = (__u32) regs->psw.addr | 581 - (__u32)(regs->psw.mask & PSW_MASK_BA); 582 - } else { 583 - /* gpr 0-15 */ 584 - tmp = *(__u32 *)((addr_t) &regs->psw + addr*2 + 4); 585 - } 586 - } else if (addr < offsetof(struct compat_user, regs.orig_gpr2)) { 587 - /* 588 - * access registers are stored in the thread structure 589 - */ 590 - offset = addr - offsetof(struct compat_user, regs.acrs); 591 - tmp = *(__u32*)((addr_t) &child->thread.acrs + offset); 592 - 593 - } else if (addr == offsetof(struct compat_user, regs.orig_gpr2)) { 594 - /* 595 - * orig_gpr2 is stored on the kernel stack 596 - */ 597 - tmp = *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4); 598 - 599 - } else if (addr < offsetof(struct compat_user, regs.fp_regs)) { 600 - /* 601 - * prevent reads of padding hole between 602 - * orig_gpr2 and fp_regs on s390. 603 - */ 604 - tmp = 0; 605 - 606 - } else if (addr == offsetof(struct compat_user, regs.fp_regs.fpc)) { 607 - /* 608 - * floating point control reg. is in the thread structure 609 - */ 610 - tmp = child->thread.ufpu.fpc; 611 - 612 - } else if (addr < offsetof(struct compat_user, regs.fp_regs) + sizeof(s390_fp_regs)) { 613 - /* 614 - * floating point regs. are in the child->thread.ufpu.vxrs array 615 - */ 616 - offset = addr - offsetof(struct compat_user, regs.fp_regs.fprs); 617 - tmp = *(__u32 *)((addr_t)child->thread.ufpu.vxrs + 2 * offset); 618 - } else if (addr < offsetof(struct compat_user, regs.per_info) + sizeof(struct compat_per_struct_kernel)) { 619 - /* 620 - * Handle access to the per_info structure. 621 - */ 622 - addr -= offsetof(struct compat_user, regs.per_info); 623 - tmp = __peek_user_per_compat(child, addr); 624 - 625 - } else 626 - tmp = 0; 627 - 628 - return tmp; 629 - } 630 - 631 - static int peek_user_compat(struct task_struct *child, 632 - addr_t addr, addr_t data) 633 - { 634 - __u32 tmp; 635 - 636 - if (!is_compat_task() || (addr & 3) || addr > sizeof(struct user) - 3) 637 - return -EIO; 638 - 639 - tmp = __peek_user_compat(child, addr); 640 - return put_user(tmp, (__u32 __user *) data); 641 - } 642 - 643 - /* 644 - * Same as poke_user_per but for a 31 bit program. 645 - */ 646 - static inline void __poke_user_per_compat(struct task_struct *child, 647 - addr_t addr, __u32 data) 648 - { 649 - if (addr == offsetof(struct compat_per_struct_kernel, cr9)) 650 - /* PER event mask of the user specified per set. */ 651 - child->thread.per_user.control = 652 - data & (PER_EVENT_MASK | PER_CONTROL_MASK); 653 - else if (addr == offsetof(struct compat_per_struct_kernel, starting_addr)) 654 - /* Starting address of the user specified per set. */ 655 - child->thread.per_user.start = data; 656 - else if (addr == offsetof(struct compat_per_struct_kernel, ending_addr)) 657 - /* Ending address of the user specified per set. */ 658 - child->thread.per_user.end = data; 659 - } 660 - 661 - /* 662 - * Same as poke_user but for a 31 bit program. 663 - */ 664 - static int __poke_user_compat(struct task_struct *child, 665 - addr_t addr, addr_t data) 666 - { 667 - __u32 tmp = (__u32) data; 668 - addr_t offset; 669 - 670 - if (addr < offsetof(struct compat_user, regs.acrs)) { 671 - struct pt_regs *regs = task_pt_regs(child); 672 - /* 673 - * psw, gprs, acrs and orig_gpr2 are stored on the stack 674 - */ 675 - if (addr == offsetof(struct compat_user, regs.psw.mask)) { 676 - __u32 mask = PSW32_MASK_USER; 677 - 678 - mask |= is_ri_task(child) ? PSW32_MASK_RI : 0; 679 - /* Build a 64 bit psw mask from 31 bit mask. */ 680 - if ((tmp ^ PSW32_USER_BITS) & ~mask) 681 - /* Invalid psw mask. */ 682 - return -EINVAL; 683 - if ((data & PSW32_MASK_ASC) == PSW32_ASC_HOME) 684 - /* Invalid address-space-control bits */ 685 - return -EINVAL; 686 - regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) | 687 - (regs->psw.mask & PSW_MASK_BA) | 688 - (__u64)(tmp & mask) << 32; 689 - } else if (addr == offsetof(struct compat_user, regs.psw.addr)) { 690 - /* Build a 64 bit psw address from 31 bit address. */ 691 - regs->psw.addr = (__u64) tmp & PSW32_ADDR_INSN; 692 - /* Transfer 31 bit amode bit to psw mask. */ 693 - regs->psw.mask = (regs->psw.mask & ~PSW_MASK_BA) | 694 - (__u64)(tmp & PSW32_ADDR_AMODE); 695 - } else { 696 - if (test_pt_regs_flag(regs, PIF_SYSCALL) && 697 - addr == offsetof(struct compat_user, regs.gprs[2])) { 698 - struct pt_regs *regs = task_pt_regs(child); 699 - 700 - regs->int_code = 0x20000 | (data & 0xffff); 701 - } 702 - /* gpr 0-15 */ 703 - *(__u32*)((addr_t) &regs->psw + addr*2 + 4) = tmp; 704 - } 705 - } else if (addr < offsetof(struct compat_user, regs.orig_gpr2)) { 706 - /* 707 - * access registers are stored in the thread structure 708 - */ 709 - offset = addr - offsetof(struct compat_user, regs.acrs); 710 - *(__u32*)((addr_t) &child->thread.acrs + offset) = tmp; 711 - 712 - } else if (addr == offsetof(struct compat_user, regs.orig_gpr2)) { 713 - /* 714 - * orig_gpr2 is stored on the kernel stack 715 - */ 716 - *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4) = tmp; 717 - 718 - } else if (addr < offsetof(struct compat_user, regs.fp_regs)) { 719 - /* 720 - * prevent writess of padding hole between 721 - * orig_gpr2 and fp_regs on s390. 722 - */ 723 - return 0; 724 - 725 - } else if (addr == offsetof(struct compat_user, regs.fp_regs.fpc)) { 726 - /* 727 - * floating point control reg. is in the thread structure 728 - */ 729 - child->thread.ufpu.fpc = data; 730 - 731 - } else if (addr < offsetof(struct compat_user, regs.fp_regs) + sizeof(s390_fp_regs)) { 732 - /* 733 - * floating point regs. are in the child->thread.ufpu.vxrs array 734 - */ 735 - offset = addr - offsetof(struct compat_user, regs.fp_regs.fprs); 736 - *(__u32 *)((addr_t)child->thread.ufpu.vxrs + 2 * offset) = tmp; 737 - } else if (addr < offsetof(struct compat_user, regs.per_info) + sizeof(struct compat_per_struct_kernel)) { 738 - /* 739 - * Handle access to the per_info structure. 740 - */ 741 - addr -= offsetof(struct compat_user, regs.per_info); 742 - __poke_user_per_compat(child, addr, data); 743 - } 744 - 745 - return 0; 746 - } 747 - 748 - static int poke_user_compat(struct task_struct *child, 749 - addr_t addr, addr_t data) 750 - { 751 - if (!is_compat_task() || (addr & 3) || 752 - addr > sizeof(struct compat_user) - 3) 753 - return -EIO; 754 - 755 - return __poke_user_compat(child, addr, data); 756 - } 757 - 758 - long compat_arch_ptrace(struct task_struct *child, compat_long_t request, 759 - compat_ulong_t caddr, compat_ulong_t cdata) 760 - { 761 - unsigned long addr = caddr; 762 - unsigned long data = cdata; 763 - compat_ptrace_area parea; 764 - int copied, ret; 765 - 766 - switch (request) { 767 - case PTRACE_PEEKUSR: 768 - /* read the word at location addr in the USER area. */ 769 - return peek_user_compat(child, addr, data); 770 - 771 - case PTRACE_POKEUSR: 772 - /* write the word at location addr in the USER area */ 773 - return poke_user_compat(child, addr, data); 774 - 775 - case PTRACE_PEEKUSR_AREA: 776 - case PTRACE_POKEUSR_AREA: 777 - if (copy_from_user(&parea, (void __force __user *) addr, 778 - sizeof(parea))) 779 - return -EFAULT; 780 - addr = parea.kernel_addr; 781 - data = parea.process_addr; 782 - copied = 0; 783 - while (copied < parea.len) { 784 - if (request == PTRACE_PEEKUSR_AREA) 785 - ret = peek_user_compat(child, addr, data); 786 - else { 787 - __u32 utmp; 788 - if (get_user(utmp, 789 - (__u32 __force __user *) data)) 790 - return -EFAULT; 791 - ret = poke_user_compat(child, addr, utmp); 792 - } 793 - if (ret) 794 - return ret; 795 - addr += sizeof(unsigned int); 796 - data += sizeof(unsigned int); 797 - copied += sizeof(unsigned int); 798 - } 799 - return 0; 800 - case PTRACE_GET_LAST_BREAK: 801 - return put_user(child->thread.last_break, (unsigned int __user *)data); 802 - } 803 - return compat_ptrace_request(child, request, addr, data); 804 - } 805 - #endif 806 509 807 510 /* 808 511 * user_regset definitions. ··· 990 1297 .n = ARRAY_SIZE(s390_regsets) 991 1298 }; 992 1299 993 - #ifdef CONFIG_COMPAT 994 - static int s390_compat_regs_get(struct task_struct *target, 995 - const struct user_regset *regset, 996 - struct membuf to) 997 - { 998 - unsigned n; 999 - 1000 - if (target == current) 1001 - save_access_regs(target->thread.acrs); 1002 - 1003 - for (n = 0; n < sizeof(s390_compat_regs); n += sizeof(compat_ulong_t)) 1004 - membuf_store(&to, __peek_user_compat(target, n)); 1005 - return 0; 1006 - } 1007 - 1008 - static int s390_compat_regs_set(struct task_struct *target, 1009 - const struct user_regset *regset, 1010 - unsigned int pos, unsigned int count, 1011 - const void *kbuf, const void __user *ubuf) 1012 - { 1013 - int rc = 0; 1014 - 1015 - if (target == current) 1016 - save_access_regs(target->thread.acrs); 1017 - 1018 - if (kbuf) { 1019 - const compat_ulong_t *k = kbuf; 1020 - while (count > 0 && !rc) { 1021 - rc = __poke_user_compat(target, pos, *k++); 1022 - count -= sizeof(*k); 1023 - pos += sizeof(*k); 1024 - } 1025 - } else { 1026 - const compat_ulong_t __user *u = ubuf; 1027 - while (count > 0 && !rc) { 1028 - compat_ulong_t word; 1029 - rc = __get_user(word, u++); 1030 - if (rc) 1031 - break; 1032 - rc = __poke_user_compat(target, pos, word); 1033 - count -= sizeof(*u); 1034 - pos += sizeof(*u); 1035 - } 1036 - } 1037 - 1038 - if (rc == 0 && target == current) 1039 - restore_access_regs(target->thread.acrs); 1040 - 1041 - return rc; 1042 - } 1043 - 1044 - static int s390_compat_regs_high_get(struct task_struct *target, 1045 - const struct user_regset *regset, 1046 - struct membuf to) 1047 - { 1048 - compat_ulong_t *gprs_high; 1049 - int i; 1050 - 1051 - gprs_high = (compat_ulong_t *)task_pt_regs(target)->gprs; 1052 - for (i = 0; i < NUM_GPRS; i++, gprs_high += 2) 1053 - membuf_store(&to, *gprs_high); 1054 - return 0; 1055 - } 1056 - 1057 - static int s390_compat_regs_high_set(struct task_struct *target, 1058 - const struct user_regset *regset, 1059 - unsigned int pos, unsigned int count, 1060 - const void *kbuf, const void __user *ubuf) 1061 - { 1062 - compat_ulong_t *gprs_high; 1063 - int rc = 0; 1064 - 1065 - gprs_high = (compat_ulong_t *) 1066 - &task_pt_regs(target)->gprs[pos / sizeof(compat_ulong_t)]; 1067 - if (kbuf) { 1068 - const compat_ulong_t *k = kbuf; 1069 - while (count > 0) { 1070 - *gprs_high = *k++; 1071 - *gprs_high += 2; 1072 - count -= sizeof(*k); 1073 - } 1074 - } else { 1075 - const compat_ulong_t __user *u = ubuf; 1076 - while (count > 0 && !rc) { 1077 - unsigned long word; 1078 - rc = __get_user(word, u++); 1079 - if (rc) 1080 - break; 1081 - *gprs_high = word; 1082 - *gprs_high += 2; 1083 - count -= sizeof(*u); 1084 - } 1085 - } 1086 - 1087 - return rc; 1088 - } 1089 - 1090 - static int s390_compat_last_break_get(struct task_struct *target, 1091 - const struct user_regset *regset, 1092 - struct membuf to) 1093 - { 1094 - compat_ulong_t last_break = target->thread.last_break; 1095 - 1096 - return membuf_store(&to, (unsigned long)last_break); 1097 - } 1098 - 1099 - static int s390_compat_last_break_set(struct task_struct *target, 1100 - const struct user_regset *regset, 1101 - unsigned int pos, unsigned int count, 1102 - const void *kbuf, const void __user *ubuf) 1103 - { 1104 - return 0; 1105 - } 1106 - 1107 - static const struct user_regset s390_compat_regsets[] = { 1108 - { 1109 - USER_REGSET_NOTE_TYPE(PRSTATUS), 1110 - .n = sizeof(s390_compat_regs) / sizeof(compat_long_t), 1111 - .size = sizeof(compat_long_t), 1112 - .align = sizeof(compat_long_t), 1113 - .regset_get = s390_compat_regs_get, 1114 - .set = s390_compat_regs_set, 1115 - }, 1116 - { 1117 - USER_REGSET_NOTE_TYPE(PRFPREG), 1118 - .n = sizeof(s390_fp_regs) / sizeof(compat_long_t), 1119 - .size = sizeof(compat_long_t), 1120 - .align = sizeof(compat_long_t), 1121 - .regset_get = s390_fpregs_get, 1122 - .set = s390_fpregs_set, 1123 - }, 1124 - { 1125 - USER_REGSET_NOTE_TYPE(S390_SYSTEM_CALL), 1126 - .n = 1, 1127 - .size = sizeof(compat_uint_t), 1128 - .align = sizeof(compat_uint_t), 1129 - .regset_get = s390_system_call_get, 1130 - .set = s390_system_call_set, 1131 - }, 1132 - { 1133 - USER_REGSET_NOTE_TYPE(S390_LAST_BREAK), 1134 - .n = 1, 1135 - .size = sizeof(long), 1136 - .align = sizeof(long), 1137 - .regset_get = s390_compat_last_break_get, 1138 - .set = s390_compat_last_break_set, 1139 - }, 1140 - { 1141 - USER_REGSET_NOTE_TYPE(S390_TDB), 1142 - .n = 1, 1143 - .size = 256, 1144 - .align = 1, 1145 - .regset_get = s390_tdb_get, 1146 - .set = s390_tdb_set, 1147 - }, 1148 - { 1149 - USER_REGSET_NOTE_TYPE(S390_VXRS_LOW), 1150 - .n = __NUM_VXRS_LOW, 1151 - .size = sizeof(__u64), 1152 - .align = sizeof(__u64), 1153 - .regset_get = s390_vxrs_low_get, 1154 - .set = s390_vxrs_low_set, 1155 - }, 1156 - { 1157 - USER_REGSET_NOTE_TYPE(S390_VXRS_HIGH), 1158 - .n = __NUM_VXRS_HIGH, 1159 - .size = sizeof(__vector128), 1160 - .align = sizeof(__vector128), 1161 - .regset_get = s390_vxrs_high_get, 1162 - .set = s390_vxrs_high_set, 1163 - }, 1164 - { 1165 - USER_REGSET_NOTE_TYPE(S390_HIGH_GPRS), 1166 - .n = sizeof(s390_compat_regs_high) / sizeof(compat_long_t), 1167 - .size = sizeof(compat_long_t), 1168 - .align = sizeof(compat_long_t), 1169 - .regset_get = s390_compat_regs_high_get, 1170 - .set = s390_compat_regs_high_set, 1171 - }, 1172 - { 1173 - USER_REGSET_NOTE_TYPE(S390_GS_CB), 1174 - .n = sizeof(struct gs_cb) / sizeof(__u64), 1175 - .size = sizeof(__u64), 1176 - .align = sizeof(__u64), 1177 - .regset_get = s390_gs_cb_get, 1178 - .set = s390_gs_cb_set, 1179 - }, 1180 - { 1181 - USER_REGSET_NOTE_TYPE(S390_GS_BC), 1182 - .n = sizeof(struct gs_cb) / sizeof(__u64), 1183 - .size = sizeof(__u64), 1184 - .align = sizeof(__u64), 1185 - .regset_get = s390_gs_bc_get, 1186 - .set = s390_gs_bc_set, 1187 - }, 1188 - { 1189 - USER_REGSET_NOTE_TYPE(S390_RI_CB), 1190 - .n = sizeof(struct runtime_instr_cb) / sizeof(__u64), 1191 - .size = sizeof(__u64), 1192 - .align = sizeof(__u64), 1193 - .regset_get = s390_runtime_instr_get, 1194 - .set = s390_runtime_instr_set, 1195 - }, 1196 - }; 1197 - 1198 - static const struct user_regset_view user_s390_compat_view = { 1199 - .name = "s390", 1200 - .e_machine = EM_S390, 1201 - .regsets = s390_compat_regsets, 1202 - .n = ARRAY_SIZE(s390_compat_regsets) 1203 - }; 1204 - #endif 1205 - 1206 1300 const struct user_regset_view *task_user_regset_view(struct task_struct *task) 1207 1301 { 1208 - #ifdef CONFIG_COMPAT 1209 - if (test_tsk_thread_flag(task, TIF_31BIT)) 1210 - return &user_s390_compat_view; 1211 - #endif 1212 1302 return &user_s390_view; 1213 1303 } 1214 1304
-1
arch/s390/kernel/setup.c
··· 47 47 #include <linux/kexec.h> 48 48 #include <linux/crash_dump.h> 49 49 #include <linux/memory.h> 50 - #include <linux/compat.h> 51 50 #include <linux/start_kernel.h> 52 51 #include <linux/hugetlb.h> 53 52 #include <linux/kmemleak.h>
+2 -21
arch/s390/kernel/signal.c
··· 27 27 #include <linux/personality.h> 28 28 #include <linux/binfmts.h> 29 29 #include <linux/syscalls.h> 30 - #include <linux/compat.h> 31 30 #include <asm/ucontext.h> 32 31 #include <linux/uaccess.h> 33 32 #include <asm/vdso-symbols.h> ··· 289 290 unsigned long restorer; 290 291 size_t frame_size; 291 292 292 - /* 293 - * gprs_high are only present for a 31-bit task running on 294 - * a 64-bit kernel (see compat_signal.c) but the space for 295 - * gprs_high need to be allocated if vector registers are 296 - * included in the signal frame on a 31-bit system. 297 - */ 298 293 frame_size = sizeof(*frame) - sizeof(frame->sregs_ext); 299 294 if (cpu_has_vx()) 300 295 frame_size += sizeof(frame->sregs_ext); ··· 360 367 size_t frame_size; 361 368 362 369 frame_size = sizeof(struct rt_sigframe) - sizeof(_sigregs_ext); 363 - /* 364 - * gprs_high are only present for a 31-bit task running on 365 - * a 64-bit kernel (see compat_signal.c) but the space for 366 - * gprs_high need to be allocated if vector registers are 367 - * included in the signal frame on a 31-bit system. 368 - */ 369 370 uc_flags = 0; 370 371 if (cpu_has_vx()) { 371 372 frame_size += sizeof(_sigregs_ext); ··· 477 490 clear_pt_regs_flag(regs, PIF_SYSCALL); 478 491 479 492 rseq_signal_deliver(&ksig, regs); 480 - if (is_compat_task()) 481 - handle_signal32(&ksig, oldset, regs); 482 - else 483 - handle_signal(&ksig, oldset, regs); 493 + handle_signal(&ksig, oldset, regs); 484 494 return; 485 495 } 486 496 ··· 490 506 /* Restart with sys_restart_syscall */ 491 507 regs->gprs[2] = regs->orig_gpr2; 492 508 current->restart_block.arch_data = regs->psw.addr; 493 - if (is_compat_task()) 494 - regs->psw.addr = VDSO32_SYMBOL(current, restart_syscall); 495 - else 496 - regs->psw.addr = VDSO64_SYMBOL(current, restart_syscall); 509 + regs->psw.addr = VDSO64_SYMBOL(current, restart_syscall); 497 510 if (test_thread_flag(TIF_SINGLE_STEP)) 498 511 clear_thread_flag(TIF_PER_TRAP); 499 512 break;
-3
arch/s390/kernel/stacktrace.c
··· 8 8 #include <linux/perf_event.h> 9 9 #include <linux/stacktrace.h> 10 10 #include <linux/uaccess.h> 11 - #include <linux/compat.h> 12 11 #include <asm/asm-offsets.h> 13 12 #include <asm/stacktrace.h> 14 13 #include <asm/unwind.h> ··· 106 107 unsigned long ip, sp; 107 108 bool first = true; 108 109 109 - if (is_compat_task()) 110 - return; 111 110 if (!current->mm) 112 111 return; 113 112 ip = instruction_pointer(regs);
+2 -4
arch/s390/kernel/uprobes.c
··· 8 8 9 9 #include <linux/uaccess.h> 10 10 #include <linux/uprobes.h> 11 - #include <linux/compat.h> 12 11 #include <linux/kdebug.h> 13 12 #include <linux/sched/task_stack.h> 14 13 ··· 28 29 { 29 30 if (psw_bits(regs->psw).eaba == PSW_BITS_AMODE_24BIT) 30 31 return -EINVAL; 31 - if (!is_compat_task() && psw_bits(regs->psw).eaba == PSW_BITS_AMODE_31BIT) 32 + if (psw_bits(regs->psw).eaba == PSW_BITS_AMODE_31BIT) 32 33 return -EINVAL; 33 34 clear_thread_flag(TIF_PER_TRAP); 34 35 auprobe->saved_per = psw_bits(regs->psw).per; ··· 367 368 bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs) 368 369 { 369 370 if ((psw_bits(regs->psw).eaba == PSW_BITS_AMODE_24BIT) || 370 - ((psw_bits(regs->psw).eaba == PSW_BITS_AMODE_31BIT) && 371 - !is_compat_task())) { 371 + (psw_bits(regs->psw).eaba == PSW_BITS_AMODE_31BIT)) { 372 372 regs->psw.addr = __rewind_psw(regs->psw, UPROBE_SWBP_INSN_SIZE); 373 373 do_report_trap(regs, SIGILL, ILL_ILLADR, NULL); 374 374 return true;
+3 -23
arch/s390/kernel/vdso.c
··· 7 7 */ 8 8 9 9 #include <linux/binfmts.h> 10 - #include <linux/compat.h> 11 10 #include <linux/elf.h> 12 11 #include <linux/errno.h> 13 12 #include <linux/init.h> ··· 23 24 #include <asm/vdso.h> 24 25 25 26 extern char vdso64_start[], vdso64_end[]; 26 - extern char vdso32_start[], vdso32_end[]; 27 27 28 28 static int vdso_mremap(const struct vm_special_mapping *sm, 29 29 struct vm_area_struct *vma) ··· 32 34 } 33 35 34 36 static struct vm_special_mapping vdso64_mapping = { 35 - .name = "[vdso]", 36 - .mremap = vdso_mremap, 37 - }; 38 - 39 - static struct vm_special_mapping vdso32_mapping = { 40 37 .name = "[vdso]", 41 38 .mremap = vdso_mremap, 42 39 }; ··· 55 62 if (mmap_write_lock_killable(mm)) 56 63 return -EINTR; 57 64 58 - if (is_compat_task()) { 59 - vdso_text_len = vdso32_end - vdso32_start; 60 - vdso_mapping = &vdso32_mapping; 61 - } else { 62 - vdso_text_len = vdso64_end - vdso64_start; 63 - vdso_mapping = &vdso64_mapping; 64 - } 65 + vdso_text_len = vdso64_end - vdso64_start; 66 + vdso_mapping = &vdso64_mapping; 65 67 vvar_start = get_unmapped_area(NULL, addr, vdso_mapping_len, 0, 0); 66 68 rc = vvar_start; 67 69 if (IS_ERR_VALUE(vvar_start)) ··· 110 122 111 123 unsigned long vdso_text_size(void) 112 124 { 113 - unsigned long size; 114 - 115 - if (is_compat_task()) 116 - size = vdso32_end - vdso32_start; 117 - else 118 - size = vdso64_end - vdso64_start; 119 - return PAGE_ALIGN(size); 125 + return PAGE_ALIGN(vdso64_end - vdso64_start); 120 126 } 121 127 122 128 unsigned long vdso_size(void) ··· 162 180 { 163 181 vdso_apply_alternatives(); 164 182 vdso64_mapping.pages = vdso_setup_pages(vdso64_start, vdso64_end); 165 - if (IS_ENABLED(CONFIG_COMPAT)) 166 - vdso32_mapping.pages = vdso_setup_pages(vdso32_start, vdso32_end); 167 183 return 0; 168 184 } 169 185 arch_initcall(vdso_init);
-2
arch/s390/kernel/vdso32/.gitignore
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - vdso32.lds
-64
arch/s390/kernel/vdso32/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - # List of files in the vdso 3 - 4 - # Include the generic Makefile to check the built vdso. 5 - include $(srctree)/lib/vdso/Makefile.include 6 - obj-vdso32 = vdso_user_wrapper-32.o note-32.o 7 - 8 - # Build rules 9 - 10 - targets := $(obj-vdso32) vdso32.so vdso32.so.dbg 11 - obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32)) 12 - 13 - KBUILD_AFLAGS += -DBUILD_VDSO 14 - KBUILD_CFLAGS += -DBUILD_VDSO -DDISABLE_BRANCH_PROFILING 15 - 16 - KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS)) 17 - KBUILD_AFLAGS_32 += -m31 -s 18 - 19 - KBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS)) 20 - KBUILD_CFLAGS_32 := $(filter-out -mpacked-stack,$(KBUILD_CFLAGS)) 21 - KBUILD_CFLAGS_32 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_32)) 22 - KBUILD_CFLAGS_32 := $(filter-out -fno-asynchronous-unwind-tables,$(KBUILD_CFLAGS_32)) 23 - KBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin -fasynchronous-unwind-tables 24 - 25 - LDFLAGS_vdso32.so.dbg += -shared -soname=linux-vdso32.so.1 \ 26 - --hash-style=both --build-id=sha1 -melf_s390 -T 27 - 28 - $(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32) 29 - $(targets:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_32) 30 - 31 - obj-y += vdso32_wrapper.o 32 - targets += vdso32.lds 33 - CPPFLAGS_vdso32.lds += -P -C -U$(ARCH) 34 - 35 - # Force dependency (incbin is bad) 36 - $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so 37 - 38 - quiet_cmd_vdso_and_check = VDSO $@ 39 - cmd_vdso_and_check = $(cmd_ld); $(cmd_vdso_check) 40 - 41 - $(obj)/vdso32.so.dbg: $(obj)/vdso32.lds $(obj-vdso32) FORCE 42 - $(call if_changed,vdso_and_check) 43 - 44 - # strip rule for the .so file 45 - $(obj)/%.so: OBJCOPYFLAGS := -S 46 - $(obj)/%.so: $(obj)/%.so.dbg FORCE 47 - $(call if_changed,objcopy) 48 - 49 - $(obj-vdso32): %-32.o: %.S FORCE 50 - $(call if_changed_dep,vdso32as) 51 - 52 - # actual build commands 53 - quiet_cmd_vdso32as = VDSO32A $@ 54 - cmd_vdso32as = $(CC) $(a_flags) -c -o $@ $< 55 - quiet_cmd_vdso32cc = VDSO32C $@ 56 - cmd_vdso32cc = $(CC) $(c_flags) -c -o $@ $< 57 - 58 - # Generate VDSO offsets using helper script 59 - gen-vdsosym := $(src)/gen_vdso_offsets.sh 60 - quiet_cmd_vdsosym = VDSOSYM $@ 61 - cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ 62 - 63 - include/generated/vdso32-offsets.h: $(obj)/vdso32.so.dbg FORCE 64 - $(call if_changed,vdsosym)
-15
arch/s390/kernel/vdso32/gen_vdso_offsets.sh
··· 1 - #!/bin/sh 2 - # SPDX-License-Identifier: GPL-2.0 3 - 4 - # 5 - # Match symbols in the DSO that look like VDSO_*; produce a header file 6 - # of constant offsets into the shared object. 7 - # 8 - # Doing this inside the Makefile will break the $(filter-out) function, 9 - # causing Kbuild to rebuild the vdso-offsets header file every time. 10 - # 11 - # Inspired by arm64 version. 12 - # 13 - 14 - LC_ALL=C 15 - sed -n 's/\([0-9a-f]*\) . __kernel_compat_\(.*\)/\#define vdso32_offset_\2\t0x\1/p'
-13
arch/s390/kernel/vdso32/note.S
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * This supplies .note.* sections to go into the PT_NOTE inside the vDSO text. 4 - * Here we can supply some information useful to userland. 5 - */ 6 - 7 - #include <linux/uts.h> 8 - #include <linux/version.h> 9 - #include <linux/elfnote.h> 10 - 11 - ELFNOTE_START(Linux, 0, "a") 12 - .long LINUX_VERSION_CODE 13 - ELFNOTE_END
-140
arch/s390/kernel/vdso32/vdso32.lds.S
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * This is the infamous ld script for the 64 bits vdso 4 - * library 5 - */ 6 - 7 - #include <asm/page.h> 8 - #include <asm/vdso.h> 9 - #include <vdso/datapage.h> 10 - 11 - OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390") 12 - OUTPUT_ARCH(s390:31-bit) 13 - 14 - SECTIONS 15 - { 16 - VDSO_VVAR_SYMS 17 - 18 - . = SIZEOF_HEADERS; 19 - 20 - .hash : { *(.hash) } :text 21 - .gnu.hash : { *(.gnu.hash) } 22 - .dynsym : { *(.dynsym) } 23 - .dynstr : { *(.dynstr) } 24 - .gnu.version : { *(.gnu.version) } 25 - .gnu.version_d : { *(.gnu.version_d) } 26 - .gnu.version_r : { *(.gnu.version_r) } 27 - 28 - .note : { *(.note.*) } :text :note 29 - 30 - . = ALIGN(16); 31 - .text : { 32 - *(.text .stub .text.* .gnu.linkonce.t.*) 33 - } :text 34 - PROVIDE(__etext = .); 35 - PROVIDE(_etext = .); 36 - PROVIDE(etext = .); 37 - 38 - /* 39 - * Other stuff is appended to the text segment: 40 - */ 41 - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 42 - .rodata1 : { *(.rodata1) } 43 - 44 - .dynamic : { *(.dynamic) } :text :dynamic 45 - 46 - .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr 47 - .eh_frame : { KEEP (*(.eh_frame)) } :text 48 - .gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) } 49 - 50 - .rela.dyn ALIGN(8) : { *(.rela.dyn) } 51 - .got ALIGN(8) : { *(.got .toc) } 52 - .got.plt ALIGN(8) : { *(.got.plt) } 53 - 54 - _end = .; 55 - PROVIDE(end = .); 56 - 57 - /* 58 - * Stabs debugging sections are here too. 59 - */ 60 - .stab 0 : { *(.stab) } 61 - .stabstr 0 : { *(.stabstr) } 62 - .stab.excl 0 : { *(.stab.excl) } 63 - .stab.exclstr 0 : { *(.stab.exclstr) } 64 - .stab.index 0 : { *(.stab.index) } 65 - .stab.indexstr 0 : { *(.stab.indexstr) } 66 - .comment 0 : { *(.comment) } 67 - 68 - /* 69 - * DWARF debug sections. 70 - * Symbols in the DWARF debugging sections are relative to the 71 - * beginning of the section so we begin them at 0. 72 - */ 73 - /* DWARF 1 */ 74 - .debug 0 : { *(.debug) } 75 - .line 0 : { *(.line) } 76 - /* GNU DWARF 1 extensions */ 77 - .debug_srcinfo 0 : { *(.debug_srcinfo) } 78 - .debug_sfnames 0 : { *(.debug_sfnames) } 79 - /* DWARF 1.1 and DWARF 2 */ 80 - .debug_aranges 0 : { *(.debug_aranges) } 81 - .debug_pubnames 0 : { *(.debug_pubnames) } 82 - /* DWARF 2 */ 83 - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 84 - .debug_abbrev 0 : { *(.debug_abbrev) } 85 - .debug_line 0 : { *(.debug_line) } 86 - .debug_frame 0 : { *(.debug_frame) } 87 - .debug_str 0 : { *(.debug_str) } 88 - .debug_loc 0 : { *(.debug_loc) } 89 - .debug_macinfo 0 : { *(.debug_macinfo) } 90 - /* SGI/MIPS DWARF 2 extensions */ 91 - .debug_weaknames 0 : { *(.debug_weaknames) } 92 - .debug_funcnames 0 : { *(.debug_funcnames) } 93 - .debug_typenames 0 : { *(.debug_typenames) } 94 - .debug_varnames 0 : { *(.debug_varnames) } 95 - /* DWARF 3 */ 96 - .debug_pubtypes 0 : { *(.debug_pubtypes) } 97 - .debug_ranges 0 : { *(.debug_ranges) } 98 - .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } 99 - 100 - /DISCARD/ : { 101 - *(.note.GNU-stack) 102 - *(.branch_lt) 103 - *(.data .data.* .gnu.linkonce.d.* .sdata*) 104 - *(.bss .sbss .dynbss .dynsbss) 105 - } 106 - } 107 - 108 - /* 109 - * Very old versions of ld do not recognize this name token; use the constant. 110 - */ 111 - #define PT_GNU_EH_FRAME 0x6474e550 112 - 113 - /* 114 - * We must supply the ELF program headers explicitly to get just one 115 - * PT_LOAD segment, and set the flags explicitly to make segments read-only. 116 - */ 117 - PHDRS 118 - { 119 - text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */ 120 - dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ 121 - note PT_NOTE FLAGS(4); /* PF_R */ 122 - eh_frame_hdr PT_GNU_EH_FRAME; 123 - } 124 - 125 - /* 126 - * This controls what symbols we export from the DSO. 127 - */ 128 - VERSION 129 - { 130 - VDSO_VERSION_STRING { 131 - global: 132 - /* 133 - * Has to be there for the kernel to find 134 - */ 135 - __kernel_compat_restart_syscall; 136 - __kernel_compat_rt_sigreturn; 137 - __kernel_compat_sigreturn; 138 - local: *; 139 - }; 140 - }
-15
arch/s390/kernel/vdso32/vdso32_wrapper.S
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <linux/init.h> 3 - #include <linux/linkage.h> 4 - #include <asm/page.h> 5 - 6 - __PAGE_ALIGNED_DATA 7 - 8 - .globl vdso32_start, vdso32_end 9 - .balign PAGE_SIZE 10 - vdso32_start: 11 - .incbin "arch/s390/kernel/vdso32/vdso32.so" 12 - .balign PAGE_SIZE 13 - vdso32_end: 14 - 15 - .previous
-22
arch/s390/kernel/vdso32/vdso_user_wrapper.S
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - 3 - #include <linux/linkage.h> 4 - #include <asm/unistd.h> 5 - #include <asm/dwarf.h> 6 - 7 - .macro vdso_syscall func,syscall 8 - .globl __kernel_compat_\func 9 - .type __kernel_compat_\func,@function 10 - __ALIGN 11 - __kernel_compat_\func: 12 - CFI_STARTPROC 13 - svc \syscall 14 - /* Make sure we notice when a syscall returns, which shouldn't happen */ 15 - .word 0 16 - CFI_ENDPROC 17 - .size __kernel_compat_\func,.-__kernel_compat_\func 18 - .endm 19 - 20 - vdso_syscall restart_syscall,__NR_restart_syscall 21 - vdso_syscall sigreturn,__NR_sigreturn 22 - vdso_syscall rt_sigreturn,__NR_rt_sigreturn
-1
arch/s390/mm/fault.c
··· 23 23 #include <linux/ptrace.h> 24 24 #include <linux/mman.h> 25 25 #include <linux/mm.h> 26 - #include <linux/compat.h> 27 26 #include <linux/smp.h> 28 27 #include <linux/kdebug.h> 29 28 #include <linux/init.h>
-1
arch/s390/mm/mmap.c
··· 15 15 #include <linux/sched/signal.h> 16 16 #include <linux/sched/mm.h> 17 17 #include <linux/random.h> 18 - #include <linux/compat.h> 19 18 #include <linux/security.h> 20 19 #include <linux/hugetlb.h> 21 20 #include <asm/elf.h>
+1 -3
arch/s390/pci/pci_clp.c
··· 9 9 #define KMSG_COMPONENT "zpci" 10 10 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 11 11 12 - #include <linux/compat.h> 13 12 #include <linux/kernel.h> 14 13 #include <linux/miscdevice.h> 15 14 #include <linux/slab.h> ··· 650 651 if (cmd != CLP_SYNC) 651 652 return -EINVAL; 652 653 653 - argp = is_compat_task() ? compat_ptr(arg) : (void __user *) arg; 654 + argp = (void __user *)arg; 654 655 if (copy_from_user(&req, argp, sizeof(req))) 655 656 return -EFAULT; 656 657 if (req.r != 0) ··· 668 669 .open = nonseekable_open, 669 670 .release = clp_misc_release, 670 671 .unlocked_ioctl = clp_misc_ioctl, 671 - .compat_ioctl = clp_misc_ioctl, 672 672 }; 673 673 674 674 static struct miscdevice clp_misc_device = {
-1
drivers/s390/block/dasd.c
··· 3350 3350 .open = dasd_open, 3351 3351 .release = dasd_release, 3352 3352 .ioctl = dasd_ioctl, 3353 - .compat_ioctl = dasd_ioctl, 3354 3353 .getgeo = dasd_getgeo, 3355 3354 .set_read_only = dasd_set_read_only, 3356 3355 };
-11
drivers/s390/block/dasd_eckd.c
··· 16 16 #include <linux/hdreg.h> /* HDIO_GETGEO */ 17 17 #include <linux/bio.h> 18 18 #include <linux/module.h> 19 - #include <linux/compat.h> 20 19 #include <linux/init.h> 21 20 #include <linux/seq_file.h> 22 21 #include <linux/uaccess.h> ··· 5388 5389 rc = -EFAULT; 5389 5390 if (copy_from_user(&usrparm, argp, sizeof(usrparm))) 5390 5391 goto out; 5391 - if (is_compat_task()) { 5392 - /* Make sure pointers are sane even on 31 bit. */ 5393 - rc = -EINVAL; 5394 - if ((usrparm.psf_data >> 32) != 0) 5395 - goto out; 5396 - if ((usrparm.rssd_result >> 32) != 0) 5397 - goto out; 5398 - usrparm.psf_data &= 0x7fffffffULL; 5399 - usrparm.rssd_result &= 0x7fffffffULL; 5400 - } 5401 5392 /* at least 2 bytes are accessed and should be allocated */ 5402 5393 if (usrparm.psf_data_len < 2) { 5403 5394 DBF_DEV_EVENT(DBF_WARNING, device,
+1 -5
drivers/s390/block/dasd_ioctl.c
··· 11 11 */ 12 12 13 13 #include <linux/interrupt.h> 14 - #include <linux/compat.h> 15 14 #include <linux/export.h> 16 15 #include <linux/major.h> 17 16 #include <linux/fs.h> ··· 615 616 void __user *argp; 616 617 int rc; 617 618 618 - if (is_compat_task()) 619 - argp = compat_ptr(arg); 620 - else 621 - argp = (void __user *)arg; 619 + argp = (void __user *)arg; 622 620 623 621 if ((_IOC_DIR(cmd) != _IOC_NONE) && !arg) 624 622 return -EINVAL;
-19
drivers/s390/char/con3270.c
··· 21 21 #include <linux/reboot.h> 22 22 #include <linux/slab.h> 23 23 #include <linux/memblock.h> 24 - #include <linux/compat.h> 25 24 26 25 #include <asm/machine.h> 27 26 #include <asm/ccwdev.h> ··· 1946 1947 return kbd_ioctl(tp->kbd, cmd, arg); 1947 1948 } 1948 1949 1949 - #ifdef CONFIG_COMPAT 1950 - static long tty3270_compat_ioctl(struct tty_struct *tty, 1951 - unsigned int cmd, unsigned long arg) 1952 - { 1953 - struct tty3270 *tp; 1954 - 1955 - tp = tty->driver_data; 1956 - if (!tp) 1957 - return -ENODEV; 1958 - if (tty_io_error(tty)) 1959 - return -EIO; 1960 - return kbd_ioctl(tp->kbd, cmd, (unsigned long)compat_ptr(arg)); 1961 - } 1962 - #endif 1963 - 1964 1950 static const struct tty_operations tty3270_ops = { 1965 1951 .install = tty3270_install, 1966 1952 .cleanup = tty3270_cleanup, ··· 1960 1976 .hangup = tty3270_hangup, 1961 1977 .wait_until_sent = tty3270_wait_until_sent, 1962 1978 .ioctl = tty3270_ioctl, 1963 - #ifdef CONFIG_COMPAT 1964 - .compat_ioctl = tty3270_compat_ioctl, 1965 - #endif 1966 1979 .set_termios = tty3270_set_termios 1967 1980 }; 1968 1981
+1 -6
drivers/s390/char/fs3270.c
··· 12 12 #include <linux/console.h> 13 13 #include <linux/init.h> 14 14 #include <linux/interrupt.h> 15 - #include <linux/compat.h> 16 15 #include <linux/sched/signal.h> 17 16 #include <linux/module.h> 18 17 #include <linux/list.h> ··· 329 330 fp = filp->private_data; 330 331 if (!fp) 331 332 return -ENODEV; 332 - if (is_compat_task()) 333 - argp = compat_ptr(arg); 334 - else 335 - argp = (char __user *)arg; 333 + argp = (char __user *)arg; 336 334 rc = 0; 337 335 mutex_lock(&fs3270_mutex); 338 336 switch (cmd) { ··· 508 512 .read = fs3270_read, /* read */ 509 513 .write = fs3270_write, /* write */ 510 514 .unlocked_ioctl = fs3270_ioctl, /* ioctl */ 511 - .compat_ioctl = fs3270_ioctl, /* ioctl */ 512 515 .open = fs3270_open, /* open */ 513 516 .release = fs3270_close, /* release */ 514 517 };
+2 -10
drivers/s390/char/sclp_ctl.c
··· 7 7 * Author: Michael Holzheu <holzheu@linux.vnet.ibm.com> 8 8 */ 9 9 10 - #include <linux/compat.h> 11 10 #include <linux/uaccess.h> 12 11 #include <linux/miscdevice.h> 13 12 #include <linux/gfp.h> ··· 42 43 43 44 static void __user *u64_to_uptr(u64 value) 44 45 { 45 - if (is_compat_task()) 46 - return compat_ptr(value); 47 - else 48 - return (void __user *)(unsigned long)value; 46 + return (void __user *)(unsigned long)value; 49 47 } 50 48 51 49 /* ··· 91 95 { 92 96 void __user *argp; 93 97 94 - if (is_compat_task()) 95 - argp = compat_ptr(arg); 96 - else 97 - argp = (void __user *) arg; 98 + argp = (void __user *)arg; 98 99 switch (cmd) { 99 100 case SCLP_CTL_SCCB: 100 101 return sclp_ctl_ioctl_sccb(argp); ··· 107 114 .owner = THIS_MODULE, 108 115 .open = nonseekable_open, 109 116 .unlocked_ioctl = sclp_ctl_ioctl, 110 - .compat_ioctl = sclp_ctl_ioctl, 111 117 }; 112 118 113 119 /*
-26
drivers/s390/char/tape_char.c
··· 17 17 #include <linux/types.h> 18 18 #include <linux/proc_fs.h> 19 19 #include <linux/mtio.h> 20 - #include <linux/compat.h> 21 20 22 21 #include <linux/uaccess.h> 23 22 ··· 36 37 static int tapechar_open(struct inode *,struct file *); 37 38 static int tapechar_release(struct inode *,struct file *); 38 39 static long tapechar_ioctl(struct file *, unsigned int, unsigned long); 39 - #ifdef CONFIG_COMPAT 40 - static long tapechar_compat_ioctl(struct file *, unsigned int, unsigned long); 41 - #endif 42 40 43 41 static const struct file_operations tape_fops = 44 42 { ··· 43 47 .read = tapechar_read, 44 48 .write = tapechar_write, 45 49 .unlocked_ioctl = tapechar_ioctl, 46 - #ifdef CONFIG_COMPAT 47 - .compat_ioctl = tapechar_compat_ioctl, 48 - #endif 49 50 .open = tapechar_open, 50 51 .release = tapechar_release, 51 52 }; ··· 433 440 mutex_unlock(&device->mutex); 434 441 return rc; 435 442 } 436 - 437 - #ifdef CONFIG_COMPAT 438 - static long 439 - tapechar_compat_ioctl(struct file *filp, unsigned int no, unsigned long data) 440 - { 441 - struct tape_device *device = filp->private_data; 442 - long rc; 443 - 444 - if (no == MTIOCPOS32) 445 - no = MTIOCPOS; 446 - else if (no == MTIOCGET32) 447 - no = MTIOCGET; 448 - 449 - mutex_lock(&device->mutex); 450 - rc = __tapechar_ioctl(device, no, compat_ptr(data)); 451 - mutex_unlock(&device->mutex); 452 - return rc; 453 - } 454 - #endif /* CONFIG_COMPAT */ 455 443 456 444 /* 457 445 * Initialize character device frontend.
+1 -6
drivers/s390/char/vmcp.c
··· 14 14 15 15 #include <linux/fs.h> 16 16 #include <linux/init.h> 17 - #include <linux/compat.h> 18 17 #include <linux/kernel.h> 19 18 #include <linux/miscdevice.h> 20 19 #include <linux/slab.h> ··· 203 204 int __user *argp; 204 205 205 206 session = file->private_data; 206 - if (is_compat_task()) 207 - argp = compat_ptr(arg); 208 - else 209 - argp = (int __user *)arg; 207 + argp = (int __user *)arg; 210 208 if (mutex_lock_interruptible(&session->mutex)) 211 209 return -ERESTARTSYS; 212 210 switch (cmd) { ··· 237 241 .read = vmcp_read, 238 242 .write = vmcp_write, 239 243 .unlocked_ioctl = vmcp_ioctl, 240 - .compat_ioctl = vmcp_ioctl, 241 244 }; 242 245 243 246 static struct miscdevice vmcp_dev = {
+1 -6
drivers/s390/cio/chsc_sch.c
··· 9 9 */ 10 10 11 11 #include <linux/slab.h> 12 - #include <linux/compat.h> 13 12 #include <linux/device.h> 14 13 #include <linux/io.h> 15 14 #include <linux/module.h> ··· 844 845 void __user *argp; 845 846 846 847 CHSC_MSG(2, "chsc_ioctl called, cmd=%x\n", cmd); 847 - if (is_compat_task()) 848 - argp = compat_ptr(arg); 849 - else 850 - argp = (void __user *)arg; 848 + argp = (void __user *)arg; 851 849 switch (cmd) { 852 850 case CHSC_START: 853 851 return chsc_ioctl_start(argp); ··· 919 923 .open = chsc_open, 920 924 .release = chsc_release, 921 925 .unlocked_ioctl = chsc_ioctl, 922 - .compat_ioctl = chsc_ioctl, 923 926 }; 924 927 925 928 static struct miscdevice chsc_misc_device = {
-195
drivers/s390/crypto/zcrypt_api.c
··· 21 21 #include <linux/interrupt.h> 22 22 #include <linux/miscdevice.h> 23 23 #include <linux/fs.h> 24 - #include <linux/compat.h> 25 24 #include <linux/slab.h> 26 25 #include <linux/atomic.h> 27 26 #include <linux/uaccess.h> ··· 1733 1734 } 1734 1735 } 1735 1736 1736 - #ifdef CONFIG_COMPAT 1737 - /* 1738 - * ioctl32 conversion routines 1739 - */ 1740 - struct compat_ica_rsa_modexpo { 1741 - compat_uptr_t inputdata; 1742 - unsigned int inputdatalength; 1743 - compat_uptr_t outputdata; 1744 - unsigned int outputdatalength; 1745 - compat_uptr_t b_key; 1746 - compat_uptr_t n_modulus; 1747 - }; 1748 - 1749 - static long trans_modexpo32(struct ap_perms *perms, struct file *filp, 1750 - unsigned int cmd, unsigned long arg) 1751 - { 1752 - struct compat_ica_rsa_modexpo __user *umex32 = compat_ptr(arg); 1753 - struct compat_ica_rsa_modexpo mex32; 1754 - struct ica_rsa_modexpo mex64; 1755 - struct zcrypt_track tr; 1756 - long rc; 1757 - 1758 - memset(&tr, 0, sizeof(tr)); 1759 - if (copy_from_user(&mex32, umex32, sizeof(mex32))) 1760 - return -EFAULT; 1761 - mex64.inputdata = compat_ptr(mex32.inputdata); 1762 - mex64.inputdatalength = mex32.inputdatalength; 1763 - mex64.outputdata = compat_ptr(mex32.outputdata); 1764 - mex64.outputdatalength = mex32.outputdatalength; 1765 - mex64.b_key = compat_ptr(mex32.b_key); 1766 - mex64.n_modulus = compat_ptr(mex32.n_modulus); 1767 - do { 1768 - rc = zcrypt_rsa_modexpo(perms, &tr, &mex64); 1769 - } while (rc == -EAGAIN && ++tr.again_counter < TRACK_AGAIN_MAX); 1770 - 1771 - /* on ENODEV failure: retry once again after a requested rescan */ 1772 - if (rc == -ENODEV && zcrypt_process_rescan()) 1773 - do { 1774 - rc = zcrypt_rsa_modexpo(perms, &tr, &mex64); 1775 - } while (rc == -EAGAIN && ++tr.again_counter < TRACK_AGAIN_MAX); 1776 - if (rc == -EAGAIN && tr.again_counter >= TRACK_AGAIN_MAX) 1777 - rc = -EIO; 1778 - if (rc) 1779 - return rc; 1780 - return put_user(mex64.outputdatalength, 1781 - &umex32->outputdatalength); 1782 - } 1783 - 1784 - struct compat_ica_rsa_modexpo_crt { 1785 - compat_uptr_t inputdata; 1786 - unsigned int inputdatalength; 1787 - compat_uptr_t outputdata; 1788 - unsigned int outputdatalength; 1789 - compat_uptr_t bp_key; 1790 - compat_uptr_t bq_key; 1791 - compat_uptr_t np_prime; 1792 - compat_uptr_t nq_prime; 1793 - compat_uptr_t u_mult_inv; 1794 - }; 1795 - 1796 - static long trans_modexpo_crt32(struct ap_perms *perms, struct file *filp, 1797 - unsigned int cmd, unsigned long arg) 1798 - { 1799 - struct compat_ica_rsa_modexpo_crt __user *ucrt32 = compat_ptr(arg); 1800 - struct compat_ica_rsa_modexpo_crt crt32; 1801 - struct ica_rsa_modexpo_crt crt64; 1802 - struct zcrypt_track tr; 1803 - long rc; 1804 - 1805 - memset(&tr, 0, sizeof(tr)); 1806 - if (copy_from_user(&crt32, ucrt32, sizeof(crt32))) 1807 - return -EFAULT; 1808 - crt64.inputdata = compat_ptr(crt32.inputdata); 1809 - crt64.inputdatalength = crt32.inputdatalength; 1810 - crt64.outputdata = compat_ptr(crt32.outputdata); 1811 - crt64.outputdatalength = crt32.outputdatalength; 1812 - crt64.bp_key = compat_ptr(crt32.bp_key); 1813 - crt64.bq_key = compat_ptr(crt32.bq_key); 1814 - crt64.np_prime = compat_ptr(crt32.np_prime); 1815 - crt64.nq_prime = compat_ptr(crt32.nq_prime); 1816 - crt64.u_mult_inv = compat_ptr(crt32.u_mult_inv); 1817 - do { 1818 - rc = zcrypt_rsa_crt(perms, &tr, &crt64); 1819 - } while (rc == -EAGAIN && ++tr.again_counter < TRACK_AGAIN_MAX); 1820 - 1821 - /* on ENODEV failure: retry once again after a requested rescan */ 1822 - if (rc == -ENODEV && zcrypt_process_rescan()) 1823 - do { 1824 - rc = zcrypt_rsa_crt(perms, &tr, &crt64); 1825 - } while (rc == -EAGAIN && ++tr.again_counter < TRACK_AGAIN_MAX); 1826 - if (rc == -EAGAIN && tr.again_counter >= TRACK_AGAIN_MAX) 1827 - rc = -EIO; 1828 - if (rc) 1829 - return rc; 1830 - return put_user(crt64.outputdatalength, 1831 - &ucrt32->outputdatalength); 1832 - } 1833 - 1834 - struct compat_ica_xcrb { 1835 - unsigned short agent_ID; 1836 - unsigned int user_defined; 1837 - unsigned short request_ID; 1838 - unsigned int request_control_blk_length; 1839 - unsigned char padding1[16 - sizeof(compat_uptr_t)]; 1840 - compat_uptr_t request_control_blk_addr; 1841 - unsigned int request_data_length; 1842 - char padding2[16 - sizeof(compat_uptr_t)]; 1843 - compat_uptr_t request_data_address; 1844 - unsigned int reply_control_blk_length; 1845 - char padding3[16 - sizeof(compat_uptr_t)]; 1846 - compat_uptr_t reply_control_blk_addr; 1847 - unsigned int reply_data_length; 1848 - char padding4[16 - sizeof(compat_uptr_t)]; 1849 - compat_uptr_t reply_data_addr; 1850 - unsigned short priority_window; 1851 - unsigned int status; 1852 - } __packed; 1853 - 1854 - static long trans_xcrb32(struct ap_perms *perms, struct file *filp, 1855 - unsigned int cmd, unsigned long arg) 1856 - { 1857 - struct compat_ica_xcrb __user *uxcrb32 = compat_ptr(arg); 1858 - u32 xflags = ZCRYPT_XFLAG_USERSPACE; 1859 - struct compat_ica_xcrb xcrb32; 1860 - struct zcrypt_track tr; 1861 - struct ica_xcRB xcrb64; 1862 - long rc; 1863 - 1864 - memset(&tr, 0, sizeof(tr)); 1865 - if (copy_from_user(&xcrb32, uxcrb32, sizeof(xcrb32))) 1866 - return -EFAULT; 1867 - xcrb64.agent_ID = xcrb32.agent_ID; 1868 - xcrb64.user_defined = xcrb32.user_defined; 1869 - xcrb64.request_ID = xcrb32.request_ID; 1870 - xcrb64.request_control_blk_length = 1871 - xcrb32.request_control_blk_length; 1872 - xcrb64.request_control_blk_addr = 1873 - compat_ptr(xcrb32.request_control_blk_addr); 1874 - xcrb64.request_data_length = 1875 - xcrb32.request_data_length; 1876 - xcrb64.request_data_address = 1877 - compat_ptr(xcrb32.request_data_address); 1878 - xcrb64.reply_control_blk_length = 1879 - xcrb32.reply_control_blk_length; 1880 - xcrb64.reply_control_blk_addr = 1881 - compat_ptr(xcrb32.reply_control_blk_addr); 1882 - xcrb64.reply_data_length = xcrb32.reply_data_length; 1883 - xcrb64.reply_data_addr = 1884 - compat_ptr(xcrb32.reply_data_addr); 1885 - xcrb64.priority_window = xcrb32.priority_window; 1886 - xcrb64.status = xcrb32.status; 1887 - do { 1888 - rc = _zcrypt_send_cprb(xflags, perms, &tr, &xcrb64); 1889 - } while (rc == -EAGAIN && ++tr.again_counter < TRACK_AGAIN_MAX); 1890 - 1891 - /* on ENODEV failure: retry once again after a requested rescan */ 1892 - if (rc == -ENODEV && zcrypt_process_rescan()) 1893 - do { 1894 - rc = _zcrypt_send_cprb(xflags, perms, &tr, &xcrb64); 1895 - } while (rc == -EAGAIN && ++tr.again_counter < TRACK_AGAIN_MAX); 1896 - if (rc == -EAGAIN && tr.again_counter >= TRACK_AGAIN_MAX) 1897 - rc = -EIO; 1898 - xcrb32.reply_control_blk_length = xcrb64.reply_control_blk_length; 1899 - xcrb32.reply_data_length = xcrb64.reply_data_length; 1900 - xcrb32.status = xcrb64.status; 1901 - if (copy_to_user(uxcrb32, &xcrb32, sizeof(xcrb32))) 1902 - return -EFAULT; 1903 - return rc; 1904 - } 1905 - 1906 - static long zcrypt_compat_ioctl(struct file *filp, unsigned int cmd, 1907 - unsigned long arg) 1908 - { 1909 - int rc; 1910 - struct ap_perms *perms = 1911 - (struct ap_perms *)filp->private_data; 1912 - 1913 - rc = zcrypt_check_ioctl(perms, cmd); 1914 - if (rc) 1915 - return rc; 1916 - 1917 - if (cmd == ICARSAMODEXPO) 1918 - return trans_modexpo32(perms, filp, cmd, arg); 1919 - if (cmd == ICARSACRT) 1920 - return trans_modexpo_crt32(perms, filp, cmd, arg); 1921 - if (cmd == ZSECSENDCPRB) 1922 - return trans_xcrb32(perms, filp, cmd, arg); 1923 - return zcrypt_unlocked_ioctl(filp, cmd, arg); 1924 - } 1925 - #endif 1926 - 1927 1737 /* 1928 1738 * Misc device file operations. 1929 1739 */ ··· 1741 1933 .read = zcrypt_read, 1742 1934 .write = zcrypt_write, 1743 1935 .unlocked_ioctl = zcrypt_unlocked_ioctl, 1744 - #ifdef CONFIG_COMPAT 1745 - .compat_ioctl = zcrypt_compat_ioctl, 1746 - #endif 1747 1936 .open = zcrypt_open, 1748 1937 .release = zcrypt_release, 1749 1938 };
-1
drivers/s390/crypto/zcrypt_card.c
··· 19 19 #include <linux/fs.h> 20 20 #include <linux/proc_fs.h> 21 21 #include <linux/seq_file.h> 22 - #include <linux/compat.h> 23 22 #include <linux/slab.h> 24 23 #include <linux/atomic.h> 25 24 #include <linux/uaccess.h>
-1
drivers/s390/crypto/zcrypt_queue.c
··· 19 19 #include <linux/fs.h> 20 20 #include <linux/proc_fs.h> 21 21 #include <linux/seq_file.h> 22 - #include <linux/compat.h> 23 22 #include <linux/slab.h> 24 23 #include <linux/atomic.h> 25 24 #include <linux/uaccess.h>
+1 -3
drivers/s390/net/qeth_core_main.c
··· 10 10 #define KMSG_COMPONENT "qeth" 11 11 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 12 12 13 - #include <linux/compat.h> 14 13 #include <linux/export.h> 15 14 #include <linux/module.h> 16 15 #include <linux/moduleparam.h> ··· 4804 4805 4805 4806 rc = qeth_send_ipa_cmd(card, iob, qeth_setadpparms_query_oat_cb, &priv); 4806 4807 if (!rc) { 4807 - tmp = is_compat_task() ? compat_ptr(oat_data.ptr) : 4808 - u64_to_user_ptr(oat_data.ptr); 4808 + tmp = u64_to_user_ptr(oat_data.ptr); 4809 4809 oat_data.response_len = priv.response_len; 4810 4810 4811 4811 if (copy_to_user(tmp, priv.buffer, priv.response_len) ||