Merge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6

* 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6:
[S390] tape_char: add missing compat_ptr conversion
[S390] zcrypt: add sanity check before copy_from_user()
[S390] unwire sys_recvmmsg again
[S390] con3215: remove empty ioctl function
[S390] dasd: add proper compat pointer conversion for symmetrix ioctl
[S390] mmap: add missing compat_ptr conversion to both mmap compat syscalls
[S390] bug: implement arch specific __WARN macro
[S390] Move __cpu_logical_map to smp.c
[S390] tape_block: remove ioctl function
[S390] smp: remove volatile type quilifier from __cpu_logical_map
[S390] smp: setup smp_processor_id early
[S390] use helpers for rlimits
[S390] fs3270: add missing compat ptr conversion
[S390] vmcp: add missing compat ptr conversion
[S390] cio: add missing compat ptr conversion
[S390] dasd: add missing compat ptr conversion
[S390] remove superfluous TIF_USEDFPU bit
[S390] duplicate SIGTRAP on signal delivery.
[S390] clear TIF_SINGLE_STEP for new process.
[S390] fix loading of PER control registers for utrace.

+137 -160
+4
arch/s390/include/asm/bug.h
··· 52 unreachable(); \ 53 } while (0) 54 55 #define WARN_ON(x) ({ \ 56 int __ret_warn_on = !!(x); \ 57 if (__builtin_constant_p(__ret_warn_on)) { \
··· 52 unreachable(); \ 53 } while (0) 54 55 + #define __WARN() do { \ 56 + __EMIT_BUG(BUGFLAG_WARNING); \ 57 + } while (0) 58 + 59 #define WARN_ON(x) ({ \ 60 int __ret_warn_on = !!(x); \ 61 if (__builtin_constant_p(__ret_warn_on)) { \
+14 -6
arch/s390/include/asm/sigp.h
··· 15 #ifndef __SIGP__ 16 #define __SIGP__ 17 18 - #include <asm/ptrace.h> 19 - #include <asm/atomic.h> 20 21 /* get real cpu address from logical cpu number */ 22 - extern volatile int __cpu_logical_map[]; 23 24 typedef enum 25 { ··· 87 " ipm %0\n" 88 " srl %0,28\n" 89 : "=d" (ccode) 90 - : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]), 91 "a" (order_code) : "cc" , "memory"); 92 return ccode; 93 } ··· 106 " ipm %0\n" 107 " srl %0,28\n" 108 : "=d" (ccode) 109 - : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]), 110 "a" (order_code) : "cc" , "memory"); 111 return ccode; 112 } ··· 126 " ipm %0\n" 127 " srl %0,28\n" 128 : "=d" (ccode), "+d" (reg1) 129 - : "d" (__cpu_logical_map[cpu_addr]), "a" (order_code) 130 : "cc" , "memory"); 131 *statusptr = reg1; 132 return ccode;
··· 15 #ifndef __SIGP__ 16 #define __SIGP__ 17 18 + #include <asm/system.h> 19 20 /* get real cpu address from logical cpu number */ 21 + extern int __cpu_logical_map[]; 22 + 23 + static inline int cpu_logical_map(int cpu) 24 + { 25 + #ifdef CONFIG_SMP 26 + return __cpu_logical_map[cpu]; 27 + #else 28 + return stap(); 29 + #endif 30 + } 31 32 typedef enum 33 { ··· 79 " ipm %0\n" 80 " srl %0,28\n" 81 : "=d" (ccode) 82 + : "d" (reg1), "d" (cpu_logical_map(cpu_addr)), 83 "a" (order_code) : "cc" , "memory"); 84 return ccode; 85 } ··· 98 " ipm %0\n" 99 " srl %0,28\n" 100 : "=d" (ccode) 101 + : "d" (reg1), "d" (cpu_logical_map(cpu_addr)), 102 "a" (order_code) : "cc" , "memory"); 103 return ccode; 104 } ··· 118 " ipm %0\n" 119 " srl %0,28\n" 120 : "=d" (ccode), "+d" (reg1) 121 + : "d" (cpu_logical_map(cpu_addr)), "a" (order_code) 122 : "cc" , "memory"); 123 *statusptr = reg1; 124 return ccode;
+5 -7
arch/s390/include/asm/thread_info.h
··· 93 #define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */ 94 #define TIF_SECCOMP 10 /* secure computing */ 95 #define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */ 96 - #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 97 - #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling 98 TIF_NEED_RESCHED */ 99 - #define TIF_31BIT 18 /* 32bit process */ 100 - #define TIF_MEMDIE 19 101 - #define TIF_RESTORE_SIGMASK 20 /* restore signal mask in do_signal() */ 102 - #define TIF_FREEZE 21 /* thread is freezing for suspend */ 103 104 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 105 #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) ··· 111 #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 112 #define _TIF_SECCOMP (1<<TIF_SECCOMP) 113 #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) 114 - #define _TIF_USEDFPU (1<<TIF_USEDFPU) 115 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 116 #define _TIF_31BIT (1<<TIF_31BIT) 117 #define _TIF_FREEZE (1<<TIF_FREEZE)
··· 93 #define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */ 94 #define TIF_SECCOMP 10 /* secure computing */ 95 #define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */ 96 + #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling 97 TIF_NEED_RESCHED */ 98 + #define TIF_31BIT 17 /* 32bit process */ 99 + #define TIF_MEMDIE 18 100 + #define TIF_RESTORE_SIGMASK 19 /* restore signal mask in do_signal() */ 101 + #define TIF_FREEZE 20 /* thread is freezing for suspend */ 102 103 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 104 #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) ··· 112 #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 113 #define _TIF_SECCOMP (1<<TIF_SECCOMP) 114 #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) 115 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 116 #define _TIF_31BIT (1<<TIF_31BIT) 117 #define _TIF_FREEZE (1<<TIF_FREEZE)
+4 -2
arch/s390/include/asm/unistd.h
··· 269 #define __NR_pwritev 329 270 #define __NR_rt_tgsigqueueinfo 330 271 #define __NR_perf_event_open 331 272 - #define __NR_recvmmsg 332 273 - #define NR_syscalls 333 274 275 /* 276 * There are some system calls that are not present on 64 bit, some ··· 375 #define __IGNORE_set_mempolicy 376 #define __IGNORE_migrate_pages 377 #define __IGNORE_move_pages 378 379 #define __ARCH_WANT_IPC_PARSE_VERSION 380 #define __ARCH_WANT_OLD_READDIR
··· 269 #define __NR_pwritev 329 270 #define __NR_rt_tgsigqueueinfo 330 271 #define __NR_perf_event_open 331 272 + #define NR_syscalls 332 273 274 /* 275 * There are some system calls that are not present on 64 bit, some ··· 376 #define __IGNORE_set_mempolicy 377 #define __IGNORE_migrate_pages 378 #define __IGNORE_move_pages 379 + 380 + /* Ignore system calls that are also reachable via sys_socket */ 381 + #define __IGNORE_recvmmsg 382 383 #define __ARCH_WANT_IPC_PARSE_VERSION 384 #define __ARCH_WANT_OLD_READDIR
+16 -25
arch/s390/kernel/compat_linux.c
··· 616 */ 617 618 struct mmap_arg_struct_emu31 { 619 - u32 addr; 620 - u32 len; 621 - u32 prot; 622 - u32 flags; 623 - u32 fd; 624 - u32 offset; 625 }; 626 627 - asmlinkage unsigned long 628 - old32_mmap(struct mmap_arg_struct_emu31 __user *arg) 629 { 630 struct mmap_arg_struct_emu31 a; 631 - int error = -EFAULT; 632 633 if (copy_from_user(&a, arg, sizeof(a))) 634 - goto out; 635 - 636 - error = -EINVAL; 637 if (a.offset & ~PAGE_MASK) 638 - goto out; 639 - 640 - error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, 641 - a.offset >> PAGE_SHIFT); 642 - out: 643 - return error; 644 } 645 646 - asmlinkage long 647 - sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg) 648 { 649 struct mmap_arg_struct_emu31 a; 650 - int error = -EFAULT; 651 652 if (copy_from_user(&a, arg, sizeof(a))) 653 - goto out; 654 - error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); 655 - out: 656 - return error; 657 } 658 659 asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count)
··· 616 */ 617 618 struct mmap_arg_struct_emu31 { 619 + compat_ulong_t addr; 620 + compat_ulong_t len; 621 + compat_ulong_t prot; 622 + compat_ulong_t flags; 623 + compat_ulong_t fd; 624 + compat_ulong_t offset; 625 }; 626 627 + asmlinkage unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg) 628 { 629 struct mmap_arg_struct_emu31 a; 630 631 if (copy_from_user(&a, arg, sizeof(a))) 632 + return -EFAULT; 633 if (a.offset & ~PAGE_MASK) 634 + return -EINVAL; 635 + a.addr = (unsigned long) compat_ptr(a.addr); 636 + return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, 637 + a.offset >> PAGE_SHIFT); 638 } 639 640 + asmlinkage long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg) 641 { 642 struct mmap_arg_struct_emu31 a; 643 644 if (copy_from_user(&a, arg, sizeof(a))) 645 + return -EFAULT; 646 + a.addr = (unsigned long) compat_ptr(a.addr); 647 + return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); 648 } 649 650 asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count)
-9
arch/s390/kernel/compat_wrapper.S
··· 1853 llgtr %r3,%r3 # compat_uptr_t * 1854 llgtr %r4,%r4 # compat_uptr_t * 1855 jg sys32_execve # branch to system call 1856 - 1857 - .globl compat_sys_recvmmsg_wrapper 1858 - compat_sys_recvmmsg_wrapper: 1859 - lgfr %r2,%r2 # int 1860 - llgtr %r3,%r3 # struct compat_mmsghdr * 1861 - llgfr %r4,%r4 # unsigned int 1862 - llgfr %r5,%r5 # unsigned int 1863 - llgtr %r6,%r6 # struct compat_timespec * 1864 - jg compat_sys_recvmmsg
··· 1853 llgtr %r3,%r3 # compat_uptr_t * 1854 llgtr %r4,%r4 # compat_uptr_t * 1855 jg sys32_execve # branch to system call
+1 -2
arch/s390/kernel/process.c
··· 153 154 void flush_thread(void) 155 { 156 - clear_used_math(); 157 - clear_tsk_thread_flag(current, TIF_USEDFPU); 158 } 159 160 void release_thread(struct task_struct *dead_task) ··· 215 p->thread.mm_segment = get_fs(); 216 /* Don't copy debug registers */ 217 memset(&p->thread.per_info, 0, sizeof(p->thread.per_info)); 218 /* Initialize per thread user and system timer values */ 219 ti = task_thread_info(p); 220 ti->user_timer = 0;
··· 153 154 void flush_thread(void) 155 { 156 } 157 158 void release_thread(struct task_struct *dead_task) ··· 217 p->thread.mm_segment = get_fs(); 218 /* Don't copy debug registers */ 219 memset(&p->thread.per_info, 0, sizeof(p->thread.per_info)); 220 + clear_tsk_thread_flag(p, TIF_SINGLE_STEP); 221 /* Initialize per thread user and system timer values */ 222 ti = task_thread_info(p); 223 ti->user_timer = 0;
+8
arch/s390/kernel/ptrace.c
··· 65 { 66 struct pt_regs *regs; 67 per_struct *per_info; 68 69 regs = task_pt_regs(task); 70 per_info = (per_struct *) &task->thread.per_info; ··· 99 per_info->control_regs.bits.storage_alt_space_ctl = 1; 100 else 101 per_info->control_regs.bits.storage_alt_space_ctl = 0; 102 } 103 104 void user_enable_single_step(struct task_struct *task)
··· 65 { 66 struct pt_regs *regs; 67 per_struct *per_info; 68 + per_cr_words cr_words; 69 70 regs = task_pt_regs(task); 71 per_info = (per_struct *) &task->thread.per_info; ··· 98 per_info->control_regs.bits.storage_alt_space_ctl = 1; 99 else 100 per_info->control_regs.bits.storage_alt_space_ctl = 0; 101 + 102 + if (task == current) { 103 + __ctl_store(cr_words, 9, 11); 104 + if (memcmp(&cr_words, &per_info->control_regs.words, 105 + sizeof(cr_words)) != 0) 106 + __ctl_load(per_info->control_regs.words, 9, 11); 107 + } 108 } 109 110 void user_enable_single_step(struct task_struct *task)
-8
arch/s390/kernel/setup.c
··· 87 char elf_platform[ELF_PLATFORM_SIZE]; 88 89 struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS]; 90 - volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */ 91 92 int __initdata memory_end_set; 93 unsigned long __initdata memory_end; ··· 122 * Store processor id in lowcore (used e.g. in timer_interrupt) 123 */ 124 get_cpu_id(&S390_lowcore.cpu_id); 125 - 126 - /* 127 - * Force FPU initialization: 128 - */ 129 - clear_thread_flag(TIF_USEDFPU); 130 - clear_used_math(); 131 132 atomic_inc(&init_mm.mm_count); 133 current->active_mm = &init_mm; ··· 848 setup_lowcore(); 849 850 cpu_init(); 851 - __cpu_logical_map[0] = stap(); 852 s390_init_cpu_topology(); 853 854 /*
··· 87 char elf_platform[ELF_PLATFORM_SIZE]; 88 89 struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS]; 90 91 int __initdata memory_end_set; 92 unsigned long __initdata memory_end; ··· 123 * Store processor id in lowcore (used e.g. in timer_interrupt) 124 */ 125 get_cpu_id(&S390_lowcore.cpu_id); 126 127 atomic_inc(&init_mm.mm_count); 128 current->active_mm = &init_mm; ··· 855 setup_lowcore(); 856 857 cpu_init(); 858 s390_init_cpu_topology(); 859 860 /*
+1 -9
arch/s390/kernel/signal.c
··· 500 clear_thread_flag(TIF_RESTORE_SIGMASK); 501 502 /* 503 - * If we would have taken a single-step trap 504 - * for a normal instruction, act like we took 505 - * one for the handler setup. 506 - */ 507 - if (current->thread.per_info.single_step) 508 - set_thread_flag(TIF_SINGLE_STEP); 509 - 510 - /* 511 * Let tracing know that we've done the handler setup. 512 */ 513 tracehook_signal_handler(signr, &info, &ka, regs, 514 - test_thread_flag(TIF_SINGLE_STEP)); 515 } 516 return; 517 }
··· 500 clear_thread_flag(TIF_RESTORE_SIGMASK); 501 502 /* 503 * Let tracing know that we've done the handler setup. 504 */ 505 tracehook_signal_handler(signr, &info, &ka, regs, 506 + current->thread.per_info.single_step); 507 } 508 return; 509 }
+9
arch/s390/kernel/smp.c
··· 52 #include <asm/cpu.h> 53 #include "entry.h" 54 55 static struct task_struct *current_set[NR_CPUS]; 56 57 static u8 smp_cpu_type; ··· 718 719 void __init smp_cpus_done(unsigned int max_cpus) 720 { 721 } 722 723 /*
··· 52 #include <asm/cpu.h> 53 #include "entry.h" 54 55 + /* logical cpu to cpu address */ 56 + int __cpu_logical_map[NR_CPUS]; 57 + 58 static struct task_struct *current_set[NR_CPUS]; 59 60 static u8 smp_cpu_type; ··· 715 716 void __init smp_cpus_done(unsigned int max_cpus) 717 { 718 + } 719 + 720 + void __init smp_setup_processor_id(void) 721 + { 722 + S390_lowcore.cpu_nr = 0; 723 + __cpu_logical_map[0] = stap(); 724 } 725 726 /*
-1
arch/s390/kernel/syscalls.S
··· 340 SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper) 341 SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo_wrapper) /* 330 */ 342 SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper) 343 - SYSCALL(sys_recvmmsg,sys_recvmmsg,compat_sys_recvmmsg_wrapper)
··· 340 SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper) 341 SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo_wrapper) /* 330 */ 342 SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper)
+1 -1
arch/s390/kernel/topology.c
··· 114 115 rcpu = CPU_BITS - 1 - cpu + tl_cpu->origin; 116 for_each_present_cpu(lcpu) { 117 - if (__cpu_logical_map[lcpu] == rcpu) { 118 cpu_set(lcpu, core->mask); 119 smp_cpu_polarization[lcpu] = tl_cpu->pp; 120 }
··· 114 115 rcpu = CPU_BITS - 1 - cpu + tl_cpu->origin; 116 for_each_present_cpu(lcpu) { 117 + if (cpu_logical_map(lcpu) == rcpu) { 118 cpu_set(lcpu, core->mask); 119 smp_cpu_polarization[lcpu] = tl_cpu->pp; 120 }
+1 -1
arch/s390/lib/spinlock.c
··· 34 { 35 if (MACHINE_HAS_DIAG9C) 36 asm volatile("diag %0,0,0x9c" 37 - : : "d" (__cpu_logical_map[cpu])); 38 else 39 _raw_yield(); 40 }
··· 34 { 35 if (MACHINE_HAS_DIAG9C) 36 asm volatile("diag %0,0,0x9c" 37 + : : "d" (cpu_logical_map(cpu))); 38 else 39 _raw_yield(); 40 }
+2 -2
arch/s390/mm/mmap.c
··· 40 41 static inline unsigned long mmap_base(void) 42 { 43 - unsigned long gap = current->signal->rlim[RLIMIT_STACK].rlim_cur; 44 45 if (gap < MIN_GAP) 46 gap = MIN_GAP; ··· 61 #endif 62 return sysctl_legacy_va_layout || 63 (current->personality & ADDR_COMPAT_LAYOUT) || 64 - current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY; 65 } 66 67 #ifndef CONFIG_64BIT
··· 40 41 static inline unsigned long mmap_base(void) 42 { 43 + unsigned long gap = rlimit(RLIMIT_STACK); 44 45 if (gap < MIN_GAP) 46 gap = MIN_GAP; ··· 61 #endif 62 return sysctl_legacy_va_layout || 63 (current->personality & ADDR_COMPAT_LAYOUT) || 64 + rlimit(RLIMIT_STACK) == RLIM_INFINITY; 65 } 66 67 #ifndef CONFIG_64BIT
+9 -5
drivers/s390/block/dasd_eckd.c
··· 23 #include <asm/debug.h> 24 #include <asm/idals.h> 25 #include <asm/ebcdic.h> 26 #include <asm/io.h> 27 #include <asm/uaccess.h> 28 #include <asm/cio.h> ··· 2845 rc = -EFAULT; 2846 if (copy_from_user(&usrparm, argp, sizeof(usrparm))) 2847 goto out; 2848 - #ifndef CONFIG_64BIT 2849 - /* Make sure pointers are sane even on 31 bit. */ 2850 - if ((usrparm.psf_data >> 32) != 0 || (usrparm.rssd_result >> 32) != 0) { 2851 rc = -EINVAL; 2852 - goto out; 2853 } 2854 - #endif 2855 /* alloc I/O data area */ 2856 psf_data = kzalloc(usrparm.psf_data_len, GFP_KERNEL | GFP_DMA); 2857 rssd_result = kzalloc(usrparm.rssd_result_len, GFP_KERNEL | GFP_DMA);
··· 23 #include <asm/debug.h> 24 #include <asm/idals.h> 25 #include <asm/ebcdic.h> 26 + #include <asm/compat.h> 27 #include <asm/io.h> 28 #include <asm/uaccess.h> 29 #include <asm/cio.h> ··· 2844 rc = -EFAULT; 2845 if (copy_from_user(&usrparm, argp, sizeof(usrparm))) 2846 goto out; 2847 + if (is_compat_task() || sizeof(long) == 4) { 2848 + /* Make sure pointers are sane even on 31 bit. */ 2849 rc = -EINVAL; 2850 + if ((usrparm.psf_data >> 32) != 0) 2851 + goto out; 2852 + if ((usrparm.rssd_result >> 32) != 0) 2853 + goto out; 2854 + usrparm.psf_data &= 0x7fffffffULL; 2855 + usrparm.rssd_result &= 0x7fffffffULL; 2856 } 2857 /* alloc I/O data area */ 2858 psf_data = kzalloc(usrparm.psf_data_len, GFP_KERNEL | GFP_DMA); 2859 rssd_result = kzalloc(usrparm.rssd_result_len, GFP_KERNEL | GFP_DMA);
+9 -5
drivers/s390/block/dasd_ioctl.c
··· 17 #include <linux/fs.h> 18 #include <linux/blkpg.h> 19 #include <linux/smp_lock.h> 20 - 21 #include <asm/ccwdev.h> 22 #include <asm/cmb.h> 23 #include <asm/uaccess.h> ··· 358 } 359 360 static int dasd_ioctl_readall_cmb(struct dasd_block *block, unsigned int cmd, 361 - unsigned long arg) 362 { 363 - struct cmbdata __user *argp = (void __user *) arg; 364 size_t size = _IOC_SIZE(cmd); 365 struct cmbdata data; 366 int ret; ··· 375 unsigned int cmd, unsigned long arg) 376 { 377 struct dasd_block *block = bdev->bd_disk->private_data; 378 - void __user *argp = (void __user *)arg; 379 380 if (!block) 381 return -ENODEV; ··· 418 case BIODASDCMFDISABLE: 419 return disable_cmf(block->base->cdev); 420 case BIODASDREADALLCMB: 421 - return dasd_ioctl_readall_cmb(block, cmd, arg); 422 default: 423 /* if the discipline has an ioctl method try it. */ 424 if (block->base->discipline->ioctl) {
··· 17 #include <linux/fs.h> 18 #include <linux/blkpg.h> 19 #include <linux/smp_lock.h> 20 + #include <asm/compat.h> 21 #include <asm/ccwdev.h> 22 #include <asm/cmb.h> 23 #include <asm/uaccess.h> ··· 358 } 359 360 static int dasd_ioctl_readall_cmb(struct dasd_block *block, unsigned int cmd, 361 + struct cmbdata __user *argp) 362 { 363 size_t size = _IOC_SIZE(cmd); 364 struct cmbdata data; 365 int ret; ··· 376 unsigned int cmd, unsigned long arg) 377 { 378 struct dasd_block *block = bdev->bd_disk->private_data; 379 + void __user *argp; 380 + 381 + if (is_compat_task()) 382 + argp = compat_ptr(arg); 383 + else 384 + argp = (void __user *)arg; 385 386 if (!block) 387 return -ENODEV; ··· 414 case BIODASDCMFDISABLE: 415 return disable_cmf(block->base->cdev); 416 case BIODASDREADALLCMB: 417 + return dasd_ioctl_readall_cmb(block, cmd, argp); 418 default: 419 /* if the discipline has an ioctl method try it. */ 420 if (block->base->discipline->ioctl) {
-17
drivers/s390/char/con3215.c
··· 1037 } 1038 1039 /* 1040 - * Currently we don't have any io controls for 3215 ttys 1041 - */ 1042 - static int tty3215_ioctl(struct tty_struct *tty, struct file * file, 1043 - unsigned int cmd, unsigned long arg) 1044 - { 1045 - if (tty->flags & (1 << TTY_IO_ERROR)) 1046 - return -EIO; 1047 - 1048 - switch (cmd) { 1049 - default: 1050 - return -ENOIOCTLCMD; 1051 - } 1052 - return 0; 1053 - } 1054 - 1055 - /* 1056 * Disable reading from a 3215 tty 1057 */ 1058 static void tty3215_throttle(struct tty_struct * tty) ··· 1101 .write_room = tty3215_write_room, 1102 .chars_in_buffer = tty3215_chars_in_buffer, 1103 .flush_buffer = tty3215_flush_buffer, 1104 - .ioctl = tty3215_ioctl, 1105 .throttle = tty3215_throttle, 1106 .unthrottle = tty3215_unthrottle, 1107 .stop = tty3215_stop,
··· 1037 } 1038 1039 /* 1040 * Disable reading from a 3215 tty 1041 */ 1042 static void tty3215_throttle(struct tty_struct * tty) ··· 1117 .write_room = tty3215_write_room, 1118 .chars_in_buffer = tty3215_chars_in_buffer, 1119 .flush_buffer = tty3215_flush_buffer, 1120 .throttle = tty3215_throttle, 1121 .unthrottle = tty3215_unthrottle, 1122 .stop = tty3215_stop,
+11 -6
drivers/s390/char/fs3270.c
··· 15 #include <linux/types.h> 16 #include <linux/smp_lock.h> 17 18 #include <asm/ccwdev.h> 19 #include <asm/cio.h> 20 #include <asm/ebcdic.h> ··· 323 static long 324 fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 325 { 326 struct fs3270 *fp; 327 struct raw3270_iocb iocb; 328 int rc; ··· 331 fp = filp->private_data; 332 if (!fp) 333 return -ENODEV; 334 rc = 0; 335 mutex_lock(&fs3270_mutex); 336 switch (cmd) { ··· 345 fp->write_command = arg; 346 break; 347 case TUBGETI: 348 - rc = put_user(fp->read_command, (char __user *) arg); 349 break; 350 case TUBGETO: 351 - rc = put_user(fp->write_command,(char __user *) arg); 352 break; 353 case TUBGETMOD: 354 iocb.model = fp->view.model; ··· 357 iocb.pf_cnt = 24; 358 iocb.re_cnt = 20; 359 iocb.map = 0; 360 - if (copy_to_user((char __user *) arg, &iocb, 361 - sizeof(struct raw3270_iocb))) 362 rc = -EFAULT; 363 break; 364 } ··· 516 .write = fs3270_write, /* write */ 517 .unlocked_ioctl = fs3270_ioctl, /* ioctl */ 518 .compat_ioctl = fs3270_ioctl, /* ioctl */ 519 - .open = fs3270_open, /* open */ 520 - .release = fs3270_close, /* release */ 521 }; 522 523 /*
··· 15 #include <linux/types.h> 16 #include <linux/smp_lock.h> 17 18 + #include <asm/compat.h> 19 #include <asm/ccwdev.h> 20 #include <asm/cio.h> 21 #include <asm/ebcdic.h> ··· 322 static long 323 fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 324 { 325 + char __user *argp; 326 struct fs3270 *fp; 327 struct raw3270_iocb iocb; 328 int rc; ··· 329 fp = filp->private_data; 330 if (!fp) 331 return -ENODEV; 332 + if (is_compat_task()) 333 + argp = compat_ptr(arg); 334 + else 335 + argp = (char __user *)arg; 336 rc = 0; 337 mutex_lock(&fs3270_mutex); 338 switch (cmd) { ··· 339 fp->write_command = arg; 340 break; 341 case TUBGETI: 342 + rc = put_user(fp->read_command, argp); 343 break; 344 case TUBGETO: 345 + rc = put_user(fp->write_command, argp); 346 break; 347 case TUBGETMOD: 348 iocb.model = fp->view.model; ··· 351 iocb.pf_cnt = 24; 352 iocb.re_cnt = 20; 353 iocb.map = 0; 354 + if (copy_to_user(argp, &iocb, sizeof(struct raw3270_iocb))) 355 rc = -EFAULT; 356 break; 357 } ··· 511 .write = fs3270_write, /* write */ 512 .unlocked_ioctl = fs3270_ioctl, /* ioctl */ 513 .compat_ioctl = fs3270_ioctl, /* ioctl */ 514 + .open = fs3270_open, /* open */ 515 + .release = fs3270_close, /* release */ 516 }; 517 518 /*
-39
drivers/s390/char/tape_block.c
··· 46 */ 47 static int tapeblock_open(struct block_device *, fmode_t); 48 static int tapeblock_release(struct gendisk *, fmode_t); 49 - static int tapeblock_ioctl(struct block_device *, fmode_t, unsigned int, 50 - unsigned long); 51 static int tapeblock_medium_changed(struct gendisk *); 52 static int tapeblock_revalidate_disk(struct gendisk *); 53 ··· 53 .owner = THIS_MODULE, 54 .open = tapeblock_open, 55 .release = tapeblock_release, 56 - .ioctl = tapeblock_ioctl, 57 .media_changed = tapeblock_medium_changed, 58 .revalidate_disk = tapeblock_revalidate_disk, 59 }; ··· 410 tape_put_device(device); 411 412 return 0; 413 - } 414 - 415 - /* 416 - * Support of some generic block device IOCTLs. 417 - */ 418 - static int 419 - tapeblock_ioctl( 420 - struct block_device * bdev, 421 - fmode_t mode, 422 - unsigned int command, 423 - unsigned long arg 424 - ) { 425 - int rc; 426 - int minor; 427 - struct gendisk *disk = bdev->bd_disk; 428 - struct tape_device *device; 429 - 430 - rc = 0; 431 - BUG_ON(!disk); 432 - device = disk->private_data; 433 - BUG_ON(!device); 434 - minor = MINOR(bdev->bd_dev); 435 - 436 - DBF_LH(6, "tapeblock_ioctl(0x%0x)\n", command); 437 - DBF_LH(6, "device = %d:%d\n", tapeblock_major, minor); 438 - 439 - switch (command) { 440 - /* Refuse some IOCTL calls without complaining (mount). */ 441 - case 0x5310: /* CDROMMULTISESSION */ 442 - rc = -EINVAL; 443 - break; 444 - default: 445 - rc = -EINVAL; 446 - } 447 - 448 - return rc; 449 } 450 451 /*
··· 46 */ 47 static int tapeblock_open(struct block_device *, fmode_t); 48 static int tapeblock_release(struct gendisk *, fmode_t); 49 static int tapeblock_medium_changed(struct gendisk *); 50 static int tapeblock_revalidate_disk(struct gendisk *); 51 ··· 55 .owner = THIS_MODULE, 56 .open = tapeblock_open, 57 .release = tapeblock_release, 58 .media_changed = tapeblock_medium_changed, 59 .revalidate_disk = tapeblock_revalidate_disk, 60 }; ··· 413 tape_put_device(device); 414 415 return 0; 416 } 417 418 /*
+15 -3
drivers/s390/char/tape_char.c
··· 18 #include <linux/proc_fs.h> 19 #include <linux/mtio.h> 20 #include <linux/smp_lock.h> 21 22 #include <asm/uaccess.h> 23 ··· 38 static int tapechar_open(struct inode *,struct file *); 39 static int tapechar_release(struct inode *,struct file *); 40 static long tapechar_ioctl(struct file *, unsigned int, unsigned long); 41 - static long tapechar_compat_ioctl(struct file *, unsigned int, 42 - unsigned long); 43 44 static const struct file_operations tape_fops = 45 { ··· 48 .read = tapechar_read, 49 .write = tapechar_write, 50 .unlocked_ioctl = tapechar_ioctl, 51 .compat_ioctl = tapechar_compat_ioctl, 52 .open = tapechar_open, 53 .release = tapechar_release, 54 }; ··· 461 return rc; 462 } 463 464 static long 465 tapechar_compat_ioctl(struct file *filp, unsigned int no, unsigned long data) 466 { 467 struct tape_device *device = filp->private_data; 468 int rval = -ENOIOCTLCMD; 469 470 if (device->discipline->ioctl_fn) { 471 mutex_lock(&device->mutex); 472 - rval = device->discipline->ioctl_fn(device, no, data); 473 mutex_unlock(&device->mutex); 474 if (rval == -EINVAL) 475 rval = -ENOIOCTLCMD; ··· 484 485 return rval; 486 } 487 488 /* 489 * Initialize character device frontend.
··· 18 #include <linux/proc_fs.h> 19 #include <linux/mtio.h> 20 #include <linux/smp_lock.h> 21 + #include <linux/compat.h> 22 23 #include <asm/uaccess.h> 24 ··· 37 static int tapechar_open(struct inode *,struct file *); 38 static int tapechar_release(struct inode *,struct file *); 39 static long tapechar_ioctl(struct file *, unsigned int, unsigned long); 40 + #ifdef CONFIG_COMPAT 41 + static long tapechar_compat_ioctl(struct file *, unsigned int, unsigned long); 42 + #endif 43 44 static const struct file_operations tape_fops = 45 { ··· 46 .read = tapechar_read, 47 .write = tapechar_write, 48 .unlocked_ioctl = tapechar_ioctl, 49 + #ifdef CONFIG_COMPAT 50 .compat_ioctl = tapechar_compat_ioctl, 51 + #endif 52 .open = tapechar_open, 53 .release = tapechar_release, 54 }; ··· 457 return rc; 458 } 459 460 + #ifdef CONFIG_COMPAT 461 static long 462 tapechar_compat_ioctl(struct file *filp, unsigned int no, unsigned long data) 463 { 464 struct tape_device *device = filp->private_data; 465 int rval = -ENOIOCTLCMD; 466 + unsigned long argp; 467 468 + /* The 'arg' argument of any ioctl function may only be used for 469 + * pointers because of the compat pointer conversion. 470 + * Consider this when adding new ioctls. 471 + */ 472 + argp = (unsigned long) compat_ptr(data); 473 if (device->discipline->ioctl_fn) { 474 mutex_lock(&device->mutex); 475 + rval = device->discipline->ioctl_fn(device, no, argp); 476 mutex_unlock(&device->mutex); 477 if (rval == -EINVAL) 478 rval = -ENOIOCTLCMD; ··· 473 474 return rval; 475 } 476 + #endif /* CONFIG_COMPAT */ 477 478 /* 479 * Initialize character device frontend.
+9 -3
drivers/s390/char/vmcp.c
··· 19 #include <linux/kernel.h> 20 #include <linux/miscdevice.h> 21 #include <linux/module.h> 22 #include <asm/cpcmd.h> 23 #include <asm/debug.h> 24 #include <asm/uaccess.h> ··· 140 static long vmcp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 141 { 142 struct vmcp_session *session; 143 int temp; 144 145 session = (struct vmcp_session *)file->private_data; 146 if (mutex_lock_interruptible(&session->mutex)) 147 return -ERESTARTSYS; 148 switch (cmd) { 149 case VMCP_GETCODE: 150 temp = session->resp_code; 151 mutex_unlock(&session->mutex); 152 - return put_user(temp, (int __user *)arg); 153 case VMCP_SETBUF: 154 free_pages((unsigned long)session->response, 155 get_order(session->bufsize)); 156 session->response=NULL; 157 - temp = get_user(session->bufsize, (int __user *)arg); 158 if (get_order(session->bufsize) > 8) { 159 session->bufsize = PAGE_SIZE; 160 temp = -EINVAL; ··· 169 case VMCP_GETSIZE: 170 temp = session->resp_size; 171 mutex_unlock(&session->mutex); 172 - return put_user(temp, (int __user *)arg); 173 default: 174 mutex_unlock(&session->mutex); 175 return -ENOIOCTLCMD;
··· 19 #include <linux/kernel.h> 20 #include <linux/miscdevice.h> 21 #include <linux/module.h> 22 + #include <asm/compat.h> 23 #include <asm/cpcmd.h> 24 #include <asm/debug.h> 25 #include <asm/uaccess.h> ··· 139 static long vmcp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 140 { 141 struct vmcp_session *session; 142 + int __user *argp; 143 int temp; 144 145 session = (struct vmcp_session *)file->private_data; 146 + if (is_compat_task()) 147 + argp = compat_ptr(arg); 148 + else 149 + argp = (int __user *)arg; 150 if (mutex_lock_interruptible(&session->mutex)) 151 return -ERESTARTSYS; 152 switch (cmd) { 153 case VMCP_GETCODE: 154 temp = session->resp_code; 155 mutex_unlock(&session->mutex); 156 + return put_user(temp, argp); 157 case VMCP_SETBUF: 158 free_pages((unsigned long)session->response, 159 get_order(session->bufsize)); 160 session->response=NULL; 161 + temp = get_user(session->bufsize, argp); 162 if (get_order(session->bufsize) > 8) { 163 session->bufsize = PAGE_SIZE; 164 temp = -EINVAL; ··· 163 case VMCP_GETSIZE: 164 temp = session->resp_size; 165 mutex_unlock(&session->mutex); 166 + return put_user(temp, argp); 167 default: 168 mutex_unlock(&session->mutex); 169 return -ENOIOCTLCMD;
+15 -8
drivers/s390/cio/chsc_sch.c
··· 12 #include <linux/uaccess.h> 13 #include <linux/miscdevice.h> 14 15 #include <asm/cio.h> 16 #include <asm/chsc.h> 17 #include <asm/isc.h> ··· 771 static long chsc_ioctl(struct file *filp, unsigned int cmd, 772 unsigned long arg) 773 { 774 CHSC_MSG(2, "chsc_ioctl called, cmd=%x\n", cmd); 775 switch (cmd) { 776 case CHSC_START: 777 - return chsc_ioctl_start((void __user *)arg); 778 case CHSC_INFO_CHANNEL_PATH: 779 - return chsc_ioctl_info_channel_path((void __user *)arg); 780 case CHSC_INFO_CU: 781 - return chsc_ioctl_info_cu((void __user *)arg); 782 case CHSC_INFO_SCH_CU: 783 - return chsc_ioctl_info_sch_cu((void __user *)arg); 784 case CHSC_INFO_CI: 785 - return chsc_ioctl_conf_info((void __user *)arg); 786 case CHSC_INFO_CCL: 787 - return chsc_ioctl_conf_comp_list((void __user *)arg); 788 case CHSC_INFO_CPD: 789 - return chsc_ioctl_chpd((void __user *)arg); 790 case CHSC_INFO_DCAL: 791 - return chsc_ioctl_dcal((void __user *)arg); 792 default: /* unknown ioctl number */ 793 return -ENOIOCTLCMD; 794 }
··· 12 #include <linux/uaccess.h> 13 #include <linux/miscdevice.h> 14 15 + #include <asm/compat.h> 16 #include <asm/cio.h> 17 #include <asm/chsc.h> 18 #include <asm/isc.h> ··· 770 static long chsc_ioctl(struct file *filp, unsigned int cmd, 771 unsigned long arg) 772 { 773 + void __user *argp; 774 + 775 CHSC_MSG(2, "chsc_ioctl called, cmd=%x\n", cmd); 776 + if (is_compat_task()) 777 + argp = compat_ptr(arg); 778 + else 779 + argp = (void __user *)arg; 780 switch (cmd) { 781 case CHSC_START: 782 + return chsc_ioctl_start(argp); 783 case CHSC_INFO_CHANNEL_PATH: 784 + return chsc_ioctl_info_channel_path(argp); 785 case CHSC_INFO_CU: 786 + return chsc_ioctl_info_cu(argp); 787 case CHSC_INFO_SCH_CU: 788 + return chsc_ioctl_info_sch_cu(argp); 789 case CHSC_INFO_CI: 790 + return chsc_ioctl_conf_info(argp); 791 case CHSC_INFO_CCL: 792 + return chsc_ioctl_conf_comp_list(argp); 793 case CHSC_INFO_CPD: 794 + return chsc_ioctl_chpd(argp); 795 case CHSC_INFO_DCAL: 796 + return chsc_ioctl_dcal(argp); 797 default: /* unknown ioctl number */ 798 return -ENOIOCTLCMD; 799 }
+3 -1
drivers/s390/crypto/zcrypt_api.c
··· 393 * u_mult_inv > 128 bytes. 394 */ 395 if (copied == 0) { 396 - int len; 397 spin_unlock_bh(&zcrypt_device_lock); 398 /* len is max 256 / 2 - 120 = 8 */ 399 len = crt->inputdatalength / 2 - 120; 400 z1 = z2 = z3 = 0; 401 if (copy_from_user(&z1, crt->np_prime, len) || 402 copy_from_user(&z2, crt->bp_key, len) ||
··· 393 * u_mult_inv > 128 bytes. 394 */ 395 if (copied == 0) { 396 + unsigned int len; 397 spin_unlock_bh(&zcrypt_device_lock); 398 /* len is max 256 / 2 - 120 = 8 */ 399 len = crt->inputdatalength / 2 - 120; 400 + if (len > sizeof(z1)) 401 + return -EFAULT; 402 z1 = z2 = z3 = 0; 403 if (copy_from_user(&z1, crt->np_prime, len) || 404 copy_from_user(&z2, crt->bp_key, len) ||