diff options
author | Christoph Hellwig <hch@lst.de> | 2008-11-28 04:09:09 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-03-27 14:43:57 -0400 |
commit | 2b1c6bd77d4e6a727ffac8630cd154b2144b751a (patch) | |
tree | ffc4237dbeed66492124ef2ccecf48db0767531a /arch/x86 | |
parent | ec1ab0abde0af586a59541ad71841f022dcac3e7 (diff) |
generic compat_sys_ustat
Due to a different size of ino_t ustat needs a compat handler, but
currently only x86 and mips provide one. Add a generic compat_sys_ustat
and switch all architectures over to it. Instead of doing various
user copy hacks compat_sys_ustat just reimplements sys_ustat as
it's trivial. This was suggested by Arnd Bergmann.
Found by Eric Sandeen when running xfstests/017 on ppc64, which causes
stack smashing warnings on RHEL/Fedora due to the too large amount of
data writen by the syscall.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/ia32/ia32entry.S | 2 | ||||
-rw-r--r-- | arch/x86/ia32/sys_ia32.c | 22 | ||||
-rw-r--r-- | arch/x86/include/asm/ia32.h | 7 | ||||
-rw-r--r-- | arch/x86/include/asm/sys_ia32.h | 2 |
4 files changed, 1 insertions, 32 deletions
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S index 5a0d76dc56a4..8ef8876666b2 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S | |||
@@ -557,7 +557,7 @@ ia32_sys_call_table: | |||
557 | .quad sys32_olduname | 557 | .quad sys32_olduname |
558 | .quad sys_umask /* 60 */ | 558 | .quad sys_umask /* 60 */ |
559 | .quad sys_chroot | 559 | .quad sys_chroot |
560 | .quad sys32_ustat | 560 | .quad compat_sys_ustat |
561 | .quad sys_dup2 | 561 | .quad sys_dup2 |
562 | .quad sys_getppid | 562 | .quad sys_getppid |
563 | .quad sys_getpgrp /* 65 */ | 563 | .quad sys_getpgrp /* 65 */ |
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c index 6c0d7f6231af..efac92fd1efb 100644 --- a/arch/x86/ia32/sys_ia32.c +++ b/arch/x86/ia32/sys_ia32.c | |||
@@ -638,28 +638,6 @@ long sys32_uname(struct old_utsname __user *name) | |||
638 | return err ? -EFAULT : 0; | 638 | return err ? -EFAULT : 0; |
639 | } | 639 | } |
640 | 640 | ||
641 | long sys32_ustat(unsigned dev, struct ustat32 __user *u32p) | ||
642 | { | ||
643 | struct ustat u; | ||
644 | mm_segment_t seg; | ||
645 | int ret; | ||
646 | |||
647 | seg = get_fs(); | ||
648 | set_fs(KERNEL_DS); | ||
649 | ret = sys_ustat(dev, (struct ustat __user *)&u); | ||
650 | set_fs(seg); | ||
651 | if (ret < 0) | ||
652 | return ret; | ||
653 | |||
654 | if (!access_ok(VERIFY_WRITE, u32p, sizeof(struct ustat32)) || | ||
655 | __put_user((__u32) u.f_tfree, &u32p->f_tfree) || | ||
656 | __put_user((__u32) u.f_tinode, &u32p->f_tfree) || | ||
657 | __copy_to_user(&u32p->f_fname, u.f_fname, sizeof(u.f_fname)) || | ||
658 | __copy_to_user(&u32p->f_fpack, u.f_fpack, sizeof(u.f_fpack))) | ||
659 | ret = -EFAULT; | ||
660 | return ret; | ||
661 | } | ||
662 | |||
663 | asmlinkage long sys32_execve(char __user *name, compat_uptr_t __user *argv, | 641 | asmlinkage long sys32_execve(char __user *name, compat_uptr_t __user *argv, |
664 | compat_uptr_t __user *envp, struct pt_regs *regs) | 642 | compat_uptr_t __user *envp, struct pt_regs *regs) |
665 | { | 643 | { |
diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h index 50ca486fd88c..1f7e62517284 100644 --- a/arch/x86/include/asm/ia32.h +++ b/arch/x86/include/asm/ia32.h | |||
@@ -129,13 +129,6 @@ typedef struct compat_siginfo { | |||
129 | } _sifields; | 129 | } _sifields; |
130 | } compat_siginfo_t; | 130 | } compat_siginfo_t; |
131 | 131 | ||
132 | struct ustat32 { | ||
133 | __u32 f_tfree; | ||
134 | compat_ino_t f_tinode; | ||
135 | char f_fname[6]; | ||
136 | char f_fpack[6]; | ||
137 | }; | ||
138 | |||
139 | #define IA32_STACK_TOP IA32_PAGE_OFFSET | 132 | #define IA32_STACK_TOP IA32_PAGE_OFFSET |
140 | 133 | ||
141 | #ifdef __KERNEL__ | 134 | #ifdef __KERNEL__ |
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h index ffb08be2a530..72a6dcd1299b 100644 --- a/arch/x86/include/asm/sys_ia32.h +++ b/arch/x86/include/asm/sys_ia32.h | |||
@@ -70,8 +70,6 @@ struct old_utsname; | |||
70 | asmlinkage long sys32_olduname(struct oldold_utsname __user *); | 70 | asmlinkage long sys32_olduname(struct oldold_utsname __user *); |
71 | long sys32_uname(struct old_utsname __user *); | 71 | long sys32_uname(struct old_utsname __user *); |
72 | 72 | ||
73 | long sys32_ustat(unsigned, struct ustat32 __user *); | ||
74 | |||
75 | asmlinkage long sys32_execve(char __user *, compat_uptr_t __user *, | 73 | asmlinkage long sys32_execve(char __user *, compat_uptr_t __user *, |
76 | compat_uptr_t __user *, struct pt_regs *); | 74 | compat_uptr_t __user *, struct pt_regs *); |
77 | asmlinkage long sys32_clone(unsigned int, unsigned int, struct pt_regs *); | 75 | asmlinkage long sys32_clone(unsigned int, unsigned int, struct pt_regs *); |