aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/ia32/sys_ia32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/ia32/sys_ia32.c')
-rw-r--r--arch/x86_64/ia32/sys_ia32.c54
1 files changed, 30 insertions, 24 deletions
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
649struct sysctl_ia32 { 652struct 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
779asmlinkage long sys32_olduname(struct oldold_utsname __user * name) 781asmlinkage 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
813long sys32_uname(struct old_utsname __user * name) 819long 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)) ||