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>
This commit is contained in:
committed by
Al Viro
parent
ec1ab0abde
commit
2b1c6bd77d
@ -557,7 +557,7 @@ ia32_sys_call_table:
|
||||
.quad sys32_olduname
|
||||
.quad sys_umask /* 60 */
|
||||
.quad sys_chroot
|
||||
.quad sys32_ustat
|
||||
.quad compat_sys_ustat
|
||||
.quad sys_dup2
|
||||
.quad sys_getppid
|
||||
.quad sys_getpgrp /* 65 */
|
||||
|
@ -638,28 +638,6 @@ long sys32_uname(struct old_utsname __user *name)
|
||||
return err ? -EFAULT : 0;
|
||||
}
|
||||
|
||||
long sys32_ustat(unsigned dev, struct ustat32 __user *u32p)
|
||||
{
|
||||
struct ustat u;
|
||||
mm_segment_t seg;
|
||||
int ret;
|
||||
|
||||
seg = get_fs();
|
||||
set_fs(KERNEL_DS);
|
||||
ret = sys_ustat(dev, (struct ustat __user *)&u);
|
||||
set_fs(seg);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (!access_ok(VERIFY_WRITE, u32p, sizeof(struct ustat32)) ||
|
||||
__put_user((__u32) u.f_tfree, &u32p->f_tfree) ||
|
||||
__put_user((__u32) u.f_tinode, &u32p->f_tfree) ||
|
||||
__copy_to_user(&u32p->f_fname, u.f_fname, sizeof(u.f_fname)) ||
|
||||
__copy_to_user(&u32p->f_fpack, u.f_fpack, sizeof(u.f_fpack)))
|
||||
ret = -EFAULT;
|
||||
return ret;
|
||||
}
|
||||
|
||||
asmlinkage long sys32_execve(char __user *name, compat_uptr_t __user *argv,
|
||||
compat_uptr_t __user *envp, struct pt_regs *regs)
|
||||
{
|
||||
|
Reference in New Issue
Block a user