diff options
Diffstat (limited to 'arch/x86_64/ia32')
-rw-r--r-- | arch/x86_64/ia32/ia32_aout.c | 8 | ||||
-rw-r--r-- | arch/x86_64/ia32/ia32_signal.c | 53 | ||||
-rw-r--r-- | arch/x86_64/ia32/ia32entry.S | 9 | ||||
-rw-r--r-- | arch/x86_64/ia32/ptrace32.c | 10 | ||||
-rw-r--r-- | arch/x86_64/ia32/sys_ia32.c | 54 |
5 files changed, 72 insertions, 62 deletions
diff --git a/arch/x86_64/ia32/ia32_aout.c b/arch/x86_64/ia32/ia32_aout.c index 3bf58af98936..396d3c100011 100644 --- a/arch/x86_64/ia32/ia32_aout.c +++ b/arch/x86_64/ia32/ia32_aout.c | |||
@@ -333,7 +333,8 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
333 | return error; | 333 | return error; |
334 | } | 334 | } |
335 | 335 | ||
336 | error = bprm->file->f_op->read(bprm->file, (char *)text_addr, | 336 | error = bprm->file->f_op->read(bprm->file, |
337 | (char __user *)text_addr, | ||
337 | ex.a_text+ex.a_data, &pos); | 338 | ex.a_text+ex.a_data, &pos); |
338 | if ((signed long)error < 0) { | 339 | if ((signed long)error < 0) { |
339 | send_sig(SIGKILL, current, 0); | 340 | send_sig(SIGKILL, current, 0); |
@@ -366,7 +367,8 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
366 | down_write(¤t->mm->mmap_sem); | 367 | down_write(¤t->mm->mmap_sem); |
367 | do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); | 368 | do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); |
368 | up_write(¤t->mm->mmap_sem); | 369 | up_write(¤t->mm->mmap_sem); |
369 | bprm->file->f_op->read(bprm->file,(char *)N_TXTADDR(ex), | 370 | bprm->file->f_op->read(bprm->file, |
371 | (char __user *)N_TXTADDR(ex), | ||
370 | ex.a_text+ex.a_data, &pos); | 372 | ex.a_text+ex.a_data, &pos); |
371 | flush_icache_range((unsigned long) N_TXTADDR(ex), | 373 | flush_icache_range((unsigned long) N_TXTADDR(ex), |
372 | (unsigned long) N_TXTADDR(ex) + | 374 | (unsigned long) N_TXTADDR(ex) + |
@@ -477,7 +479,7 @@ static int load_aout_library(struct file *file) | |||
477 | do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); | 479 | do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); |
478 | up_write(¤t->mm->mmap_sem); | 480 | up_write(¤t->mm->mmap_sem); |
479 | 481 | ||
480 | file->f_op->read(file, (char *)start_addr, | 482 | file->f_op->read(file, (char __user *)start_addr, |
481 | ex.a_text + ex.a_data, &pos); | 483 | ex.a_text + ex.a_data, &pos); |
482 | flush_icache_range((unsigned long) start_addr, | 484 | flush_icache_range((unsigned long) start_addr, |
483 | (unsigned long) start_addr + ex.a_text + ex.a_data); | 485 | (unsigned long) start_addr + ex.a_text + ex.a_data); |
diff --git a/arch/x86_64/ia32/ia32_signal.c b/arch/x86_64/ia32/ia32_signal.c index 25e5ca22204c..a6ba9951e86c 100644 --- a/arch/x86_64/ia32/ia32_signal.c +++ b/arch/x86_64/ia32/ia32_signal.c | |||
@@ -113,25 +113,19 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) | |||
113 | } | 113 | } |
114 | 114 | ||
115 | asmlinkage long | 115 | asmlinkage long |
116 | sys32_sigsuspend(int history0, int history1, old_sigset_t mask, | 116 | sys32_sigsuspend(int history0, int history1, old_sigset_t mask) |
117 | struct pt_regs *regs) | ||
118 | { | 117 | { |
119 | sigset_t saveset; | ||
120 | |||
121 | mask &= _BLOCKABLE; | 118 | mask &= _BLOCKABLE; |
122 | spin_lock_irq(¤t->sighand->siglock); | 119 | spin_lock_irq(¤t->sighand->siglock); |
123 | saveset = current->blocked; | 120 | current->saved_sigmask = current->blocked; |
124 | siginitset(¤t->blocked, mask); | 121 | siginitset(¤t->blocked, mask); |
125 | recalc_sigpending(); | 122 | recalc_sigpending(); |
126 | spin_unlock_irq(¤t->sighand->siglock); | 123 | spin_unlock_irq(¤t->sighand->siglock); |
127 | 124 | ||
128 | regs->rax = -EINTR; | 125 | current->state = TASK_INTERRUPTIBLE; |
129 | while (1) { | 126 | schedule(); |
130 | current->state = TASK_INTERRUPTIBLE; | 127 | set_thread_flag(TIF_RESTORE_SIGMASK); |
131 | schedule(); | 128 | return -ERESTARTNOHAND; |
132 | if (do_signal(regs, &saveset)) | ||
133 | return -EINTR; | ||
134 | } | ||
135 | } | 129 | } |
136 | 130 | ||
137 | asmlinkage long | 131 | asmlinkage long |
@@ -437,15 +431,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
437 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 431 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
438 | goto give_sigsegv; | 432 | goto give_sigsegv; |
439 | 433 | ||
440 | { | 434 | err |= __put_user(sig, &frame->sig); |
441 | struct exec_domain *ed = current_thread_info()->exec_domain; | ||
442 | err |= __put_user((ed | ||
443 | && ed->signal_invmap | ||
444 | && sig < 32 | ||
445 | ? ed->signal_invmap[sig] | ||
446 | : sig), | ||
447 | &frame->sig); | ||
448 | } | ||
449 | if (err) | 435 | if (err) |
450 | goto give_sigsegv; | 436 | goto give_sigsegv; |
451 | 437 | ||
@@ -492,6 +478,11 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
492 | regs->rsp = (unsigned long) frame; | 478 | regs->rsp = (unsigned long) frame; |
493 | regs->rip = (unsigned long) ka->sa.sa_handler; | 479 | regs->rip = (unsigned long) ka->sa.sa_handler; |
494 | 480 | ||
481 | /* Make -mregparm=3 work */ | ||
482 | regs->rax = sig; | ||
483 | regs->rdx = 0; | ||
484 | regs->rcx = 0; | ||
485 | |||
495 | asm volatile("movl %0,%%ds" :: "r" (__USER32_DS)); | 486 | asm volatile("movl %0,%%ds" :: "r" (__USER32_DS)); |
496 | asm volatile("movl %0,%%es" :: "r" (__USER32_DS)); | 487 | asm volatile("movl %0,%%es" :: "r" (__USER32_DS)); |
497 | 488 | ||
@@ -499,20 +490,20 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
499 | regs->ss = __USER32_DS; | 490 | regs->ss = __USER32_DS; |
500 | 491 | ||
501 | set_fs(USER_DS); | 492 | set_fs(USER_DS); |
502 | regs->eflags &= ~TF_MASK; | 493 | regs->eflags &= ~TF_MASK; |
503 | if (test_thread_flag(TIF_SINGLESTEP)) | 494 | if (test_thread_flag(TIF_SINGLESTEP)) |
504 | ptrace_notify(SIGTRAP); | 495 | ptrace_notify(SIGTRAP); |
505 | 496 | ||
506 | #if DEBUG_SIG | 497 | #if DEBUG_SIG |
507 | printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", | 498 | printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", |
508 | current->comm, current->pid, frame, regs->rip, frame->pretcode); | 499 | current->comm, current->pid, frame, regs->rip, frame->pretcode); |
509 | #endif | 500 | #endif |
510 | 501 | ||
511 | return 1; | 502 | return 0; |
512 | 503 | ||
513 | give_sigsegv: | 504 | give_sigsegv: |
514 | force_sigsegv(sig, current); | 505 | force_sigsegv(sig, current); |
515 | return 0; | 506 | return -EFAULT; |
516 | } | 507 | } |
517 | 508 | ||
518 | int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | 509 | int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, |
@@ -595,18 +586,18 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
595 | regs->ss = __USER32_DS; | 586 | regs->ss = __USER32_DS; |
596 | 587 | ||
597 | set_fs(USER_DS); | 588 | set_fs(USER_DS); |
598 | regs->eflags &= ~TF_MASK; | 589 | regs->eflags &= ~TF_MASK; |
599 | if (test_thread_flag(TIF_SINGLESTEP)) | 590 | if (test_thread_flag(TIF_SINGLESTEP)) |
600 | ptrace_notify(SIGTRAP); | 591 | ptrace_notify(SIGTRAP); |
601 | 592 | ||
602 | #if DEBUG_SIG | 593 | #if DEBUG_SIG |
603 | printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", | 594 | printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", |
604 | current->comm, current->pid, frame, regs->rip, frame->pretcode); | 595 | current->comm, current->pid, frame, regs->rip, frame->pretcode); |
605 | #endif | 596 | #endif |
606 | 597 | ||
607 | return 1; | 598 | return 0; |
608 | 599 | ||
609 | give_sigsegv: | 600 | give_sigsegv: |
610 | force_sigsegv(sig, current); | 601 | force_sigsegv(sig, current); |
611 | return 0; | 602 | return -EFAULT; |
612 | } | 603 | } |
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S index 5d4a7d125ed0..b4aa875e175b 100644 --- a/arch/x86_64/ia32/ia32entry.S +++ b/arch/x86_64/ia32/ia32entry.S | |||
@@ -71,6 +71,7 @@ | |||
71 | */ | 71 | */ |
72 | ENTRY(ia32_sysenter_target) | 72 | ENTRY(ia32_sysenter_target) |
73 | CFI_STARTPROC32 simple | 73 | CFI_STARTPROC32 simple |
74 | CFI_SIGNAL_FRAME | ||
74 | CFI_DEF_CFA rsp,0 | 75 | CFI_DEF_CFA rsp,0 |
75 | CFI_REGISTER rsp,rbp | 76 | CFI_REGISTER rsp,rbp |
76 | swapgs | 77 | swapgs |
@@ -186,6 +187,7 @@ ENDPROC(ia32_sysenter_target) | |||
186 | */ | 187 | */ |
187 | ENTRY(ia32_cstar_target) | 188 | ENTRY(ia32_cstar_target) |
188 | CFI_STARTPROC32 simple | 189 | CFI_STARTPROC32 simple |
190 | CFI_SIGNAL_FRAME | ||
189 | CFI_DEF_CFA rsp,PDA_STACKOFFSET | 191 | CFI_DEF_CFA rsp,PDA_STACKOFFSET |
190 | CFI_REGISTER rip,rcx | 192 | CFI_REGISTER rip,rcx |
191 | /*CFI_REGISTER rflags,r11*/ | 193 | /*CFI_REGISTER rflags,r11*/ |
@@ -293,6 +295,7 @@ ia32_badarg: | |||
293 | 295 | ||
294 | ENTRY(ia32_syscall) | 296 | ENTRY(ia32_syscall) |
295 | CFI_STARTPROC simple | 297 | CFI_STARTPROC simple |
298 | CFI_SIGNAL_FRAME | ||
296 | CFI_DEF_CFA rsp,SS+8-RIP | 299 | CFI_DEF_CFA rsp,SS+8-RIP |
297 | /*CFI_REL_OFFSET ss,SS-RIP*/ | 300 | /*CFI_REL_OFFSET ss,SS-RIP*/ |
298 | CFI_REL_OFFSET rsp,RSP-RIP | 301 | CFI_REL_OFFSET rsp,RSP-RIP |
@@ -370,6 +373,7 @@ ENTRY(ia32_ptregs_common) | |||
370 | popq %r11 | 373 | popq %r11 |
371 | CFI_ENDPROC | 374 | CFI_ENDPROC |
372 | CFI_STARTPROC32 simple | 375 | CFI_STARTPROC32 simple |
376 | CFI_SIGNAL_FRAME | ||
373 | CFI_DEF_CFA rsp,SS+8-ARGOFFSET | 377 | CFI_DEF_CFA rsp,SS+8-ARGOFFSET |
374 | CFI_REL_OFFSET rax,RAX-ARGOFFSET | 378 | CFI_REL_OFFSET rax,RAX-ARGOFFSET |
375 | CFI_REL_OFFSET rcx,RCX-ARGOFFSET | 379 | CFI_REL_OFFSET rcx,RCX-ARGOFFSET |
@@ -703,8 +707,8 @@ ia32_sys_call_table: | |||
703 | .quad sys_readlinkat /* 305 */ | 707 | .quad sys_readlinkat /* 305 */ |
704 | .quad sys_fchmodat | 708 | .quad sys_fchmodat |
705 | .quad sys_faccessat | 709 | .quad sys_faccessat |
706 | .quad quiet_ni_syscall /* pselect6 for now */ | 710 | .quad compat_sys_pselect6 |
707 | .quad quiet_ni_syscall /* ppoll for now */ | 711 | .quad compat_sys_ppoll |
708 | .quad sys_unshare /* 310 */ | 712 | .quad sys_unshare /* 310 */ |
709 | .quad compat_sys_set_robust_list | 713 | .quad compat_sys_set_robust_list |
710 | .quad compat_sys_get_robust_list | 714 | .quad compat_sys_get_robust_list |
@@ -713,4 +717,5 @@ ia32_sys_call_table: | |||
713 | .quad sys_tee | 717 | .quad sys_tee |
714 | .quad compat_sys_vmsplice | 718 | .quad compat_sys_vmsplice |
715 | .quad compat_sys_move_pages | 719 | .quad compat_sys_move_pages |
720 | .quad sys_getcpu | ||
716 | ia32_syscall_end: | 721 | ia32_syscall_end: |
diff --git a/arch/x86_64/ia32/ptrace32.c b/arch/x86_64/ia32/ptrace32.c index 659c0722f6b8..d18198ed636b 100644 --- a/arch/x86_64/ia32/ptrace32.c +++ b/arch/x86_64/ia32/ptrace32.c | |||
@@ -117,6 +117,10 @@ static int putreg32(struct task_struct *child, unsigned regno, u32 val) | |||
117 | if ((0x5454 >> ((val >> (16 + 4*i)) & 0xf)) & 1) | 117 | if ((0x5454 >> ((val >> (16 + 4*i)) & 0xf)) & 1) |
118 | return -EIO; | 118 | return -EIO; |
119 | child->thread.debugreg7 = val; | 119 | child->thread.debugreg7 = val; |
120 | if (val) | ||
121 | set_tsk_thread_flag(child, TIF_DEBUG); | ||
122 | else | ||
123 | clear_tsk_thread_flag(child, TIF_DEBUG); | ||
120 | break; | 124 | break; |
121 | 125 | ||
122 | default: | 126 | default: |
@@ -371,8 +375,10 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) | |||
371 | ret = -EIO; | 375 | ret = -EIO; |
372 | if (!access_ok(VERIFY_READ, u, sizeof(*u))) | 376 | if (!access_ok(VERIFY_READ, u, sizeof(*u))) |
373 | break; | 377 | break; |
374 | /* no checking to be bug-to-bug compatible with i386 */ | 378 | /* no checking to be bug-to-bug compatible with i386. */ |
375 | __copy_from_user(&child->thread.i387.fxsave, u, sizeof(*u)); | 379 | /* but silence warning */ |
380 | if (__copy_from_user(&child->thread.i387.fxsave, u, sizeof(*u))) | ||
381 | ; | ||
376 | set_stopped_child_used_math(child); | 382 | set_stopped_child_used_math(child); |
377 | child->thread.i387.fxsave.mxcsr &= mxcsr_feature_mask; | 383 | child->thread.i387.fxsave.mxcsr &= mxcsr_feature_mask; |
378 | ret = 0; | 384 | ret = 0; |
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c index 9c130993380d..f280d3665f4b 100644 --- a/arch/x86_64/ia32/sys_ia32.c +++ b/arch/x86_64/ia32/sys_ia32.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <linux/highuid.h> | 60 | #include <linux/highuid.h> |
61 | #include <linux/vmalloc.h> | 61 | #include <linux/vmalloc.h> |
62 | #include <linux/fsnotify.h> | 62 | #include <linux/fsnotify.h> |
63 | #include <linux/sysctl.h> | ||
63 | #include <asm/mman.h> | 64 | #include <asm/mman.h> |
64 | #include <asm/types.h> | 65 | #include <asm/types.h> |
65 | #include <asm/uaccess.h> | 66 | #include <asm/uaccess.h> |
@@ -389,7 +390,9 @@ sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, | |||
389 | } | 390 | } |
390 | } | 391 | } |
391 | set_fs (KERNEL_DS); | 392 | set_fs (KERNEL_DS); |
392 | ret = sys_rt_sigprocmask(how, set ? &s : NULL, oset ? &s : NULL, | 393 | ret = sys_rt_sigprocmask(how, |
394 | set ? (sigset_t __user *)&s : NULL, | ||
395 | oset ? (sigset_t __user *)&s : NULL, | ||
393 | sigsetsize); | 396 | sigsetsize); |
394 | set_fs (old_fs); | 397 | set_fs (old_fs); |
395 | if (ret) return ret; | 398 | if (ret) return ret; |
@@ -541,7 +544,7 @@ sys32_sysinfo(struct sysinfo32 __user *info) | |||
541 | int bitcount = 0; | 544 | int bitcount = 0; |
542 | 545 | ||
543 | set_fs (KERNEL_DS); | 546 | set_fs (KERNEL_DS); |
544 | ret = sys_sysinfo(&s); | 547 | ret = sys_sysinfo((struct sysinfo __user *)&s); |
545 | set_fs (old_fs); | 548 | set_fs (old_fs); |
546 | 549 | ||
547 | /* Check to see if any memory value is too large for 32-bit and scale | 550 | /* Check to see if any memory value is too large for 32-bit and scale |
@@ -589,7 +592,7 @@ sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *int | |||
589 | mm_segment_t old_fs = get_fs (); | 592 | mm_segment_t old_fs = get_fs (); |
590 | 593 | ||
591 | set_fs (KERNEL_DS); | 594 | set_fs (KERNEL_DS); |
592 | ret = sys_sched_rr_get_interval(pid, &t); | 595 | ret = sys_sched_rr_get_interval(pid, (struct timespec __user *)&t); |
593 | set_fs (old_fs); | 596 | set_fs (old_fs); |
594 | if (put_compat_timespec(&t, interval)) | 597 | if (put_compat_timespec(&t, interval)) |
595 | return -EFAULT; | 598 | return -EFAULT; |
@@ -605,7 +608,7 @@ sys32_rt_sigpending(compat_sigset_t __user *set, compat_size_t sigsetsize) | |||
605 | mm_segment_t old_fs = get_fs(); | 608 | mm_segment_t old_fs = get_fs(); |
606 | 609 | ||
607 | set_fs (KERNEL_DS); | 610 | set_fs (KERNEL_DS); |
608 | ret = sys_rt_sigpending(&s, sigsetsize); | 611 | ret = sys_rt_sigpending((sigset_t __user *)&s, sigsetsize); |
609 | set_fs (old_fs); | 612 | set_fs (old_fs); |
610 | if (!ret) { | 613 | if (!ret) { |
611 | switch (_NSIG_WORDS) { | 614 | switch (_NSIG_WORDS) { |
@@ -630,7 +633,7 @@ sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo) | |||
630 | if (copy_siginfo_from_user32(&info, uinfo)) | 633 | if (copy_siginfo_from_user32(&info, uinfo)) |
631 | return -EFAULT; | 634 | return -EFAULT; |
632 | set_fs (KERNEL_DS); | 635 | set_fs (KERNEL_DS); |
633 | ret = sys_rt_sigqueueinfo(pid, sig, &info); | 636 | ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *)&info); |
634 | set_fs (old_fs); | 637 | set_fs (old_fs); |
635 | return ret; | 638 | return ret; |
636 | } | 639 | } |
@@ -645,7 +648,7 @@ sys32_pause(void) | |||
645 | } | 648 | } |
646 | 649 | ||
647 | 650 | ||
648 | #ifdef CONFIG_SYSCTL | 651 | #ifdef CONFIG_SYSCTL_SYSCALL |
649 | struct sysctl_ia32 { | 652 | struct sysctl_ia32 { |
650 | unsigned int name; | 653 | unsigned int name; |
651 | int nlen; | 654 | int nlen; |
@@ -666,9 +669,6 @@ sys32_sysctl(struct sysctl_ia32 __user *args32) | |||
666 | size_t oldlen; | 669 | size_t oldlen; |
667 | int __user *namep; | 670 | int __user *namep; |
668 | long ret; | 671 | long ret; |
669 | extern int do_sysctl(int *name, int nlen, void *oldval, size_t *oldlenp, | ||
670 | void *newval, size_t newlen); | ||
671 | |||
672 | 672 | ||
673 | if (copy_from_user(&a32, args32, sizeof (a32))) | 673 | if (copy_from_user(&a32, args32, sizeof (a32))) |
674 | return -EFAULT; | 674 | return -EFAULT; |
@@ -692,7 +692,8 @@ sys32_sysctl(struct sysctl_ia32 __user *args32) | |||
692 | 692 | ||
693 | set_fs(KERNEL_DS); | 693 | set_fs(KERNEL_DS); |
694 | lock_kernel(); | 694 | lock_kernel(); |
695 | ret = do_sysctl(namep, a32.nlen, oldvalp, &oldlen, newvalp, (size_t) a32.newlen); | 695 | ret = do_sysctl(namep, a32.nlen, oldvalp, (size_t __user *)&oldlen, |
696 | newvalp, (size_t) a32.newlen); | ||
696 | unlock_kernel(); | 697 | unlock_kernel(); |
697 | set_fs(old_fs); | 698 | set_fs(old_fs); |
698 | 699 | ||
@@ -743,7 +744,8 @@ sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count) | |||
743 | return -EFAULT; | 744 | return -EFAULT; |
744 | 745 | ||
745 | set_fs(KERNEL_DS); | 746 | set_fs(KERNEL_DS); |
746 | ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count); | 747 | ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL, |
748 | count); | ||
747 | set_fs(old_fs); | 749 | set_fs(old_fs); |
748 | 750 | ||
749 | if (offset && put_user(of, offset)) | 751 | if (offset && put_user(of, offset)) |
@@ -778,7 +780,7 @@ asmlinkage long sys32_mmap2(unsigned long addr, unsigned long len, | |||
778 | 780 | ||
779 | asmlinkage long sys32_olduname(struct oldold_utsname __user * name) | 781 | asmlinkage long sys32_olduname(struct oldold_utsname __user * name) |
780 | { | 782 | { |
781 | int error; | 783 | int err; |
782 | 784 | ||
783 | if (!name) | 785 | if (!name) |
784 | return -EFAULT; | 786 | return -EFAULT; |
@@ -787,27 +789,31 @@ asmlinkage long sys32_olduname(struct oldold_utsname __user * name) | |||
787 | 789 | ||
788 | down_read(&uts_sem); | 790 | down_read(&uts_sem); |
789 | 791 | ||
790 | error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN); | 792 | err = __copy_to_user(&name->sysname,&system_utsname.sysname, |
791 | __put_user(0,name->sysname+__OLD_UTS_LEN); | 793 | __OLD_UTS_LEN); |
792 | __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN); | 794 | err |= __put_user(0,name->sysname+__OLD_UTS_LEN); |
793 | __put_user(0,name->nodename+__OLD_UTS_LEN); | 795 | err |= __copy_to_user(&name->nodename,&system_utsname.nodename, |
794 | __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN); | 796 | __OLD_UTS_LEN); |
795 | __put_user(0,name->release+__OLD_UTS_LEN); | 797 | err |= __put_user(0,name->nodename+__OLD_UTS_LEN); |
796 | __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN); | 798 | err |= __copy_to_user(&name->release,&system_utsname.release, |
797 | __put_user(0,name->version+__OLD_UTS_LEN); | 799 | __OLD_UTS_LEN); |
800 | err |= __put_user(0,name->release+__OLD_UTS_LEN); | ||
801 | err |= __copy_to_user(&name->version,&system_utsname.version, | ||
802 | __OLD_UTS_LEN); | ||
803 | err |= __put_user(0,name->version+__OLD_UTS_LEN); | ||
798 | { | 804 | { |
799 | char *arch = "x86_64"; | 805 | char *arch = "x86_64"; |
800 | if (personality(current->personality) == PER_LINUX32) | 806 | if (personality(current->personality) == PER_LINUX32) |
801 | arch = "i686"; | 807 | arch = "i686"; |
802 | 808 | ||
803 | __copy_to_user(&name->machine,arch,strlen(arch)+1); | 809 | err |= __copy_to_user(&name->machine,arch,strlen(arch)+1); |
804 | } | 810 | } |
805 | 811 | ||
806 | up_read(&uts_sem); | 812 | up_read(&uts_sem); |
807 | 813 | ||
808 | error = error ? -EFAULT : 0; | 814 | err = err ? -EFAULT : 0; |
809 | 815 | ||
810 | return error; | 816 | return err; |
811 | } | 817 | } |
812 | 818 | ||
813 | long sys32_uname(struct old_utsname __user * name) | 819 | long sys32_uname(struct old_utsname __user * name) |
@@ -831,7 +837,7 @@ long sys32_ustat(unsigned dev, struct ustat32 __user *u32p) | |||
831 | 837 | ||
832 | seg = get_fs(); | 838 | seg = get_fs(); |
833 | set_fs(KERNEL_DS); | 839 | set_fs(KERNEL_DS); |
834 | ret = sys_ustat(dev,&u); | 840 | ret = sys_ustat(dev, (struct ustat __user *)&u); |
835 | set_fs(seg); | 841 | set_fs(seg); |
836 | if (ret >= 0) { | 842 | if (ret >= 0) { |
837 | if (!access_ok(VERIFY_WRITE,u32p,sizeof(struct ustat32)) || | 843 | if (!access_ok(VERIFY_WRITE,u32p,sizeof(struct ustat32)) || |